controllers

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassifierPredicate

func ClassifierPredicate(logger logr.Logger) predicate.Funcs

ClassifierPredicate predicates for Classifier. ClassifierReconciler watches Classifier events and react to those by reconciling itself based on following predicates

func ClassifierReportPredicate

func ClassifierReportPredicate(logger logr.Logger) predicate.Funcs

ClassifierReportPredicate predicates for ClassifierReport. ClassifierReconciler watches ClassifierReport events and react to those by reconciling itself based on following predicates

func ClusterPredicates

func ClusterPredicates(logger logr.Logger) predicate.Funcs

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

func InitScheme

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

func MachinePredicates

func MachinePredicates(logger logr.Logger) predicate.Funcs

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

func RegisterFeatures

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

func SecretPredicates added in v0.3.0

func SecretPredicates(logger logr.Logger) predicate.Funcs

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

func SetManagementClusterAccess added in v0.18.0

func SetManagementClusterAccess(config *rest.Config, c client.Client)

func SetVersion added in v0.22.0

func SetVersion(v string)

func SveltosClusterPredicates added in v0.3.0

func SveltosClusterPredicates(logger logr.Logger) predicate.Funcs

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

Types

type ClassifierReconciler

type ClassifierReconciler struct {
	client.Client
	Scheme               *runtime.Scheme
	Deployer             deployer.DeployerInterface
	ConcurrentReconciles int
	ClassifierReportMode ReportMode
	AgentInMgmtCluster   bool // if true, indicates sveltos-agent needs to be started in the management cluster
	// Management cluster controlplane endpoint. This is needed when mode is AgentSendReportsNoGateway.
	// It will be used by classifier-agent to send classifierreports back to management cluster.
	ControlPlaneEndpoint string
	ShardKey             string // when set, only clusters matching the ShardKey will be reconciled
	// use a Mutex to update in-memory structure as MaxConcurrentReconciles is higher than one
	Mux sync.Mutex
	// key: Sveltos/CAPI Cluster namespace/name; value: set of all Classifiers deployed int the Cluster
	// When a Cluster changes, we need to reconcile one or more Classifier (as of now all Classifier
	// are deployed in all Clusters). In order to do so, Classifier reconciler watches for Sveltos/CAPI Cluster
	// changes. Inside a MapFunc there should be no I/O (if that fails, there is no way to recover).
	// So keeps track of Classifier sets deployed in each Sveltos/CAPI Cluster, so that when Sveltos/CAPI Cluster changes
	// list of Classifiers that need reconciliation is in memory.
	// Even though currently each Classifier is deployed in each Sveltos/CAPI Cluster, do not simply keep an in-memory
	// list of all existing Classifier. Rather keep a map per Sveltos/CAPI cluster. If in future, not all Classifiers
	// are deployed in all clusters, map will come in handy.
	// key: Sveltos/CAPI Cluster namespace/name; value: set of all ClusterProfiles matching the Cluster
	ClusterMap map[corev1.ObjectReference]*libsveltosset.Set

	// key: Classifier; value: set of Sveltos/CAPI Clusters matched
	ClassifierMap map[corev1.ObjectReference]*libsveltosset.Set

	// Contains list of all Classifier with at least one conflict
	ClassifierSet libsveltosset.Set

	// List of current existing Classifiers
	AllClassifierSet libsveltosset.Set
}

ClassifierReconciler reconciles a Classifier object

func (*ClassifierReconciler) Reconcile

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

func (*ClassifierReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*ClassifierReconciler) WatchForCAPI added in v0.3.0

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

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 ReportMode

type ReportMode int
const (
	// Default mode. In this mode, Classifier running
	// in the management cluster periodically collect
	// ClassifierReport from Sveltos/CAPI clusters
	CollectFromManagementCluster ReportMode = iota

	// In this mode, classifier agent sends ClassifierReport
	// to management cluster.
	// SveltosAgent is provided with Kubeconfig to access
	// management cluster and can only update ClassifierReport/
	// HealthCheckReport/EventReport
	AgentSendReportsNoGateway
)

type SveltosClusterReconciler added in v0.3.0

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

SveltosClusterReconciler reconciles a SveltosCluster object

func (*SveltosClusterReconciler) Reconcile added in v0.3.0

func (*SveltosClusterReconciler) SetupWithManager added in v0.3.0

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

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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