Documentation
¶
Overview ¶
nolint
Index ¶
- Constants
- func AddAnnotationEMWarningValidation(c client.Client, log logr.Logger, ibu *ibuv1.ImageBasedUpgrade, ...) error
- func ApplyExtraManifest(ctx context.Context, dc dynamic.Interface, restMapper meta.RESTMapper, ...) error
- func GetMatchingTargetOcpVersionLabelVersions(ocpVersion string) ([]string, error)
- func IsEMFailedError(err error) bool
- func RemoveAnnotationEMWarningValidation(c client.Client, log logr.Logger, ibu *ibuv1.ImageBasedUpgrade) error
- type EMHandler
- func (h *EMHandler) ApplyExtraManifests(ctx context.Context, fromDir string) error
- func (h *EMHandler) ExportExtraManifestToDir(ctx context.Context, extraManifestCMs []ibuv1.ConfigMapRef, toDir string) error
- func (h *EMHandler) ExtractAndExportManifestFromPoliciesToDir(ctx context.Context, ...) error
- func (h *EMHandler) GetPolicies(ctx context.Context, labels map[string]string) ([]*policiesv1.Policy, error)
- func (h *EMHandler) ValidateAndExtractManifestFromPolicies(ctx context.Context, ...) ([][]*unstructured.Unstructured, error)
- func (h *EMHandler) ValidateExtraManifestConfigmaps(ctx context.Context, content []ibuv1.ConfigMapRef) (string, error)
- type EMStatusError
- type EManifestHandler
Constants ¶
const ( CmManifestPath = "/opt/extra-manifests" // manifests extracted from configmaps PolicyManifestPath = "/opt/policy-manifests" // manifests extracted from policies ValidationWarningAnnotation = "extra-manifest.lca.openshift.io/validation-warning" )
const TargetOcpVersionLabel = "lca.openshift.io/target-ocp-version"
const TargetOcpVersionManifestCountAnnotation = "lca.openshift.io/target-ocp-version-manifest-count"
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationEMWarningValidation ¶
func AddAnnotationEMWarningValidation(c client.Client, log logr.Logger, ibu *ibuv1.ImageBasedUpgrade, annotationValue string) error
AddAnnotationEMWarningValidation add warning in annotation for when CRD is unknown
func ApplyExtraManifest ¶
func ApplyExtraManifest(ctx context.Context, dc dynamic.Interface, restMapper meta.RESTMapper, manifest *unstructured.Unstructured, isDryRun bool) error
func GetMatchingTargetOcpVersionLabelVersions ¶
GetMatchingTargetOcpVersionLabelVersions generates a list of matching versions that be used for extracting manifests from the policy The matching versions include: [full release version, Major.Minor.Patch, Major.Minor]
func IsEMFailedError ¶
func RemoveAnnotationEMWarningValidation ¶
func RemoveAnnotationEMWarningValidation(c client.Client, log logr.Logger, ibu *ibuv1.ImageBasedUpgrade) error
RemoveAnnotationEMWarningValidation remove the warning if present
Types ¶
type EMHandler ¶
EMHandler handles the extra manifests
func (*EMHandler) ApplyExtraManifests ¶
ApplyExtraManifests applies the extra manifests from the preserved extra manifests directory
func (*EMHandler) ExportExtraManifestToDir ¶
func (h *EMHandler) ExportExtraManifestToDir(ctx context.Context, extraManifestCMs []ibuv1.ConfigMapRef, toDir string) error
ExportExtraManifestToDir extracts the extra manifests from configmaps and writes them to the given directory
func (*EMHandler) ExtractAndExportManifestFromPoliciesToDir ¶
func (h *EMHandler) ExtractAndExportManifestFromPoliciesToDir(ctx context.Context, policyLabels, objectLabels, validationAnns map[string]string, toDir string) error
ExtractAndExportManifestFromPoliciesToDir extracts CR specs from policies and writes to a given directory. It matches policies and/or CRs by labels.
func (*EMHandler) GetPolicies ¶
func (h *EMHandler) GetPolicies(ctx context.Context, labels map[string]string) ([]*policiesv1.Policy, error)
GetPolicies gets the policies matching the labels from the namespace and sort them by the ztp wave annotation value
func (*EMHandler) ValidateAndExtractManifestFromPolicies ¶
func (h *EMHandler) ValidateAndExtractManifestFromPolicies(ctx context.Context, policyLabels, objectLabels, validationAnns map[string]string) ([][]*unstructured.Unstructured, error)
func (*EMHandler) ValidateExtraManifestConfigmaps ¶
func (h *EMHandler) ValidateExtraManifestConfigmaps(ctx context.Context, content []ibuv1.ConfigMapRef) (string, error)
ValidateExtraManifestConfigmaps validates IBU extramanifest configmaps and returns validation warning and error. It iterates over all manifests included in the configmaps and perform Kubernetes Dry-run. Errors such as Invalid or webhook BadRequest types from Dry-run apply are considered warnings. This also includes cases where CRDs are missing from the current stateroot and dependent namespace does not exist on the current stateroot but is also not found in the configmaps. Other validation failures are treated as errors, such as random chars, missing resource Kind, resource ApiVersion, resource name or the presence of disallowed resource types
type EMStatusError ¶
EMStatusError type
func NewEMFailedError ¶
func NewEMFailedError(msg string) *EMStatusError
func NewEMFailedValidationError ¶
func NewEMFailedValidationError(msg string) *EMStatusError
func (*EMStatusError) Error ¶
func (e *EMStatusError) Error() string
type EManifestHandler ¶
type EManifestHandler interface { ApplyExtraManifests(ctx context.Context, fromDir string) error ExportExtraManifestToDir(ctx context.Context, extraManifestCMs []ibuv1.ConfigMapRef, toDir string) error ExtractAndExportManifestFromPoliciesToDir(ctx context.Context, policyLabels, objectLabels, validationAnns map[string]string, toDir string) error ValidateAndExtractManifestFromPolicies(ctx context.Context, policyLabels, objectLabels, validationAnns map[string]string) ([][]*unstructured.Unstructured, error) ValidateExtraManifestConfigmaps(ctx context.Context, extraManifestCMs []ibuv1.ConfigMapRef) (string, error) }