controllers

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0, MIT Imports: 63 Imported by: 0

Documentation

Overview

Package controllers is used to provide the core functionalities of hvpa-controller

Index

Constants

View Source
const (
	// FinalizerName is the name of the Plant finalizer.
	FinalizerName = "druid.gardener.cloud/etcd-druid"
	// DefaultImageVector is a constant for the path to the default image vector file.
	DefaultImageVector = "images.yaml"
	// DefaultInterval is the default interval for retry operations.
	DefaultInterval = 5 * time.Second
	// EtcdReady implies that etcd is ready
	EtcdReady = true
	// DefaultAutoCompactionRetention defines the default auto-compaction-retention length for etcd.
	DefaultAutoCompactionRetention = "30m"
	// Annotation set by human operator in order to stop reconciliation
	IgnoreReconciliationAnnotation = "druid.gardener.cloud/ignore-reconciliation"
)
View Source
const (
	// DefaultETCDQuota is the default etcd quota.
	DefaultETCDQuota = 8 * 1024 * 1024 * 1024 // 8Gi
)

Variables

View Source
var (
	// DefaultTimeout is the default timeout for retry operations.
	DefaultTimeout = 1 * time.Minute
)
View Source
var (

	// UncachedObjectList is a list of objects which should not be cached.
	UncachedObjectList = []client.Object{
		&corev1.Event{},
		&eventsv1beta1.Event{},
		&eventsv1.Event{},
	}
)

Functions

func RecheckDeletionTimestamp

func RecheckDeletionTimestamp(getObject func() (metav1.Object, error)) func() error

RecheckDeletionTimestamp returns a CanAdopt() function to recheck deletion.

The CanAdopt() function calls getObject() to fetch the latest value, and denies adoption attempts if that object has a non-nil DeletionTimestamp.

Types

type BaseControllerRefManager

type BaseControllerRefManager struct {
	Controller metav1.Object
	Selector   labels.Selector

	CanAdoptFunc func() error
	// contains filtered or unexported fields
}

BaseControllerRefManager is the struct is used to identify the base controller of the object

func (*BaseControllerRefManager) CanAdopt

func (m *BaseControllerRefManager) CanAdopt() error

CanAdopt is used to identify if the object can be adopted by the controller

type CompactionLeaseController added in v0.7.0

type CompactionLeaseController struct {
	client.Client

	ImageVector imagevector.ImageVector
	// contains filtered or unexported fields
}

CompactionLeaseController reconciles compaction job

func NewCompactionLeaseController added in v0.7.0

func NewCompactionLeaseController(mgr manager.Manager, config controllersconfig.CompactionLeaseConfig) *CompactionLeaseController

NewCompactionLeaseController creates a new CompactionLeaseController object

func NewCompactionLeaseControllerWithImageVector added in v0.7.0

func NewCompactionLeaseControllerWithImageVector(mgr manager.Manager, config controllersconfig.CompactionLeaseConfig) (*CompactionLeaseController, error)

NewCompactionLeaseControllerWithImageVector creates a new CompactionLeaseController object

func (*CompactionLeaseController) InitializeControllerWithImageVector added in v0.7.0

func (lc *CompactionLeaseController) InitializeControllerWithImageVector() (*CompactionLeaseController, error)

InitializeControllerWithImageVector will use CompactionLeaseController client to initialize image vector for etcd and backup restore images.

func (*CompactionLeaseController) Reconcile added in v0.7.0

Reconcile reconciles the compaction job.

func (*CompactionLeaseController) SetupWithManager added in v0.7.0

func (lc *CompactionLeaseController) SetupWithManager(mgr ctrl.Manager, workers int) error

SetupWithManager sets up manager with a new controller and ec as the reconcile.Reconciler

type EtcdCopyBackupsTaskReconciler added in v0.7.0

type EtcdCopyBackupsTaskReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

EtcdCopyBackupsTaskReconciler reconciles EtcdCopyBackupsTask object.

func NewEtcdCopyBackupsTaskReconciler added in v0.7.0

func NewEtcdCopyBackupsTaskReconciler(mgr manager.Manager) (*EtcdCopyBackupsTaskReconciler, error)

NewEtcdCopyBackupsTaskReconciler creates a new EtcdCopyBackupsTaskReconciler.

func NewEtcdCopyBackupsTaskReconcilerWithImageVector added in v0.7.0

func NewEtcdCopyBackupsTaskReconcilerWithImageVector(mgr manager.Manager) (*EtcdCopyBackupsTaskReconciler, error)

NewEtcdCopyBackupsTaskReconcilerWithImageVector creates a new EtcdCopyBackupsTaskReconciler and initializes its image vector.

func (*EtcdCopyBackupsTaskReconciler) InitializeControllerWithChartApplier added in v0.7.0

func (r *EtcdCopyBackupsTaskReconciler) InitializeControllerWithChartApplier() (*EtcdCopyBackupsTaskReconciler, error)

InitializeControllerWithChartApplier will use EtcdCopyBackupsTaskReconciler rest config to initialize a chart applier.

func (*EtcdCopyBackupsTaskReconciler) InitializeControllerWithImageVector added in v0.7.0

func (r *EtcdCopyBackupsTaskReconciler) InitializeControllerWithImageVector() (*EtcdCopyBackupsTaskReconciler, error)

InitializeControllerWithImageVector will use EtcdCopyBackupsTaskReconciler client to initialize an image vector.

func (*EtcdCopyBackupsTaskReconciler) Reconcile added in v0.7.0

Reconcile reconciles the EtcdCopyBackupsTask.

func (*EtcdCopyBackupsTaskReconciler) SetupWithManager added in v0.7.0

func (r *EtcdCopyBackupsTaskReconciler) SetupWithManager(mgr ctrl.Manager, workers int) error

SetupWithManager sets up with the given manager a new controller with r as the ctrl.Reconciler.

type EtcdCustodian added in v0.5.0

type EtcdCustodian struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

EtcdCustodian reconciles status of Etcd object

func NewEtcdCustodian added in v0.5.0

NewEtcdCustodian creates a new EtcdCustodian object

func (*EtcdCustodian) Reconcile added in v0.5.0

func (ec *EtcdCustodian) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles the etcd.

func (*EtcdCustodian) SetupWithManager added in v0.5.0

func (ec *EtcdCustodian) SetupWithManager(ctx context.Context, mgr ctrl.Manager, workers int, ignoreOperationAnnotation bool) error

SetupWithManager sets up manager with a new controller and ec as the reconcile.Reconciler

type EtcdDruidRefManager

type EtcdDruidRefManager struct {
	BaseControllerRefManager
	// contains filtered or unexported fields
}

EtcdDruidRefManager is the struct used to manage its child objects

func NewEtcdDruidRefManager

func NewEtcdDruidRefManager(
	cl client.Client,
	scheme *runtime.Scheme,
	controller metav1.Object,
	selector labels.Selector,
	controllerKind schema.GroupVersionKind,
	canAdopt func() error,
) *EtcdDruidRefManager

NewEtcdDruidRefManager returns a EtcdDruidRefManager that exposes methods to manage the controllerRef of its child objects.

The CanAdopt() function can be used to perform a potentially expensive check (such as a live GET from the API server) prior to the first adoption. It will only be called (at most once) if an adoption is actually attempted. If CanAdopt() returns a non-nil error, all adoptions will fail.

func (*EtcdDruidRefManager) AdoptResource added in v0.2.0

func (m *EtcdDruidRefManager) AdoptResource(ctx context.Context, obj client.Object) error

AdoptResource sends a patch to take control of the Etcd. It returns the error if the patching fails.

func (*EtcdDruidRefManager) FetchStatefulSet added in v0.5.0

func (m *EtcdDruidRefManager) FetchStatefulSet(ctx context.Context, etcd *druidv1alpha1.Etcd) (*appsv1.StatefulSetList, error)

FetchStatefulSet fetches statefulset based on ETCD resource

func (*EtcdDruidRefManager) ReleaseResource added in v0.2.0

func (m *EtcdDruidRefManager) ReleaseResource(ctx context.Context, obj client.Object) error

ReleaseResource sends a patch to free the resource from the control of the controller. It returns the error if the patching fails. 404 and 422 errors are ignored.

type EtcdReconciler

type EtcdReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Config      *rest.Config
	ImageVector imagevector.ImageVector
	// contains filtered or unexported fields
}

EtcdReconciler reconciles a Etcd object

func NewEtcdReconciler

func NewEtcdReconciler(mgr manager.Manager, disableEtcdServiceAccountAutomount bool) (*EtcdReconciler, error)

NewEtcdReconciler creates a new EtcdReconciler object

func NewEtcdReconcilerWithImageVector added in v0.1.4

func NewEtcdReconcilerWithImageVector(mgr manager.Manager, disableEtcdServiceAccountAutomount bool) (*EtcdReconciler, error)

NewEtcdReconcilerWithImageVector creates a new EtcdReconciler object

func NewReconcilerWithImageVector added in v0.1.4

func NewReconcilerWithImageVector(mgr manager.Manager, disableEtcdServiceAccountAutomount bool) (*EtcdReconciler, error)

NewReconcilerWithImageVector creates a new EtcdReconciler object with an image vector

func (*EtcdReconciler) InitializeControllerWithChartApplier

func (r *EtcdReconciler) InitializeControllerWithChartApplier() (*EtcdReconciler, error)

InitializeControllerWithChartApplier will use EtcdReconciler client to initialize a Kubernetes client as well as a Chart renderer.

func (*EtcdReconciler) InitializeControllerWithImageVector added in v0.1.4

func (r *EtcdReconciler) InitializeControllerWithImageVector() (*EtcdReconciler, error)

InitializeControllerWithImageVector will use EtcdReconciler client to initialize image vector for etcd and backup restore images.

func (*EtcdReconciler) Reconcile

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

Reconcile reconciles the etcd.

func (*EtcdReconciler) SetupWithManager

func (r *EtcdReconciler) SetupWithManager(mgr ctrl.Manager, workers int, ignoreOperationAnnotation bool) error

SetupWithManager sets up manager with a new controller and r as the reconcile.Reconciler

type Secret added in v0.8.0

type Secret struct {
	client.Client
	// contains filtered or unexported fields
}

Secret reconciles secrets referenced in Etcd objects

func NewSecret added in v0.8.0

func NewSecret(mgr manager.Manager) *Secret

NewSecret creates a new reconciler.

func (*Secret) Reconcile added in v0.8.0

func (s *Secret) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles the secret.

func (*Secret) SetupWithManager added in v0.8.0

func (s *Secret) SetupWithManager(mgr ctrl.Manager, workers int) error

SetupWithManager sets up manager with a new controller and s as the reconcile.Reconciler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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