Documentation
¶
Index ¶
- type Applier
- type ApplierOptions
- type BaseCustomObject
- type CacheManager
- type ChartFlags
- type ChartInfo
- type Check
- type CheckFnType
- type ClusterInfo
- type ClusterInfoCache
- type Codec
- type CustomObject
- type Flags
- type HelmChartSpec
- type HelmOperation
- type ImageSpec
- type InstallInfo
- type InstallationSpec
- type KustomizeSpec
- type LabelNotFoundError
- type ManifestClient
- type ManifestResolver
- type ManifestResources
- type MultiError
- type ObjectTransform
- type OperationType
- type ParsedFile
- type RefTypeMetadata
- type RendererCache
- type ResourceInfo
- type ResourceLists
- type State
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier interface {
Apply(deployInfo InstallInfo, objects *ManifestResources, namespace string) (bool, error)
}
type ApplierOptions ¶
type CacheManager ¶
type CacheManager interface { // InvalidateForOwner invalidates all cache entries which are cached by an owner key. // Here all caches should be deleted where entries are unique by a parent resource. InvalidateForOwner(key client.ObjectKey) // InvalidateSelf invalidates all cache entries which are cached on resource level. // Here all cache entries should be deleted where entries are unique by a resource itself. InvalidateSelf(key client.ObjectKey) // GetRendererCache returns the cache stored under RendererCache. GetRendererCache() RendererCache }
CacheManager contains ClusterInfoCache and RendererCache cached entries. It offers utility methods to access the underlying caches as well as invalidate entries.
type ChartFlags ¶
type ChartFlags struct { // ConfigFlags support string, bool and int types as helm chart flags // check: https://github.com/helm/helm/blob/d7b4c38c42cb0b77f1bcebf9bb4ae7695a10da0b/pkg/action/install.go#L67 ConfigFlags Flags // SetFlags are chart value overrides SetFlags Flags }
ChartFlags define flag based configurations for helm chart processing.
type ChartInfo ¶
type ChartInfo struct { ChartPath string RepoName string URL string ChartName string ReleaseName string Flags ChartFlags }
ChartInfo defines helm chart information.
type Check ¶
type Check interface { CheckFn(context.Context, *unstructured.Unstructured, logr.Logger, ClusterInfo) (bool, error) DefaultFn(context.Context, *unstructured.Unstructured, logr.Logger, ClusterInfo) (bool, error) }
type CheckFnType ¶
type CheckFnType func(context.Context, *unstructured.Unstructured, logr.Logger, ClusterInfo) (bool, error)
type ClusterInfo ¶
ClusterInfo describes client and config for a cluster.
func (ClusterInfo) IsEmpty ¶
func (r ClusterInfo) IsEmpty() bool
IsEmpty indicates if ClusterInfo is empty.
type ClusterInfoCache ¶
type ClusterInfoCache interface { // Get returns the cluster information cached entry by the key passed. Get(key client.ObjectKey) ClusterInfo // Set sets the cluster information cached entry by the key passed. Set(key client.ObjectKey, info ClusterInfo) // Delete deletes the cluster information cached entry by the key passed. Delete(key client.ObjectKey) }
ClusterInfoCache offers utility methods to access ClusterInfo cached instances.
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
+kubebuilder:object:generate=false
type CustomObject ¶
type HelmChartSpec ¶
type HelmChartSpec struct { // URL defines the helm repo URL // +kubebuilder:validation:Optional URL string `json:"url"` // ChartName defines the helm chart name // +kubebuilder:validation:Optional ChartName string `json:"chartName"` // Type defines the chart as "helm-chart" // +kubebuilder:validation:Optional Type RefTypeMetadata `json:"type"` }
HelmChartSpec defines the specification for a helm chart.
type HelmOperation ¶
type HelmOperation OperationType
const ( OperationCreate HelmOperation = "create" OperationDelete HelmOperation = "delete" )
type ImageSpec ¶
type ImageSpec struct { // Repo defines the Image repo // +kubebuilder:validation:Optional Repo string `json:"repo"` // Name defines the Image name // +kubebuilder:validation:Optional Name string `json:"name"` // Ref is either a sha value, tag or version // +kubebuilder:validation:Optional Ref string `json:"ref"` // Type defines the chart as "oci-ref" // +kubebuilder:validation:Optional Type RefTypeMetadata `json:"type"` }
ImageSpec defines OCI Image specifications.
type InstallInfo ¶
type InstallInfo struct { // ChartInfo represents chart information to be processed *ChartInfo // ResourceInfo represents additional resources to be processed ResourceInfo // ClusterInfo represents target cluster information ClusterInfo // Ctx hold the current context Ctx context.Context //nolint:containedctx // CheckFn returns a boolean indicating ready state based on custom checks CheckFn CheckFnType // CheckReadyStates indicates if native resources should be checked for ready states CheckReadyStates bool // UpdateRepositories indicates if repositories should be updated UpdateRepositories bool }
InstallInfo represents deployment information artifacts to be processed.
type InstallationSpec ¶
type InstallationSpec struct { ChartPath string ReleaseName string ChartFlags }
type KustomizeSpec ¶
type KustomizeSpec struct { // Path defines the Kustomize local path Path string `json:"path"` // URL defines the Kustomize remote URL URL string `json:"url"` // Type defines the chart as "kustomize" // +kubebuilder:validation:Optional Type RefTypeMetadata `json:"type"` }
KustomizeSpec defines the specification for a Kustomize specification.
type LabelNotFoundError ¶
func (*LabelNotFoundError) Error ¶
func (m *LabelNotFoundError) Error() string
type ManifestClient ¶
type ManifestClient interface { // GetRawManifest returns processed resource manifest using the client. GetRawManifest(deployInfo InstallInfo) *ParsedFile // Install transforms and applies resources based on InstallInfo. Install(manifest string, deployInfo InstallInfo, transforms []ObjectTransform) (bool, error) // Uninstall transforms and applies resources based on InstallInfo. Uninstall(manifest string, deployInfo InstallInfo, transforms []ObjectTransform) (bool, error) // IsConsistent transforms and checks if resources are consistently installed based on InstallInfo. IsConsistent(manifest string, deployInfo InstallInfo, transforms []ObjectTransform) (bool, error) // GetCachedResources returns a resource manifest which was already cached during previous operations. // By default, it looks inside <chart-path>/manifest/manifest.yaml GetCachedResources(chartName, chartPath string) *ParsedFile // DeleteCachedResources deletes cached resource manifest. // By default, it deletes <chart-path>/manifest/manifest.yaml. DeleteCachedResources(chartPath string) *ParsedFile // GetManifestResources returns a pre-rendered resource manifest file located at the passed chartPath. // If multiple YAML files are present at the dirPath, it cannot resolve the file to be used, hence will not process. GetManifestResources(dirPath string) *ParsedFile // InvalidateConfigAndRenderedManifest compares the cached hash with the processed hash for helm flags. // On mismatch, it invalidates the cached manifest and resets flags on client. InvalidateConfigAndRenderedManifest(deployInfo InstallInfo, cachedHash uint32) (uint32, error) // GetClusterInfo returns Client and REST config for the target cluster GetClusterInfo() (ClusterInfo, error) }
ManifestClient offers client utility methods for processing of manifest resources.
type ManifestResolver ¶
type ManifestResolver interface { // Get returns chart information to be processed, based on the passed CR. Get(object BaseCustomObject, logger logr.Logger) (InstallationSpec, error) }
ManifestResolver represents local chart processing information.
type ManifestResources ¶
type ManifestResources struct { Items []*unstructured.Unstructured Blobs [][]byte }
ManifestResources holds a collection of objects, so that we can filter / sequence them.
type MultiError ¶
type MultiError struct {
Errs []error
}
func NewMultiError ¶
func NewMultiError(errs []error) *MultiError
func (MultiError) Error ¶
func (m MultiError) Error() string
type ObjectTransform ¶
type ObjectTransform = func(context.Context, BaseCustomObject, *ManifestResources) error
ObjectTransform is an operation that transforms the manifest objects before applying it.
type OperationType ¶
type OperationType string
type ParsedFile ¶
type ParsedFile struct {
// contains filtered or unexported fields
}
ParsedFile contains the parsed content and any error encountered during processing of a file.
func NewParsedFile ¶
func NewParsedFile(content string, err error) *ParsedFile
func (*ParsedFile) Error ¶
func (fe *ParsedFile) Error() string
Error returns the error message during parsing of the file.
func (*ParsedFile) FilterOsErrors ¶
func (fe *ParsedFile) FilterOsErrors() *ParsedFile
FilterOsErrors filters out os.IsPermission and os.IsNotExist errors.
func (*ParsedFile) GetContent ¶
func (fe *ParsedFile) GetContent() string
GetContent returns the raw content of the parsed file.
func (*ParsedFile) GetRawError ¶
func (fe *ParsedFile) GetRawError() error
GetRawError returns the raw error during parsing of the file.
func (*ParsedFile) IsResultConclusive ¶
func (fe *ParsedFile) IsResultConclusive() bool
IsResultConclusive indicates if caching results are processed.
type RefTypeMetadata ¶
type RefTypeMetadata string
RefTypeMetadata specifies the type of installation specification that could be provided as part of a custom resource. This time is used in codec to successfully decode from raw extensions. +kubebuilder:validation:Enum=helm-chart;oci-ref;"kustomize";""
const ( HelmChartType RefTypeMetadata = "helm-chart" OciRefType RefTypeMetadata = "oci-ref" KustomizeType RefTypeMetadata = "kustomize" NilRefType RefTypeMetadata = "" )
func GetSpecType ¶
func GetSpecType(data []byte) (RefTypeMetadata, error)
func (RefTypeMetadata) NotEmpty ¶
func (r RefTypeMetadata) NotEmpty() bool
type RendererCache ¶
type RendererCache interface { // GetProcessor returns the manifest processor cached entry by key passed. GetProcessor(key client.ObjectKey) ManifestClient // SetProcessor sets the manifest processor cached entry by key passed. SetProcessor(key client.ObjectKey, renderSrc ManifestClient) // DeleteProcessor deletes the manifest processor cached entry by key passed. DeleteProcessor(key client.ObjectKey) // GetConfig returns the hashed configuration cached entry by key passed. GetConfig(key client.ObjectKey) uint32 // SetConfig returns the hashed configuration cached entry by key passed. SetConfig(key client.ObjectKey, cfg uint32) // DeleteConfig deletes the hashed configuration cached entry by key passed. DeleteConfig(key client.ObjectKey) }
RendererCache offers utility methods to access ManifestClient cached instances.
type ResourceInfo ¶
type ResourceInfo struct { // BaseResource represents base custom resource that is being reconciled BaseResource *unstructured.Unstructured // CustomResources represents a set of additional custom resources to be installed CustomResources []*unstructured.Unstructured // Crds represents a set of additional custom resource definitions to be installed Crds []*v1.CustomResourceDefinition }
ResourceInfo represents additional resources.
type ResourceLists ¶
type ResourceLists struct { Target kube.ResourceList Installed kube.ResourceList Namespace kube.ResourceList }
func (*ResourceLists) GetResourcesToBeDeleted ¶
func (r *ResourceLists) GetResourcesToBeDeleted() kube.ResourceList
func (*ResourceLists) GetWaitForResources ¶
func (r *ResourceLists) GetWaitForResources() kube.ResourceList
type State ¶
type State string
const ( // StateReady signifies CustomObject is ready and has been installed successfully. StateReady State = "Ready" // StateProcessing signifies CustomObject is reconciling and is in the process of installation. // Processing can also signal that the Installation previously encountered an error and is now recovering. StateProcessing State = "Processing" // StateError signifies an error for CustomObject. This signifies that the Installation // process encountered an error. // Contrary to Processing, it can be expected that this state should change on the next retry. StateError State = "Error" // StateDeleting signifies CustomObject is being deleted. This is the state that is used // when a deletionTimestamp was detected and Finalizers are picked up. StateDeleting State = "Deleting" )
Valid CustomObject States.
type Status ¶
type Status struct { // State signifies current state of CustomObject. // Value can be one of ("Ready", "Processing", "Error", "Deleting"). // +kubebuilder:validation:Required // +kubebuilder:validation:Enum=Processing;Deleting;Ready;Error State State `json:"state"` // Conditions associated with CustomStatus. Conditions []*metav1.Condition `json:"conditions,omitempty"` }
Status defines the observed state of CustomObject.
func (*Status) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.
func (*Status) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.