Documentation ¶
Index ¶
- Constants
- Variables
- func SkipReconcileOnDefaultLabelPresentAndTrue(ctx context.Context, object Object) bool
- type Cleanup
- type Client
- type ClientCache
- type ClientCacheKeyFn
- type ClusterFn
- type ConcurrentCleanup
- type ConditionReason
- type ConditionType
- type ConditionsNeedUpdate
- type CustomSpecFns
- type ExistsReadyCheck
- type Helm
- type HelmReadyCheck
- type Hook
- type InMemoryManifestCache
- type InfoToResourceConverter
- type Kustomize
- type LastOperation
- type ManifestCache
- type ManifestParser
- type MemoryClientCache
- type Object
- type ObjectTransform
- type Option
- type Options
- type PostRenderTransformOption
- type PostRun
- type PreDelete
- type Prerequisites
- type RawRenderer
- type ReadyCheck
- type Reconciler
- type RenderMode
- type Renderer
- type RendererWithCache
- type Resource
- type ResourceInfoConverter
- type ResourceToInfoConverter
- type SSA
- type SkipReconcile
- type Spec
- type SpecResolver
- type SpecResolverOption
- type State
- type Status
- type WithClientCacheKeyOption
- type WithCustomReadyCheckOption
- type WithCustomResourceLabels
- type WithDeleteCRDs
- type WithFieldOwner
- type WithFinalizer
- type WithManagerOption
- type WithManifestCache
- type WithManifestParserOption
- type WithNamespaceOption
- type WithPeriodicConsistencyCheck
- type WithPermanentConsistencyCheck
- type WithPostRun
- type WithPreDelete
- type WithRemoteTargetClusterOption
- type WithSingletonClientCacheOption
- type WithSkipReconcileOnOption
Constants ¶
const ( DisclaimerAnnotation = "reconciler.kyma-project.io/managed-by-reconciler-disclaimer" ManagedByLabel = "reconciler.kyma-project.io/managed-by" )
const ( ConditionTypeHelmCRDs ConditionType = "HelmCRDs" ConditionReasonHelmCRDsAreAvailable ConditionReason = "HelmCRDsAvailable" )
const ( FinalizerDefault = "declarative.kyma-project.io/finalizer" FieldOwnerDefault = "declarative.kyma-project.io/applier" EventRecorderDefault = "declarative.kyma-project.io/events" DefaultSkipReconcileLabel = "declarative.kyma-project.io/skip-reconciliation" DefaultCacheKey = "declarative.kyma-project.io/cache-key" DefaultInMemoryParseTTL = 24 * time.Hour )
Variables ¶
var ( ErrResourceSyncStateDiff = errors.New("resource syncTarget state diff detected") ErrInstallationConditionRequiresUpdate = errors.New("installation condition needs an update") ErrDeletionTimestampSetButNotInDeletingState = errors.New("resource is not set to deleting yet") ErrObjectHasEmptyState = errors.New("object has an empty state") )
var ( ErrConditionsNotYetRegistered = errors.New("conditions have not yet been registered in status") ErrPrerequisitesNotFulfilled = errors.New("prerequisites for installation are not fulfilled") )
var ErrDeletionNotFinished = errors.New("deletion is not yet finished")
var ErrResourcesNotReady = errors.New("resources are not ready")
Functions ¶
Types ¶
type Cleanup ¶
func NewConcurrentCleanup ¶
type ClientCache ¶
type ConcurrentCleanup ¶
type ConcurrentCleanup struct {
// contains filtered or unexported fields
}
type ConditionReason ¶
type ConditionReason string
const ( ConditionReasonResourcesAreAvailable ConditionReason = "ResourcesAvailable" ConditionReasonReady ConditionReason = "Ready" )
type ConditionType ¶
type ConditionType string
const ( ConditionTypeResources ConditionType = "Resources" ConditionTypeInstallation ConditionType = "Installation" )
type ConditionsNeedUpdate ¶
type ConditionsNeedUpdate bool
type CustomSpecFns ¶
type CustomSpecFns struct { ManifestNameFn func(ctx context.Context, obj Object) string PathFn func(ctx context.Context, obj Object) string ValuesFn func(ctx context.Context, obj Object) any ModeFn func(ctx context.Context, obj Object) RenderMode }
CustomSpecFns is a simple static resolver that always uses the same chart and values.
func DefaultSpec ¶
func DefaultSpec(path string, values any, mode RenderMode) *CustomSpecFns
type ExistsReadyCheck ¶
type ExistsReadyCheck struct{}
type Helm ¶
type Helm struct {
// contains filtered or unexported fields
}
func (*Helm) EnsurePrerequisites ¶
func (*Helm) Initialize ¶
func (*Helm) RemovePrerequisites ¶
type HelmReadyCheck ¶
type HelmReadyCheck struct {
// contains filtered or unexported fields
}
type Hook ¶
Hook defines a Hook into the declarative reconciliation skr is the runtime cluster kcp is the control-plane cluster obj is guaranteed to be the reconciled object and also to always preside in kcp.
type InMemoryManifestCache ¶
type InMemoryManifestCache struct { TTL time.Duration *ttlcache.Cache[string, types.ManifestResources] }
func NewInMemoryCachedManifestParser ¶
func NewInMemoryCachedManifestParser(ttl time.Duration) *InMemoryManifestCache
type InfoToResourceConverter ¶
func NewInfoToResourceConverter ¶
func NewInfoToResourceConverter() InfoToResourceConverter
type Kustomize ¶
type Kustomize struct {
// contains filtered or unexported fields
}
func (*Kustomize) EnsurePrerequisites ¶
func (*Kustomize) Initialize ¶
func (*Kustomize) RemovePrerequisites ¶
type LastOperation ¶
type LastOperation struct { Operation string `json:"operation"` LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` }
LastOperation defines the last operation from the control-loop. +k8s:deepcopy-gen=true
func (*LastOperation) DeepCopy ¶
func (in *LastOperation) DeepCopy() *LastOperation
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastOperation.
func (*LastOperation) DeepCopyInto ¶
func (in *LastOperation) DeepCopyInto(out *LastOperation)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ManifestParser ¶
type MemoryClientCache ¶
type MemoryClientCache struct {
// contains filtered or unexported fields
}
func NewMemorySingletonClientCache ¶
func NewMemorySingletonClientCache() *MemoryClientCache
NewMemorySingletonClientCache returns a new instance of MemoryClientCache.
func (*MemoryClientCache) GetClientFromCache ¶
func (r *MemoryClientCache) GetClientFromCache(key any) Client
func (*MemoryClientCache) SetClientInCache ¶
func (r *MemoryClientCache) SetClientInCache(key any, client Client)
type ObjectTransform ¶
type ObjectTransform = func(context.Context, Object, []*unstructured.Unstructured) error
type Options ¶
type Options struct { record.EventRecorder Config *rest.Config client.Client TargetCluster ClusterFn SpecResolver ClientCache ClientCacheKeyFn ManifestParser ManifestCache CustomReadyCheck ReadyCheck Namespace string CreateNamespace bool Finalizer string ServerSideApply bool FieldOwner client.FieldOwner PostRenderTransforms []ObjectTransform PostRuns []PostRun PreDeletes []PreDelete DeletePrerequisites bool ShouldSkip SkipReconcile CtrlOnSuccess ctrl.Result }
func DefaultOptions ¶
func DefaultOptions() *Options
type PostRenderTransformOption ¶
type PostRenderTransformOption struct {
ObjectTransforms []ObjectTransform
}
func WithPostRenderTransform ¶
func WithPostRenderTransform(transforms ...ObjectTransform) PostRenderTransformOption
func (PostRenderTransformOption) Apply ¶
func (o PostRenderTransformOption) Apply(options *Options)
type PostRun ¶
type PostRun Hook
PostRun is executed after every successful render+reconciliation of the manifest.
type PreDelete ¶
type PreDelete Hook
PreDelete is executed before any deletion of resources calculated from the status.
type Prerequisites ¶
type RawRenderer ¶
type RawRenderer struct { record.EventRecorder Path string }
func (*RawRenderer) EnsurePrerequisites ¶
func (r *RawRenderer) EnsurePrerequisites(_ context.Context, _ Object) error
func (*RawRenderer) Initialize ¶
func (r *RawRenderer) Initialize(_ Object) error
func (*RawRenderer) RemovePrerequisites ¶
func (r *RawRenderer) RemovePrerequisites(_ context.Context, _ Object) error
type ReadyCheck ¶
type ReadyCheck interface {
Run(ctx context.Context, clnt Client, obj Object, resources []*resource.Info) error
}
func NewExistsReadyCheck ¶
func NewExistsReadyCheck() ReadyCheck
func NewHelmReadyCheck ¶
func NewHelmReadyCheck(factory kube.Factory) ReadyCheck
type Reconciler ¶
type Reconciler struct { *Options // contains filtered or unexported fields }
func NewFromManager ¶
func NewFromManager(mgr manager.Manager, prototype Object, options ...Option) *Reconciler
type RenderMode ¶
type RenderMode string
const ( RenderModeHelm RenderMode = "helm" RenderModeKustomize RenderMode = "kustomize" RenderModeRaw RenderMode = "raw" )
type Renderer ¶
type Renderer interface { Initialize(obj Object) error EnsurePrerequisites(ctx context.Context, obj Object) error Render(ctx context.Context, obj Object) ([]byte, error) RemovePrerequisites(ctx context.Context, obj Object) error }
func NewKustomizeRenderer ¶
func NewRawRenderer ¶
type RendererWithCache ¶
type RendererWithCache struct { Renderer // contains filtered or unexported fields }
func (RendererWithCache) ReadYAML ¶
func (c RendererWithCache) ReadYAML() *types.ParsedFile
type Resource ¶
type Resource struct { Name string `json:"name"` Namespace string `json:"namespace"` metav1.GroupVersionKind `json:",inline"` }
func ResourcesDiff ¶
func (Resource) ToUnstructured ¶
func (r Resource) ToUnstructured() *unstructured.Unstructured
type ResourceInfoConverter ¶
type ResourceInfoConverter interface {
ResourceInfo(obj *unstructured.Unstructured, retryOnNoMatch bool) (*resource.Info, error)
}
type ResourceToInfoConverter ¶
type ResourceToInfoConverter interface { ResourcesToInfos([]Resource) ([]*resource.Info, error) UnstructuredToInfos([]*unstructured.Unstructured) ([]*resource.Info, error) }
func NewResourceToInfoConverter ¶
func NewResourceToInfoConverter(converter ResourceInfoConverter, defaultNamespace string) ResourceToInfoConverter
type SSA ¶
func ConcurrentSSA ¶
func ConcurrentSSA(clnt client.Client, owner client.FieldOwner) SSA
type SpecResolver ¶
type SpecResolverOption ¶
type SpecResolverOption struct {
SpecResolver
}
func WithSpecResolver ¶
func WithSpecResolver(resolver SpecResolver) SpecResolverOption
func (SpecResolverOption) Apply ¶
func (o SpecResolverOption) Apply(options *Options)
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 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,omitempty"` // Conditions contain a set of conditionals to determine the State of Status. // If all Conditions are met, the State is expected to be in StateReady. // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` // Synced determine a list of Resources that are currently actively synced. // All resources that are synced are considered for orphan removal on configuration changes, // and it is used to determine effective differences from one state to the next. // +listType=atomic Synced []Resource `json:"synced,omitempty"` LastOperation `json:"lastOperation,omitempty"` }
Status defines the observed state of CustomObject. +k8s:deepcopy-gen=true
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.
func (Status) WithOperation ¶
type WithClientCacheKeyOption ¶
type WithClientCacheKeyOption struct {
ClientCacheKeyFn
}
func WithClientCacheKeyFromLabelOrResource ¶
func WithClientCacheKeyFromLabelOrResource(label string) WithClientCacheKeyOption
func (WithClientCacheKeyOption) Apply ¶
func (o WithClientCacheKeyOption) Apply(options *Options)
type WithCustomReadyCheckOption ¶
type WithCustomReadyCheckOption struct {
ReadyCheck
}
func WithCustomReadyCheck ¶
func WithCustomReadyCheck(check ReadyCheck) WithCustomReadyCheckOption
func (WithCustomReadyCheckOption) Apply ¶
func (o WithCustomReadyCheckOption) Apply(options *Options)
type WithCustomResourceLabels ¶
func (WithCustomResourceLabels) Apply ¶
func (o WithCustomResourceLabels) Apply(options *Options)
type WithDeleteCRDs ¶
type WithDeleteCRDs bool
func (WithDeleteCRDs) Apply ¶
func (o WithDeleteCRDs) Apply(options *Options)
type WithFieldOwner ¶
type WithFieldOwner client.FieldOwner
func (WithFieldOwner) Apply ¶
func (o WithFieldOwner) Apply(options *Options)
type WithFinalizer ¶
type WithFinalizer string
func (WithFinalizer) Apply ¶
func (o WithFinalizer) Apply(options *Options)
type WithManagerOption ¶
func WithManager ¶
func WithManager(mgr manager.Manager) WithManagerOption
func (WithManagerOption) Apply ¶
func (o WithManagerOption) Apply(options *Options)
type WithManifestCache ¶
type WithManifestCache ManifestCache
func (WithManifestCache) Apply ¶
func (o WithManifestCache) Apply(options *Options)
type WithManifestParserOption ¶
type WithManifestParserOption struct {
ManifestParser
}
func WithManifestParser ¶
func WithManifestParser(parser ManifestParser) WithManifestParserOption
func (WithManifestParserOption) Apply ¶
func (o WithManifestParserOption) Apply(options *Options)
type WithNamespaceOption ¶
type WithNamespaceOption struct {
// contains filtered or unexported fields
}
func WithNamespace ¶
func WithNamespace(name string, createIfMissing bool) WithNamespaceOption
func (WithNamespaceOption) Apply ¶
func (o WithNamespaceOption) Apply(options *Options)
type WithPeriodicConsistencyCheck ¶
func (WithPeriodicConsistencyCheck) Apply ¶
func (o WithPeriodicConsistencyCheck) Apply(options *Options)
type WithPermanentConsistencyCheck ¶
type WithPermanentConsistencyCheck bool
func (WithPermanentConsistencyCheck) Apply ¶
func (o WithPermanentConsistencyCheck) Apply(options *Options)
type WithPostRun ¶
type WithPostRun []PostRun
WithPostRun applies PostRun.
func (WithPostRun) Apply ¶
func (o WithPostRun) Apply(options *Options)
type WithPreDelete ¶
type WithPreDelete []PreDelete
WithPreDelete applies PreDelete.
func (WithPreDelete) Apply ¶
func (o WithPreDelete) Apply(options *Options)
type WithRemoteTargetClusterOption ¶
type WithRemoteTargetClusterOption struct {
ClusterFn
}
func WithRemoteTargetCluster ¶
func WithRemoteTargetCluster(configFn ClusterFn) WithRemoteTargetClusterOption
func (WithRemoteTargetClusterOption) Apply ¶
func (o WithRemoteTargetClusterOption) Apply(options *Options)
type WithSingletonClientCacheOption ¶
type WithSingletonClientCacheOption struct {
ClientCache
}
func WithSingletonClientCache ¶
func WithSingletonClientCache(cache ClientCache) WithSingletonClientCacheOption
func (WithSingletonClientCacheOption) Apply ¶
func (o WithSingletonClientCacheOption) Apply(options *Options)
type WithSkipReconcileOnOption ¶
type WithSkipReconcileOnOption struct {
// contains filtered or unexported fields
}
func WithSkipReconcileOn ¶
func WithSkipReconcileOn(skipReconcile SkipReconcile) WithSkipReconcileOnOption
func (WithSkipReconcileOnOption) Apply ¶
func (o WithSkipReconcileOnOption) Apply(options *Options)