reconcilers

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMapReconcileField

func ConfigMapReconcileField(desired, existing *v1.ConfigMap, fieldName string) bool

func CreateOnlyMutator

func CreateOnlyMutator(existing, desired common.KubernetesObject) (bool, error)

func DefaultsOnlySecretMutator

func DefaultsOnlySecretMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

DefaultsOnlySecretMutator is useful for secrets pre-created by the user and when not all the fields are created. Fields referenced from deployment configs must exist, so defaults only reconciliation makes sure they exist with default values when user does doe pre-create them

func DeploymentConfigAffinityMutator added in v0.7.0

func DeploymentConfigAffinityMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

func DeploymentConfigContainerResourcesMutator added in v0.7.0

func DeploymentConfigContainerResourcesMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

func DeploymentConfigEnvVarReconciler added in v0.7.0

func DeploymentConfigEnvVarReconciler(desired, existing *appsv1.DeploymentConfig, envVar string) bool

DeploymentConfigEnvVarReconciler implements basic env var reconcilliation deployment configs. Existing and desired DC must have same number of containers Added when in desired and not in existing Updated when in desired and in existing but not equal Removed when not in desired and exists in existing DC

func DeploymentConfigImageChangeTriggerMutator added in v0.10.0

func DeploymentConfigImageChangeTriggerMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigImageChangeTriggerMutator ensures image change triggers are reconciled

func DeploymentConfigPodTemplateAnnotationsMutator added in v0.11.0

func DeploymentConfigPodTemplateAnnotationsMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigPodTemplateAnnotationsMutator ensures Pod Template Annotations is reconciled

func DeploymentConfigPodTemplateLabelsMutator added in v0.10.0

func DeploymentConfigPodTemplateLabelsMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigPodTemplateLabelsMutator ensures pod template labels are reconciled

func DeploymentConfigPriorityClassMutator added in v0.11.0

func DeploymentConfigPriorityClassMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigPriorityClassMutator ensures priorityclass is reconciled

func DeploymentConfigRemoveDuplicateEnvVarMutator added in v0.11.0

func DeploymentConfigRemoveDuplicateEnvVarMutator(_, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigRemoveDuplicateEnvVarMutator ensures pod env vars are not duplicated

func DeploymentConfigReplicasMutator added in v0.7.0

func DeploymentConfigReplicasMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

func DeploymentConfigStrategyMutator added in v0.11.0

func DeploymentConfigStrategyMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigStrategyMutator ensures desired strategy

func DeploymentConfigTolerationsMutator added in v0.7.0

func DeploymentConfigTolerationsMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

func DeploymentConfigTopologySpreadConstraintsMutator added in v0.11.0

func DeploymentConfigTopologySpreadConstraintsMutator(desired, existing *appsv1.DeploymentConfig) (bool, error)

DeploymentConfigTopologySpreadConstraintsMutator ensures TopologySpreadConstraints is reconciled

func GenericGrafanaDashboardsMutator added in v0.7.0

func GenericGrafanaDashboardsMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

func GenericImageStreamMutator

func GenericImageStreamMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

func GenericPDBMutator

func GenericPDBMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

func SecretReconcileField

func SecretReconcileField(fieldName string) func(desired, existing *v1.Secret) bool

func ServiceAccountImagePullPolicyMutator added in v0.7.0

func ServiceAccountImagePullPolicyMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

func ServicePortMutator added in v0.8.0

func ServicePortMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)

Types

type BaseReconciler

type BaseReconciler struct {
	// contains filtered or unexported fields
}

func NewBaseReconciler

func NewBaseReconciler(ctx context.Context, client client.Client, scheme *runtime.Scheme, apiClientReader client.Reader,
	logger logr.Logger, discoveryClient discovery.DiscoveryInterface, recorder record.EventRecorder) *BaseReconciler

func (*BaseReconciler) APIClientReader

func (b *BaseReconciler) APIClientReader() client.Reader

APIClientReader return a client that directly reads objects from the Kubernetes APIServer

func (*BaseReconciler) Client

func (b *BaseReconciler) Client() client.Client

Client returns a split client that reads objects from the cache and writes to the Kubernetes APIServer

func (*BaseReconciler) Context

func (b *BaseReconciler) Context() context.Context

func (*BaseReconciler) CreateResource

func (b *BaseReconciler) CreateResource(obj common.KubernetesObject) error

func (*BaseReconciler) DeleteResource

func (b *BaseReconciler) DeleteResource(obj common.KubernetesObject, options ...client.DeleteOption) error

func (*BaseReconciler) DiscoveryClient

func (b *BaseReconciler) DiscoveryClient() discovery.DiscoveryInterface

func (*BaseReconciler) EnsureOwnerReference added in v0.7.0

func (b *BaseReconciler) EnsureOwnerReference(owner, obj common.KubernetesObject) (bool, error)

EnsureOwnerReference sets owner as a Controller OwnerReference on owned returns boolean to notify when the object has been updated Resource ownerReference isn't set if the resource is already owned by another controller

func (*BaseReconciler) EventRecorder

func (b *BaseReconciler) EventRecorder() record.EventRecorder

func (*BaseReconciler) GetResource

func (b *BaseReconciler) GetResource(objKey types.NamespacedName, obj common.KubernetesObject) error
func (b *BaseReconciler) HasConsoleLink() (bool, error)

HasConsoleLink checks if the ConsoleLink is supported in current cluster

func (*BaseReconciler) HasGrafanaDashboards added in v0.7.0

func (b *BaseReconciler) HasGrafanaDashboards() (bool, error)

HasGrafanaDashboards checks if the GrafanaDashboard CRD is supported in current cluster

func (*BaseReconciler) HasPodMonitors added in v0.7.0

func (b *BaseReconciler) HasPodMonitors() (bool, error)

HasPodMonitors checks if the PodMonitors CRD is supported in current cluster

func (*BaseReconciler) HasPrometheusRules added in v0.7.0

func (b *BaseReconciler) HasPrometheusRules() (bool, error)

HasPrometheusRules checks if the PrometheusRules CRD is supported in current cluster

func (*BaseReconciler) HasServiceMonitors added in v0.7.0

func (b *BaseReconciler) HasServiceMonitors() (bool, error)

HasServiceMonitors checks if the ServiceMonitors CRD is supported in current cluster

func (*BaseReconciler) Logger

func (b *BaseReconciler) Logger() logr.Logger

func (*BaseReconciler) Reconcile

func (*BaseReconciler) ReconcileResource

func (b *BaseReconciler) ReconcileResource(obj, desired common.KubernetesObject, mutateFn MutateFn) error

ReconcileResource attempts to mutate the existing state in order to match the desired state. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.

obj: Object of the same type as the 'desired' object.

Used to read the resource from the kubernetes cluster.
Could be zero-valued initialized object.

desired: Object representing the desired state

It returns an error.

func (*BaseReconciler) Scheme

func (b *BaseReconciler) Scheme() *runtime.Scheme

func (*BaseReconciler) SetControllerOwnerReference added in v0.11.0

func (b *BaseReconciler) SetControllerOwnerReference(owner, obj common.KubernetesObject) error

SetOwnerReference sets owner as a Controller OwnerReference on owned

func (*BaseReconciler) UpdateResource

func (b *BaseReconciler) UpdateResource(obj common.KubernetesObject) error

func (*BaseReconciler) UpdateResourceStatus

func (b *BaseReconciler) UpdateResourceStatus(obj common.KubernetesObject) error

type DCMutateFn added in v0.7.0

type DCMutateFn func(desired, existing *appsv1.DeploymentConfig) (bool, error)

DCMutateFn is a function which mutates the existing DeploymentConfig into it's desired state.

func GenericBackendMutators added in v0.10.0

func GenericBackendMutators() []DCMutateFn

GenericBackendMutators returns the generic mutators for backend

type MutateFn

type MutateFn func(existing, desired common.KubernetesObject) (bool, error)

MutateFn is a function which mutates the existing object into it's desired state.

func DeploymentConfigMutator added in v0.7.0

func DeploymentConfigMutator(opts ...DCMutateFn) MutateFn

func DeploymentSecretMutator added in v0.9.0

func DeploymentSecretMutator(opts ...SecretMutateFn) MutateFn

type SecretMutateFn added in v0.9.0

type SecretMutateFn func(desired, existing *v1.Secret) bool

SecretMutateFn is a function which mutates the existing Secret into it's desired state.

Jump to

Keyboard shortcuts

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