controllers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 43 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)

Types

type ClassifierReconciler

type ClassifierReconciler struct {
	client.Client
	Scheme               *runtime.Scheme
	Deployer             deployer.DeployerInterface
	ConcurrentReconciles int
	ClassifierReportMode ReportMode
	// use a Mutex to update in-memory structure as MaxConcurrentReconciles is higher than one
	Mux sync.Mutex
	// key: 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 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 CAPI Cluster, so that when CAPI Cluster changes
	// list of Classifiers that need reconciliation is in memory.
	// Even though currently each Classifier is deployed in each CAPI Cluster, do not simply keep an in-memory
	// list of all existing Classifier. Rather keep a map per CAPI cluster. If in future, not all Classifiers
	// are deployed in all clusters, map will come in handy.
	// key: CAPI Cluster namespace/name; value: set of all ClusterProfiles matching the Cluster
	ClusterMap map[libsveltosv1alpha1.PolicyRef]*libsveltosset.Set

	// key: Classifier; value: set of CAPI Clusters matched
	ClassifierMap map[libsveltosv1alpha1.PolicyRef]*libsveltosset.Set

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

ClassifierReconciler reconciles a Classifier object

func (*ClassifierReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Classifier object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.1/pkg/reconcile

func (*ClassifierReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

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 CAPI clusters
	CollectFromManagementCluster ReportMode = 0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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