controller

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KopyReconcile

func KopyReconcile(k Kopier, req ctrl.Request) (ctrl.Result, error)

KopyReconcile runs the reconcile loop logic for Kopier interface

Types

type ConfigMapReconciler

type ConfigMapReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ConfigMapReconciler reconciles a ConfigMap object

func (*ConfigMapReconciler) Reconcile

func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ConfigMap object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.4/pkg/reconcile

func (*ConfigMapReconciler) SetupWithManager

func (r *ConfigMapReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Kopier

type Kopier interface {
	AddFinalizer() error
	Fetch(req ctrl.Request) error
	GetClient() client.Client
	GetContext() context.Context
	GetObject() client.Object
	LabelSelector() labels.Selector
	MarkedForDeletion() bool
	SyncOptions() bool
	SyncDeletedCopy() error
	SyncSource(namespace string) error
	SourceDeletion() error
}

type KopyConfigMap

type KopyConfigMap struct {
	context.Context
	client.Client
	*corev1.ConfigMap
}

func NewKopyConfigMap

func NewKopyConfigMap(ctx context.Context, c client.Client) *KopyConfigMap

NewKopyConfigMap creates a new instance of KopyConfigMap

func (*KopyConfigMap) AddFinalizer

func (ks *KopyConfigMap) AddFinalizer() error

AddFinalizer adds finalizer to ConfigMap object and updates object in kubernetes cluster

func (*KopyConfigMap) Copy

func (ks *KopyConfigMap) Copy(s *corev1.ConfigMap, namespace string) error

Copy takes the ConfigMap Object and creates a copy in the provided target namespace

func (*KopyConfigMap) Fetch

func (ks *KopyConfigMap) Fetch(req ctrl.Request) error

Fetch uses the event request to retrieve object from the cache

func (*KopyConfigMap) GetClient

func (ks *KopyConfigMap) GetClient() client.Client

GetClient returns Reconciler client.Client

func (*KopyConfigMap) GetContext

func (ks *KopyConfigMap) GetContext() context.Context

GetContext returns Reconciler context.Context

func (*KopyConfigMap) GetObject

func (ks *KopyConfigMap) GetObject() client.Object

func (*KopyConfigMap) LabelSelector

func (ks *KopyConfigMap) LabelSelector() labels.Selector

LabelSelector parses the sync annotations on ConfigMap to create a label selector

func (*KopyConfigMap) MarkedForDeletion

func (ks *KopyConfigMap) MarkedForDeletion() bool

MarkedForDeletion returns true if the ConfigMap object is marked for deletion and contains the kopy sync finalizer field

func (*KopyConfigMap) SourceDeletion

func (ks *KopyConfigMap) SourceDeletion() error

SourceDeletion will grab a list objects that are copies of the receiver ConfigMap object and remove the finalizer from the copies before removing the finalizer from the receiver ConfigMap object

func (*KopyConfigMap) SyncDeletedCopy

func (ks *KopyConfigMap) SyncDeletedCopy() error

SyncDeletedCopy uses the labels on the receiver ConfigMap object to grab a copy of the original ConfigMap It will Remove the finalizer from the receiver ConfigMap object to allow kubernetes to delete object It will verify the receiver ConfigMap Object namespace still contains the sync labels first before syncing the ConfigMap back into namespace

func (*KopyConfigMap) SyncOptions

func (ks *KopyConfigMap) SyncOptions() bool

SyncOptions returns true if the object annotations contains the sync key to be managed by the controller

func (*KopyConfigMap) SyncSource

func (ks *KopyConfigMap) SyncSource(namespace string) error

type KopySecret

type KopySecret struct {
	context.Context
	client.Client
	*corev1.Secret
}

func NewKopySecret

func NewKopySecret(ctx context.Context, c client.Client) *KopySecret

NewKopySecret creates a new instance of KopySecret

func (*KopySecret) AddFinalizer

func (ks *KopySecret) AddFinalizer() error

AddFinalizer adds finalizer to secret object and updates object in kubernetes cluster

func (*KopySecret) Copy

func (ks *KopySecret) Copy(s *corev1.Secret, namespace string) error

Copy takes the Secret Object and creates a copy in the provided target namespace

func (*KopySecret) Fetch

func (ks *KopySecret) Fetch(req ctrl.Request) error

Fetch uses the event request to retrieve object from the cache

func (*KopySecret) GetClient

func (ks *KopySecret) GetClient() client.Client

GetClient returns Reconciler client.Client

func (*KopySecret) GetContext

func (ks *KopySecret) GetContext() context.Context

GetContext returns Reconciler context.Context

func (*KopySecret) GetObject

func (ks *KopySecret) GetObject() client.Object

func (*KopySecret) LabelSelector

func (ks *KopySecret) LabelSelector() labels.Selector

LabelSelector parses the sync annotations on Secret to create a label selector

func (*KopySecret) MarkedForDeletion

func (ks *KopySecret) MarkedForDeletion() bool

MarkedForDeletion returns true if the Secret object is marked for deletion and contains the kopy sync finalizer field

func (*KopySecret) SourceDeletion

func (ks *KopySecret) SourceDeletion() error

SourceDeletion will grab a list objects that are copies of the receiver Secret object and remove the finalizer from the copies before removing the finalizer from the receiver Secret object

func (*KopySecret) SyncDeletedCopy

func (ks *KopySecret) SyncDeletedCopy() error

SyncDeletedCopy uses the labels on the receiver Secret object to grab a copy of the original Secret It will Remove the finalizer from the receiver Secret object to allow kubernetes to delete object It will verify the receiver Secret Object namespace still contains the sync labels first before syncing the Secret back into namespace

func (*KopySecret) SyncOptions

func (ks *KopySecret) SyncOptions() bool

SyncOptions returns true if the object annotations contains the sync key to be managed by the controller

func (*KopySecret) SyncSource

func (ks *KopySecret) SyncSource(namespace string) error

type SecretReconciler

type SecretReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

SecretReconciler reconciles a Secret object

func (*SecretReconciler) Reconcile

func (r *SecretReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Secret object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.4/pkg/reconcile

func (*SecretReconciler) SetupWithManager

func (r *SecretReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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