Documentation
¶
Overview ¶
Package controllers is used to provide the core functionalities of hvpa-controller
Index ¶
- Constants
- Variables
- func CheckStatefulSet(etcd *druidv1alpha1.Etcd, statefulSet *appsv1.StatefulSet) error
- func RecheckDeletionTimestamp(getObject func() (metav1.Object, error)) func() error
- type BaseControllerRefManager
- type CompactionLeaseController
- func (lc *CompactionLeaseController) InitializeControllerWithImageVector() (*CompactionLeaseController, error)
- func (lc *CompactionLeaseController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (lc *CompactionLeaseController) SetupWithManager(mgr ctrl.Manager, workers int) error
- type EtcdCopyBackupsTaskReconciler
- func (r *EtcdCopyBackupsTaskReconciler) InitializeControllerWithChartApplier() (*EtcdCopyBackupsTaskReconciler, error)
- func (r *EtcdCopyBackupsTaskReconciler) InitializeControllerWithImageVector() (*EtcdCopyBackupsTaskReconciler, error)
- func (r *EtcdCopyBackupsTaskReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *EtcdCopyBackupsTaskReconciler) SetupWithManager(mgr ctrl.Manager, workers int) error
- type EtcdCustodian
- type EtcdDruidRefManager
- func (m *EtcdDruidRefManager) AdoptResource(ctx context.Context, obj client.Object) error
- func (m *EtcdDruidRefManager) ClaimConfigMaps(ctx context.Context, cms *corev1.ConfigMapList, ...) ([]*corev1.ConfigMap, error)
- func (m *EtcdDruidRefManager) ClaimServices(ctx context.Context, svcs *corev1.ServiceList, ...) ([]*corev1.Service, error)
- func (m *EtcdDruidRefManager) ClaimStatefulsets(ctx context.Context, statefulSetList *appsv1.StatefulSetList, ...) ([]*appsv1.StatefulSet, error)
- func (m *EtcdDruidRefManager) FetchStatefulSet(ctx context.Context, etcd *druidv1alpha1.Etcd) (*appsv1.StatefulSetList, error)
- func (m *EtcdDruidRefManager) ReleaseResource(ctx context.Context, obj client.Object) error
- type EtcdReconciler
- func (r *EtcdReconciler) InitializeControllerWithChartApplier() (*EtcdReconciler, error)
- func (r *EtcdReconciler) InitializeControllerWithImageVector() (*EtcdReconciler, error)
- func (r *EtcdReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *EtcdReconciler) SetupWithManager(mgr ctrl.Manager, workers int, ignoreOperationAnnotation bool) error
Constants ¶
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" )
const ( // DefaultETCDQuota is the default etcd quota. DefaultETCDQuota = 8 * 1024 * 1024 * 1024 // 8Gi )
Variables ¶
var ( // DefaultTimeout is the default timeout for retry operations. DefaultTimeout = 1 * time.Minute )
var ( // UncachedObjectList is a list of objects which should not be cached. UncachedObjectList = []client.Object{ &corev1.Event{}, &eventsv1beta1.Event{}, &eventsv1.Event{}, } )
Functions ¶
func CheckStatefulSet ¶ added in v0.5.0
func CheckStatefulSet(etcd *druidv1alpha1.Etcd, statefulSet *appsv1.StatefulSet) error
CheckStatefulSet checks whether the given StatefulSet is healthy. A StatefulSet is considered healthy if its controller observed its current revision, it is not in an update (i.e. UpdateRevision is empty) and if its current replicas are equal to desired replicas specified in ETCD specs.
func RecheckDeletionTimestamp ¶
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
func (lc *CompactionLeaseController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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
func (r *EtcdCopyBackupsTaskReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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
func NewEtcdCustodian(mgr manager.Manager, config controllersconfig.EtcdCustodianController) *EtcdCustodian
NewEtcdCustodian creates a new EtcdCustodian object
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
AdoptResource sends a patch to take control of the Etcd. It returns the error if the patching fails.
func (*EtcdDruidRefManager) ClaimConfigMaps ¶
func (m *EtcdDruidRefManager) ClaimConfigMaps(ctx context.Context, cms *corev1.ConfigMapList, filters ...func(*corev1.ConfigMap) bool) ([]*corev1.ConfigMap, error)
ClaimConfigMaps tries to take ownership of a list of ConfigMaps.
It will reconcile the following:
- Adopt orphans if the selector matches.
- Release owned objects if the selector no longer matches.
Optional: If one or more filters are specified, a Service will only be claimed if all filters return true.
A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.
If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The list of Services that you now own is returned.
func (*EtcdDruidRefManager) ClaimServices ¶
func (m *EtcdDruidRefManager) ClaimServices(ctx context.Context, svcs *corev1.ServiceList, filters ...func(*corev1.Service) bool) ([]*corev1.Service, error)
ClaimServices tries to take ownership of a list of Services.
It will reconcile the following:
- Adopt orphans if the selector matches.
- Release owned objects if the selector no longer matches.
Optional: If one or more filters are specified, a Service will only be claimed if all filters return true.
A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.
If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The list of Services that you now own is returned.
func (*EtcdDruidRefManager) ClaimStatefulsets ¶
func (m *EtcdDruidRefManager) ClaimStatefulsets(ctx context.Context, statefulSetList *appsv1.StatefulSetList, filters ...func(*appsv1.StatefulSet) bool) ([]*appsv1.StatefulSet, error)
ClaimStatefulsets tries to take ownership of a list of Statefulsets.
It will reconcile the following:
- Adopt orphans if the selector matches.
- Release owned objects if the selector no longer matches.
- Remove ownerReferences from the statefulsets and use annotations
Optional: If one or more filters are specified, a Statefulset will only be claimed if all filters return true.
A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.
If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The list of statefulsets that you now own is returned.
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
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) (*EtcdReconciler, error)
NewEtcdReconciler creates a new EtcdReconciler object
func NewEtcdReconcilerWithImageVector ¶ added in v0.1.4
func NewEtcdReconcilerWithImageVector(mgr manager.Manager) (*EtcdReconciler, error)
NewEtcdReconcilerWithImageVector creates a new EtcdReconciler object
func NewReconcilerWithImageVector ¶ added in v0.1.4
func NewReconcilerWithImageVector(mgr manager.Manager) (*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) 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