controller

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitController

func InitController(mgr ctrlruntime.Manager) error

InitController start the controller

Types

type Reconciler

type Reconciler struct {
	Client        client.Client
	Scheme        *runtime.Scheme
	ModuleClass   moduleapi.ModuleClassType
	DryRun        bool
	StatusUpdater *healthcheck.VerrazzanoStatusUpdater
}

func (Reconciler) GetName

func (r Reconciler) GetName() string

GetName returns the name of the finalizer

func (Reconciler) GetReconcileObject

func (r Reconciler) GetReconcileObject() client.Object

GetReconcileObject returns the kind of object being reconciled

func (Reconciler) GetWatchDescriptors

func (r Reconciler) GetWatchDescriptors() []controllerspi.WatchDescriptor

GetWatchDescriptors returns the list of WatchDescriptors for objects being watched by the component Always watch for secrets and configmaps since they may contain module configuration

func (Reconciler) PostRemoveFinalizer

func (r Reconciler) PostRemoveFinalizer(controllerCtx controllerspi.ReconcileContext, u *unstructured.Unstructured)

PostRemoveFinalizer is called after the finalizer is successfully removed. This method does garbage collection and other tasks that can never return an error

func (Reconciler) PreRemoveFinalizer

func (r Reconciler) PreRemoveFinalizer(controllerCtx controllerspi.ReconcileContext, u *unstructured.Unstructured) result.Result

PreRemoveFinalizer is called when the resource is being deleted, before the finalizer is removed. This code will do a full Verrazzano uninstall by deleting all the Module CRs. This code idempotent and can be called any number of times from the controller-runtime. It doesn't matter if the Verrazzano CR gets modified while uninstall already in progress, because the Reconcile method will not be called again for that particular Verrazzano CR once the CR deletion timestamp is set.

Uninstall has 3 phases, pre-work, work, and post-work. The global pre-work and post-work can block the entire controller, depending on what is being done. The work phase deletes the Module CRs then checks if they are gone. Those delete operations are non-blocking, other than the time it takes to call the Kubernetes API server.

Once the Modules are gone and the post-work is done, then the finalizer is removed, causing the Verrazzano CR to be deleted from etcd.

func (Reconciler) Reconcile

Reconcile reconciles the Verrazzano CR. This includes new installations, updates, upgrades, and partial uninstallations. Reconciliation is done by creating and updating Module CRs, one for each component that is enabled in the Verrazzano effective CR. If the Verrazzano component is disabled, then reconcile will uninstall that component by deleting the Module CR. This code is idempotent and can be called any number of times from the controller-runtime. If the Verrazzano CR gets modified while a life-cycle operation is already in progress, then those changes will take effect as soon as possible (when Reconcile is called)

Reconciliation has 3 phases, pre-work, work, and post-work. The global pre-work and post-work can block the entire controller, depending on what is being done. The work phase, just creates,updates, and deletes the Module CR. Those operations are non-blocking, other than the time it takes to call the Kubernetes API server.

NOTE: full uninstallations are done by the finalizer.go code

func (Reconciler) ShouldConfigMapTriggerReconcile

func (r Reconciler) ShouldConfigMapTriggerReconcile(cli client.Client, wev controllerspi.WatchEvent) bool

ShouldConfigMapTriggerReconcile returns true if reconcile should be done in response to a ConfigMap lifecycle event

func (Reconciler) ShouldJobTriggerReconcile

func (r Reconciler) ShouldJobTriggerReconcile(cli client.Client, wev controllerspi.WatchEvent) bool

ShouldJobTriggerReconcile returns true if reconcile should be done in response to a Job lifecycle event

func (Reconciler) ShouldSecretTriggerReconcile

func (r Reconciler) ShouldSecretTriggerReconcile(cli client.Client, wev controllerspi.WatchEvent) bool

ShouldSecretTriggerReconcile returns true if reconcile should be done in response to a Secret lifecycle event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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