controllers

package
v0.21.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CreateFuncTrue = func(e event.CreateEvent, logger logr.Logger) bool {
		log := logger.WithValues("predicate", "createEvent",
			e.Object.GetObjectKind(), e.Object.GetName(),
		)

		log.V(logs.LogVerbose).Info(fmt.Sprintf(
			"%s did match expected conditions.  Will attempt to reconcile associated AddonCompliances.",
			e.Object.GetObjectKind()))
		return true
	}

	DeleteFuncTrue = func(e event.DeleteEvent, logger logr.Logger) bool {
		log := logger.WithValues("predicate", "deleteEvent",
			e.Object.GetObjectKind(), e.Object.GetName(),
		)
		log.V(logs.LogVerbose).Info(fmt.Sprintf(
			"%s did match expected conditions.  Will attempt to reconcile associated AddonCompliances.",
			e.Object.GetObjectKind()))
		return true
	}

	GenericFuncFalse = func(e event.GenericEvent, logger logr.Logger) bool {
		log := logger.WithValues("predicate", "genericEvent",
			e.Object.GetObjectKind(), e.Object.GetName(),
		)
		log.V(logs.LogVerbose).Info(fmt.Sprintf(
			"%s did not match expected conditions.  Will not attempt to reconcile associated AddonCompliances.",
			e.Object.GetObjectKind()))
		return false
	}
)

Functions

func ClusterPredicates

func ClusterPredicates(logger logr.Logger) predicate.Funcs

ClusterPredicates predicates for v1Cluster. AddonComplianceReconciler watches v1Cluster events and react to those by reconciling itself based on following predicates

func ConfigMapPredicates

func ConfigMapPredicates(logger logr.Logger) predicate.Funcs

ConfigMapPredicates predicates for ConfigMaps. AddonComplianceReconciler watches ConfigMap events and react to those by reconciling itself based on following predicates

func FluxSourcePredicates

func FluxSourcePredicates(s *runtime.Scheme, logger logr.Logger) predicate.Funcs

FluxSourcePredicates predicates for GitRepository/OCIRepository/Bucket. AddonComplianceReconciler watches GitRepository/OCIRepository/Bucket events and react to those by reconciling itself based on following predicates

func GetManager

func GetManager() *manager

GetManager returns the manager instance implementing the ClassifierInterface. Returns nil if manager has not been initialized yet

func InitScheme

func InitScheme() (*runtime.Scheme, error)

func MachinePredicates

func MachinePredicates(logger logr.Logger) predicate.Funcs

MachinePredicates predicates for v1Machine. AddonComplianceReconciler watches v1Machine events and react to those by reconciling itself based on following predicates

func SecretPredicates

func SecretPredicates(logger logr.Logger) predicate.Funcs

SecretPredicates predicates for Secrets. AddonComplianceReconciler watches Secret events and react to those by reconciling itself based on following predicates

func SveltosClusterPredicates

func SveltosClusterPredicates(logger logr.Logger) predicate.Funcs

SveltosClusterPredicates predicates for sveltos Cluster. AddonComplianceReconciler watches sveltos Cluster events and react to those by reconciling itself based on following predicates

Types

type AddonComplianceReconciler

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

	ConcurrentReconciles int

	// use a Mutex to update Map as MaxConcurrentReconciles is higher than one
	PolicyMux sync.Mutex

	// For each cluster contains current labels
	// This is needed in following scenario:
	// - AddonCompliance is created
	// - Cluster is created with labels matching AddonCompliance
	// - When first control plane machine in such cluster becomes available
	// we need Cluster labels to know which AddonCompliance to reconcile
	ClusterLabels map[corev1.ObjectReference]map[string]string

	// key: AddonCompliance; value AddonCompliance Selector
	AddonCompliances map[types.NamespacedName]libsveltosv1alpha1.Selector

	// key: Sveltos/CAPI Cluster; value: set of all AddonCompliances matching the Cluster
	ClusterMap map[corev1.ObjectReference]*libsveltosset.Set
	// key: AddonCompliance; value: set of Sveltos/CAPI Clusters matched
	AddonComplianceToClusterMap map[types.NamespacedName]*libsveltosset.Set

	// key: Referenced object; value: set of all AddonCompliances referencing the resource
	ReferenceMap map[corev1.ObjectReference]*libsveltosset.Set
	// key: AddonCompliance name; value: set of referenced resources
	AddonComplianceToReferenceMap map[types.NamespacedName]*libsveltosset.Set
}

AddonComplianceReconciler reconciles a AddonCompliance object

func (*AddonComplianceReconciler) Reconcile

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

func (*AddonComplianceReconciler) SetupWithManager

func (r *AddonComplianceReconciler) SetupWithManager(mgr ctrl.Manager) (controller.Controller, error)

SetupWithManager sets up the controller with the Manager.

func (*AddonComplianceReconciler) WatchForCAPI

func (*AddonComplianceReconciler) WatchForFlux

type ClusterReconciler

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

ClusterReconciler reconciles a Cluster object

func (*ClusterReconciler) Reconcile

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

func (*ClusterReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SveltosClusterReconciler

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

SveltosClusterReconciler reconciles a SveltosCluster object

func (*SveltosClusterReconciler) Reconcile

func (*SveltosClusterReconciler) SetupWithManager

func (r *SveltosClusterReconciler) 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