controllers

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 49 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 RoleRequests.",
			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 RoleRequests.",
			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 RoleRequests.",
			e.Object.GetObjectKind()))
		return false
	}
)

Functions

func ClusterPredicates added in v0.4.0

func ClusterPredicates(logger logr.Logger) predicate.Funcs

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

func ConfigMapPredicates added in v0.4.0

func ConfigMapPredicates(logger logr.Logger) predicate.Funcs

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

func IfNewDeletedOrSpecChange

func IfNewDeletedOrSpecChange(logger logr.Logger) predicate.Funcs

IfNewDeletedOrSpecChange returns a predicate that returns true only if Spec changes or object is new/deleted

func InitScheme

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

func RegisterFeatures added in v0.4.0

func RegisterFeatures(d deployer.DeployerInterface, setupLog logr.Logger)

func SecretPredicates added in v0.4.0

func SecretPredicates(logger logr.Logger) predicate.Funcs

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

func SveltosClusterPredicates added in v0.4.0

func SveltosClusterPredicates(logger logr.Logger) predicate.Funcs

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

Types

type AccessRequestReconciler

type AccessRequestReconciler struct {
	client.Client
	*rest.Config
	Scheme               *runtime.Scheme
	ConcurrentReconciles int
}

AccessRequestReconciler reconciles a AccessRequest obje©∫ct

func (*AccessRequestReconciler) Reconcile

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

func (*AccessRequestReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type RoleRequestReconciler added in v0.4.0

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

	ConcurrentReconciles int
	Deployer             deployer.DeployerInterface

	// key: RoleRequest; value RoleRequest Selector
	RoleRequests map[corev1.ObjectReference]libsveltosv1alpha1.Selector

	// use a Mutex to update Map as MaxConcurrentReconciles is higher than one
	Mux sync.Mutex
	// key: Referenced object; value: set of all RoleRequests referencing the resource
	ReferenceMap map[corev1.ObjectReference]*libsveltosset.Set
	// key: RoleRequest object; value: set of referenced resources
	RoleRequestReferenceMap map[corev1.ObjectReference]*libsveltosset.Set

	// key: Sveltos/CAPI Cluster; value: set of all RoleRequests for that cluster
	ClusterMap map[corev1.ObjectReference]*libsveltosset.Set
	// key: RoleRequest; value: set of Sveltos/CAPI Clusters matched
	RoleRequestClusterMap map[corev1.ObjectReference]*libsveltosset.Set
}

RoleRequestReconciler reconciles a RoleRequest object

func (*RoleRequestReconciler) Reconcile added in v0.4.0

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

func (*RoleRequestReconciler) SetupWithManager added in v0.4.0

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

SetupWithManager sets up the controller with the Manager.

func (*RoleRequestReconciler) WatchForCAPI added in v0.4.0

func (r *RoleRequestReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error

Jump to

Keyboard shortcuts

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