extramanifest

package
v0.0.0-...-ef30b53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	ExtraManifestPath           = "/opt/extra-manifests"
	PolicyManifestPath          = "/opt/policy-manifests"
	WarnAnnotationUnknownCRDKey = "lca.openshift.io/warn-extramanifest-cm-unknown-crd"
)
View Source
const TargetOcpVersionLabel = "lca.openshift.io/target-ocp-version"
View Source
const TargetOcpVersionManifestCountAnnotation = "lca.openshift.io/target-ocp-version-manifest-count"

Variables

This section is empty.

Functions

func AddAnnotationWarnUnknownCRD

func AddAnnotationWarnUnknownCRD(c client.Client, log logr.Logger, ibu *lcav1alpha1.ImageBasedUpgrade, annotationValue string) error

AddAnnotationWarnUnknownCRD 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

func GetMatchingTargetOcpVersionLabelVersions(ocpVersion string) ([]string, error)

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 IsEMFailedError(err error) bool

func RemoveAnnotationWarnUnknownCRD

func RemoveAnnotationWarnUnknownCRD(c client.Client, ibu *lcav1alpha1.ImageBasedUpgrade, log logr.Logger) error

RemoveAnnotationWarnUnknownCRD remove the warning if present

Types

type EMHandler

type EMHandler struct {
	Client        client.Client
	DynamicClient dynamic.Interface
	Log           logr.Logger
}

EMHandler handles the extra manifests

func (*EMHandler) ApplyExtraManifests

func (h *EMHandler) ApplyExtraManifests(ctx context.Context, fromDir string) error

ApplyExtraManifests applies the extra manifests from the preserved extra manifests directory

func (*EMHandler) ExportExtraManifestToDir

func (h *EMHandler) ExportExtraManifestToDir(ctx context.Context, extraManifestCMs []lcav1alpha1.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 []lcav1alpha1.ConfigMapRef, ibu *lcav1alpha1.ImageBasedUpgrade) error

type EMStatusError

type EMStatusError struct {
	Reason     string
	ErrMessage string
}

EMStatusError type

func NewEMFailedError

func NewEMFailedError(msg string) *EMStatusError

func NewEMFailedValidationError

func NewEMFailedValidationError(msg string) *EMStatusError

func NewEMUnknownCRDError

func NewEMUnknownCRDError(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 []lcav1alpha1.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 []lcav1alpha1.ConfigMapRef, ibu *lcav1alpha1.ImageBasedUpgrade) error
}

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL