component

package
v0.3.38 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 38 Imported by: 30

Documentation

Overview

Package component contains central interfaces (most importantly, the Component interface) and the generic component reconciler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFromContext added in v0.3.2

func ClientFromContext(ctx context.Context) (cluster.Client, error)

func ComponentDigestFromContext added in v0.3.2

func ComponentDigestFromContext(ctx context.Context) (string, error)

func ReconcilerNameFromContext added in v0.3.2

func ReconcilerNameFromContext(ctx context.Context) (string, error)

Types

type ClientConfiguration added in v0.2.3

type ClientConfiguration interface {
	// Get kubeconfig content. Should return nil if default local client shall be used.
	GetKubeConfig() []byte
}

The ClientConfiguration interface is meant to be implemented by components (or their spec) which offer remote deployments.

type ClientSpec added in v0.2.3

type ClientSpec struct {
	KubeConfig *KubeConfigSpec `json:"kubeConfig,omitempty"`
}

ClientSpec defines a reference to another cluster by kubeconfig. Components providing ClientConfiguration may include this into their spec.

func (*ClientSpec) DeepCopy added in v0.2.3

func (in *ClientSpec) DeepCopy() *ClientSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSpec.

func (*ClientSpec) DeepCopyInto added in v0.2.3

func (in *ClientSpec) DeepCopyInto(out *ClientSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClientSpec) GetKubeConfig added in v0.2.3

func (s *ClientSpec) GetKubeConfig() []byte

Implement the ClientConfiguration interface.

type Component

type Component interface {
	client.Object
	// Return a read-only accessor to the component's spec.
	// The returned value has to implement the types.Unstructurable interface.
	GetSpec() types.Unstructurable
	// Return a read-write (usually a pointer) accessor to the component's status,
	// resp. to the corresponding substruct if the status extends component.Status.
	GetStatus() *Status
}

Component is the central interface that component operators have to implement. Besides being a conroller-runtime client.Object, the implementing type has to expose accessor methods for the components's spec and status, GetSpec() and GetStatus().

func ComponentFromContext added in v0.3.2

func ComponentFromContext(ctx context.Context) (Component, error)

type Condition

type Condition struct {
	Type ConditionType `json:"type"`
	// +kubebuilder:validation:Enum=True;False;Unknown
	Status ConditionStatus `json:"status"`
	// +optional
	LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"`
	// +optional
	Reason string `json:"reason,omitempty"`
	// +optional
	Message string `json:"message,omitempty"`
}

Component status Condition.

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConditionStatus

type ConditionStatus string

Condition Status. Can be one of 'True', 'False', 'Unknown'.

const (
	// Condition status 'True'.
	ConditionTrue ConditionStatus = "True"
	// Condition status 'False'.
	ConditionFalse ConditionStatus = "False"
	// Condition status 'Unknown'.
	ConditionUnknown ConditionStatus = "Unknown"
)

type ConditionType

type ConditionType string

Condition type. Currently, only the 'Ready' type is used.

const (
	// Condition type representing the 'Ready' condition.
	ConditionTypeReady ConditionType = "Ready"
)

type ConfigMapKeyReference added in v0.2.3

type ConfigMapKeyReference struct {
	// +required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`
	// +optional
	// +kubebuilder:validation:MinLength=1
	Key string `json:"key,omitempty"`
	// contains filtered or unexported fields
}

ConfigMapKeyReference defines a loadable reference to a configmap key.

func (*ConfigMapKeyReference) DeepCopy added in v0.2.3

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapKeyReference.

func (*ConfigMapKeyReference) DeepCopyInto added in v0.2.3

func (in *ConfigMapKeyReference) DeepCopyInto(out *ConfigMapKeyReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ConfigMapKeyReference) Value added in v0.2.3

func (r *ConfigMapKeyReference) Value() string

Return the previously loaded value of the configmap key.

type ConfigMapReference added in v0.2.3

type ConfigMapReference struct {
	// +required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`
	// contains filtered or unexported fields
}

ConfigMapReference defines a loadable reference to a configmap.

func (*ConfigMapReference) Data added in v0.2.3

func (r *ConfigMapReference) Data() map[string]string

Return the previously loaded configmap data.

func (*ConfigMapReference) DeepCopy added in v0.2.3

func (in *ConfigMapReference) DeepCopy() *ConfigMapReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference.

func (*ConfigMapReference) DeepCopyInto added in v0.2.3

func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HookFunc

type HookFunc[T Component] func(ctx context.Context, clnt client.Client, component T) error

HookFunc is the function signature that can be used to establish callbacks at certain points in the reconciliation logic. Hooks will be passed a local client (to be precise, the one belonging to the owning manager), and the current (potentially unsaved) state of the component. Post-hooks will only be called if the according operation (read, reconcile, delete) has been successful.

type ImageSpec

type ImageSpec struct {
	// +kubebuilder:validation:MinLength=1
	Repository string `json:"repository,omitempty"`
	// +kubebuilder:validation:MinLength=1
	Tag string `json:"tag,omitempty"`
	// +kubebuilder:validation:Enum=Always;Never;IfNotPresent
	// +kubebuilder:default=IfNotPresent
	PullPolicy string `json:"pullPolicy,omitempty"`
	PullSecret string `json:"pullSecret,omitempty"`
}

ImageSpec defines the used OCI image

func (*ImageSpec) DeepCopy

func (in *ImageSpec) DeepCopy() *ImageSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageSpec.

func (*ImageSpec) DeepCopyInto

func (in *ImageSpec) DeepCopyInto(out *ImageSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ImpersonationConfiguration added in v0.2.3

type ImpersonationConfiguration interface {
	// Return impersonation user. Should return system:serviceaccount:<namespace>:<serviceaccount>
	// if a service account is used for impersonation. Should return an empty string
	// if user shall not be impersonated.
	GetImpersonationUser() string
	// Return impersonation groups. Should return nil if groups shall not be impersonated.
	GetImpersonationGroups() []string
}

The ImpersonationConfiguration interface is meant to be implemented by components (or their spec) which offer impersonated deployments.

type ImpersonationSpec added in v0.2.3

type ImpersonationSpec struct {
	ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

ImpersonationSpec defines a service account name. Components providing ImpersonationConfiguration may include this into their spec.

func (*ImpersonationSpec) DeepCopy added in v0.2.3

func (in *ImpersonationSpec) DeepCopy() *ImpersonationSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImpersonationSpec.

func (*ImpersonationSpec) DeepCopyInto added in v0.2.3

func (in *ImpersonationSpec) DeepCopyInto(out *ImpersonationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ImpersonationSpec) GetImpersonationGroups added in v0.2.3

func (s *ImpersonationSpec) GetImpersonationGroups() []string

Implement the ImpersonationConfiguration interface.

func (*ImpersonationSpec) GetImpersonationUser added in v0.2.3

func (s *ImpersonationSpec) GetImpersonationUser() string

Implement the ImpersonationConfiguration interface.

type IngressProperties

type IngressProperties struct {
	Class       string            `json:"class,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

IngressProperties defines K8s properties to be applied to a managed ingress resource.

func (*IngressProperties) DeepCopy

func (in *IngressProperties) DeepCopy() *IngressProperties

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressProperties.

func (*IngressProperties) DeepCopyInto

func (in *IngressProperties) DeepCopyInto(out *IngressProperties)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KubeConfigSpec added in v0.2.3

type KubeConfigSpec struct {
	SecretRef SecretKeyReference `json:"secretRef" fallbackKeys:"value,value.yaml,value.yml"`
}

KubeConfigSpec defines a reference to a kubeconfig.

func (*KubeConfigSpec) DeepCopy added in v0.2.3

func (in *KubeConfigSpec) DeepCopy() *KubeConfigSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeConfigSpec.

func (*KubeConfigSpec) DeepCopyInto added in v0.2.3

func (in *KubeConfigSpec) DeepCopyInto(out *KubeConfigSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KubernetesContainerProperties

type KubernetesContainerProperties struct {
	SecurityContext *corev1.SecurityContext      `json:"securityContext,omitempty"`
	Resources       *corev1.ResourceRequirements `json:"resources,omitempty"`
}

KubernetesContainerProperties defines K8s properties to be applied to the created workloads (container level)

func (*KubernetesContainerProperties) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesContainerProperties.

func (*KubernetesContainerProperties) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KubernetesPodProperties

type KubernetesPodProperties struct {
	NodeSelector              map[string]string                 `json:"nodeSelector,omitempty"`
	Affinity                  *corev1.Affinity                  `json:"affinity,omitempty"`
	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
	Tolerations               []corev1.Toleration               `json:"tolerations,omitempty"`
	PriorityClassName         *string                           `json:"priorityClassName,omitempty"`
	PodSecurityContext        *corev1.PodSecurityContext        `json:"podSecurityContext,omitempty"`
	Labels                    map[string]string                 `json:"podLabels,omitempty"`
	Annotations               map[string]string                 `json:"podAnnotations,omitempty"`
}

KubernetesPodProperties defines K8s properties to be applied to the created workloads (pod level)

func (*KubernetesPodProperties) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesPodProperties.

func (*KubernetesPodProperties) DeepCopyInto

func (in *KubernetesPodProperties) DeepCopyInto(out *KubernetesPodProperties)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KubernetesProperties

type KubernetesProperties struct {
	KubernetesPodProperties       `json:",inline"`
	KubernetesContainerProperties `json:",inline"`
}

KubernetesProperties defines a union of KubernetesPodProperties and KubernetesContainerProperties. Useful in cases where a controller pod has exactly one container.

func (*KubernetesProperties) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesProperties.

func (*KubernetesProperties) DeepCopyInto

func (in *KubernetesProperties) DeepCopyInto(out *KubernetesProperties)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PlacementConfiguration added in v0.2.3

type PlacementConfiguration interface {
	// Return target namespace for the component deployment.
	// If the returned value is not the empty string, then this is the value that will be passed
	// to Generator.Generate() as namespace and, in addition, rendered namespaced resources with
	// unspecified namespace will be placed in this namespace.
	GetDeploymentNamespace() string
	// Return target name for the component deployment.
	// If the returned value is not the empty string, then this is the value that will be passed
	// to Generator.Generator() as name.
	GetDeploymentName() string
}

The PlacementConfiguration interface is meant to be implemented by components (or their spec) which allow to explicitly specify target namespace and name of the deployment (otherwise this will be defaulted as the namespace and name of the component object itself).

type PlacementSpec added in v0.2.3

type PlacementSpec struct {
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
}

PlacementSpec defines a namespace and name. Components providing PlacementConfiguration may include this into their spec.

func (*PlacementSpec) DeepCopy added in v0.2.3

func (in *PlacementSpec) DeepCopy() *PlacementSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSpec.

func (*PlacementSpec) DeepCopyInto added in v0.2.3

func (in *PlacementSpec) DeepCopyInto(out *PlacementSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PlacementSpec) GetDeploymentName added in v0.2.3

func (s *PlacementSpec) GetDeploymentName() string

Implement the PlacementConfiguration interface.

func (*PlacementSpec) GetDeploymentNamespace added in v0.2.3

func (s *PlacementSpec) GetDeploymentNamespace() string

Implement the PlacementConfiguration interface.

type Reconciler

type Reconciler[T Component] struct {
	// contains filtered or unexported fields
}

Reconciler provides the implementation of controller-runtime's Reconciler interface, for a given Component type T.

func NewReconciler

func NewReconciler[T Component](name string, resourceGenerator manifests.Generator, options ReconcilerOptions) *Reconciler[T]

Create a new Reconciler. Here, name should be a meaningful and unique name identifying this reconciler within the Kubernetes cluster; it will be used in annotations, finalizers, and so on; resourceGenerator must be an implementation of the manifests.Generator interface.

func (*Reconciler[T]) Reconcile

func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error)

Reconcile contains the actual reconciliation logic.

func (*Reconciler[T]) SetupWithManager

func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager) error

Register the reconciler with a given controller-runtime Manager.

func (*Reconciler[T]) SetupWithManagerAndBuilder added in v0.3.2

func (r *Reconciler[T]) SetupWithManagerAndBuilder(mgr ctrl.Manager, blder *ctrl.Builder) error

Register the reconciler with a given controller-runtime Manager and Builder. This will call For() and Complete() on the provided builder.

func (*Reconciler[T]) WithPostDeleteHook

func (r *Reconciler[T]) WithPostDeleteHook(hook HookFunc[T]) *Reconciler[T]

Register post-delete hook with reconciler. This hook will be called if the reconciled component is in deletion (has a deletionTimestamp set), right after the deletion of the dependent objects happened, and was successful.

func (*Reconciler[T]) WithPostReadHook

func (r *Reconciler[T]) WithPostReadHook(hook HookFunc[T]) *Reconciler[T]

Register post-read hook with reconciler. This hook will be called after the reconciled component object has been retrieved from the Kubernetes API.

func (*Reconciler[T]) WithPostReconcileHook

func (r *Reconciler[T]) WithPostReconcileHook(hook HookFunc[T]) *Reconciler[T]

Register post-reconcile hook with reconciler. This hook will be called if the reconciled component is not in deletion (has no deletionTimestamp set), right after the reconcilation of the dependent objects happened, and was successful.

func (*Reconciler[T]) WithPreDeleteHook

func (r *Reconciler[T]) WithPreDeleteHook(hook HookFunc[T]) *Reconciler[T]

Register pre-delete hook with reconciler. This hook will be called if the reconciled component is in deletion (has a deletionTimestamp set), right before the deletion of the dependent objects starts.

func (*Reconciler[T]) WithPreReconcileHook

func (r *Reconciler[T]) WithPreReconcileHook(hook HookFunc[T]) *Reconciler[T]

Register pre-reconcile hook with reconciler. This hook will be called if the reconciled component is not in deletion (has no deletionTimestamp set), right before the reconcilation of the dependent objects starts.

type ReconcilerOptions added in v0.3.0

type ReconcilerOptions struct {
	// Whether namespaces are auto-created if missing.
	// If unspecified, true is assumed.
	CreateMissingNamespaces *bool
	// How to react if a dependent object exists but has no or a different owner.
	// If unspecified, AdoptionPolicyIfUnowned is assumed.
	// Can be overridden by annotation on object level.
	AdoptionPolicy *reconciler.AdoptionPolicy
	// How to perform updates to dependent objects.
	// If unspecified, UpdatePolicyReplace is assumed.
	// Can be overridden by annotation on object level.
	UpdatePolicy *reconciler.UpdatePolicy
	// SchemeBuilder allows to define additional schemes to be made available in the
	// target client.
	SchemeBuilder types.SchemeBuilder
}

ReconcilerOptions are creation options for a Reconciler.

type RequeueConfiguration added in v0.2.3

type RequeueConfiguration interface {
	// Get requeue interval. Should be greater than 1 minute.
	GetRequeueInterval() time.Duration
}

The RequeueConfiguration interface is meant to be implemented by components (or their spec) which offer tweaking the requeue interval (by default, it would be 10 minutes).

type RequeueSpec added in v0.2.3

type RequeueSpec struct {
	// +kubebuilder:validation:Type:=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	RequeueInterval *metav1.Duration `json:"requeueInterval,omitempty"`
}

RequeueSpec defines the requeue interval, that is, the interval after which components will be re-reconciled after a successful reconciliation. Components providing RequeueConfiguration may include this into their spec.

func (*RequeueSpec) DeepCopy added in v0.2.3

func (in *RequeueSpec) DeepCopy() *RequeueSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequeueSpec.

func (*RequeueSpec) DeepCopyInto added in v0.2.3

func (in *RequeueSpec) DeepCopyInto(out *RequeueSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RequeueSpec) GetRequeueInterval added in v0.2.3

func (s *RequeueSpec) GetRequeueInterval() time.Duration

Implement the RequeueConfiguration interface.

type RetryConfiguration added in v0.2.3

type RetryConfiguration interface {
	// Get retry interval. Should be greater than 1 minute.
	GetRetryInterval() time.Duration
}

The RetryConfiguration interface is meant to be implemented by components (or their spec) which offer tweaking the retry interval (by default, it would be the value of the requeue interval).

type RetrySpec added in v0.2.3

type RetrySpec struct {
	// +kubebuilder:validation:Type:=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	RetryInterval *metav1.Duration `json:"retryInterval,omitempty"`
}

RetrySpec defines the retry interval, that is, the interval after which components will be re-reconciled after a successful reconciliation. Components providing RetryConfiguration may include this into their spec.

func (*RetrySpec) DeepCopy added in v0.2.3

func (in *RetrySpec) DeepCopy() *RetrySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetrySpec.

func (*RetrySpec) DeepCopyInto added in v0.2.3

func (in *RetrySpec) DeepCopyInto(out *RetrySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RetrySpec) GetRetryInterval added in v0.2.3

func (s *RetrySpec) GetRetryInterval() time.Duration

Implement the RetryConfiguration interface.

type SecretKeyReference added in v0.2.3

type SecretKeyReference struct {
	// +required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`
	// +optional
	// +kubebuilder:validation:MinLength=1
	Key string `json:"key,omitempty"`
	// contains filtered or unexported fields
}

SecretKeyReference defines a loadable reference to a secret key.

func (*SecretKeyReference) DeepCopy added in v0.2.3

func (in *SecretKeyReference) DeepCopy() *SecretKeyReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeyReference.

func (*SecretKeyReference) DeepCopyInto added in v0.2.3

func (in *SecretKeyReference) DeepCopyInto(out *SecretKeyReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SecretKeyReference) Value added in v0.2.3

func (r *SecretKeyReference) Value() []byte

Return the previously loaded value of the secret key.

type SecretReference added in v0.2.3

type SecretReference struct {
	// +required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`
	// contains filtered or unexported fields
}

SecretReference defines a loadable reference to a secret.

func (*SecretReference) Data added in v0.2.3

func (r *SecretReference) Data() map[string][]byte

Return the previously loaded secret data.

func (*SecretReference) DeepCopy added in v0.2.3

func (in *SecretReference) DeepCopy() *SecretReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference.

func (*SecretReference) DeepCopyInto added in v0.2.3

func (in *SecretReference) DeepCopyInto(out *SecretReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceProperties

type ServiceProperties struct {
	// +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer;ExternalName
	// +kubebuilder:default=ClusterIP
	Type                     corev1.ServiceType `json:"type,omitempty"`
	LoadBalancerSourceRanges []string           `json:"loadBalancerSourceRanges,omitempty"`
	// +kubebuilder:validation:Enum=Cluster;Local
	// +kubebuilder:default=Cluster
	ExternalTrafficPolicy corev1.ServiceExternalTrafficPolicyType `json:"externalTrafficPolicy,omitempty"`
	Labels                map[string]string                       `json:"labels,omitempty"`
	Annotations           map[string]string                       `json:"annotations,omitempty"`
}

ServiceProperties defines K8s properties to be applied to a managed service resource.

func (*ServiceProperties) DeepCopy

func (in *ServiceProperties) DeepCopy() *ServiceProperties

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceProperties.

func (*ServiceProperties) DeepCopyInto

func (in *ServiceProperties) DeepCopyInto(out *ServiceProperties)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Spec

type Spec struct {
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
}

Legacy placement spec. Components may include this into their spec. Deprecation warning: use PlacementSpec instead.

func (*Spec) DeepCopy

func (in *Spec) DeepCopy() *Spec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec.

func (*Spec) DeepCopyInto

func (in *Spec) DeepCopyInto(out *Spec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type State

type State string

Component state. Can be one of 'Ready', 'Pending', 'Processing', 'DeletionPending', 'Deleting', 'Error'.

const (
	// Component state 'Ready'.
	StateReady State = "Ready"
	// Component state 'Pending'.
	StatePending State = "Pending"
	// Component state 'Processing'.
	StateProcessing State = "Processing"
	// Component state 'DeletionPending'.
	StateDeletionPending State = "DeletionPending"
	// Component state 'Deleting'.
	StateDeleting State = "Deleting"
	// Component state 'Error'.
	StateError State = "Error"
)

type Status

type Status struct {
	ObservedGeneration int64        `json:"observedGeneration"`
	AppliedGeneration  int64        `json:"appliedGeneration,omitempty"`
	LastObservedAt     *metav1.Time `json:"lastObservedAt,omitempty"`
	LastAppliedAt      *metav1.Time `json:"lastAppliedAt,omitempty"`
	ProcessingDigest   string       `json:"processingDigest,omitempty"`
	ProcessingSince    *metav1.Time `json:"processingSince,omitempty"`
	Conditions         []Condition  `json:"conditions,omitempty"`
	// +kubebuilder:validation:Enum=Ready;Pending;Processing;DeletionPending;Deleting;Error
	State     State                       `json:"state,omitempty"`
	Inventory []*reconciler.InventoryItem `json:"inventory,omitempty"`
}

Component Status. Components must include this into their status.

func (*Status) DeepCopy

func (in *Status) DeepCopy() *Status

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.

func (*Status) DeepCopyInto

func (in *Status) DeepCopyInto(out *Status)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Status) GetState

func (s *Status) GetState() (State, string, string)

Get state (and related details).

func (*Status) IsReady added in v0.3.2

func (s *Status) IsReady() bool

Check if state is Ready.

func (*Status) SetState

func (s *Status) SetState(state State, reason string, message string)

Set state and ready condition in status (according to the state value provided). Note: this method does not touch the condition's LastTransitionTime.

type TimeoutConfiguration added in v0.3.34

type TimeoutConfiguration interface {
	// Get timeout. Should be greater than 1 minute.
	GetTimeout() time.Duration
}

The TimeoutConfiguration interface is meant to be implemented by components (or their spec) which offer tweaking the processing timeout (by default, it would be the value of the requeue interval).

type TimeoutSpec added in v0.3.34

type TimeoutSpec struct {
	// +kubebuilder:validation:Type:=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	Timeout *metav1.Duration `json:"timeout,omitempty"`
}

TimeoutSpec defines the processing timeout, that is, the duration after which all dependent objects of the component must have reached a ready state, or the component status will change to error. Components providing TimeoutConfiguration may include this into their spec.

func (*TimeoutSpec) DeepCopy added in v0.3.34

func (in *TimeoutSpec) DeepCopy() *TimeoutSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeoutSpec.

func (*TimeoutSpec) DeepCopyInto added in v0.3.34

func (in *TimeoutSpec) DeepCopyInto(out *TimeoutSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TimeoutSpec) GetTimeout added in v0.3.34

func (s *TimeoutSpec) GetTimeout() time.Duration

Implement the TimeoutConfiguration interface.

Jump to

Keyboard shortcuts

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