controllers

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace where reports will be generated
	ReportNamespace = "projectsveltos"
)

Variables

This section is empty.

Functions

func ClusterSummaryPredicates

func ClusterSummaryPredicates(logger logr.Logger) predicate.Funcs

ClusterSummaryPredicates predicates for clustersummary. ClusterHealthCheckReconciler watches sveltos ClusterSummary events and react to those by reconciling itself based on following predicates

func HealthCheckPredicates added in v0.7.0

func HealthCheckPredicates(logger logr.Logger) predicate.Funcs

HealthCheckPredicates predicates for HealthCheck. ClusterHealthCheckReconciler watches sveltos HealthCheck events and react to those by reconciling itself based on following predicates

func HealthCheckReportPredicates added in v0.7.0

func HealthCheckReportPredicates(logger logr.Logger) predicate.Funcs

HealthCheckReportPredicates predicates for HealthCheckReport. ClusterHealthCheckReconciler watches sveltos HealthCheckReport events and react to those by reconciling itself based on following predicates

func InitScheme

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

func RegisterFeatures

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

func SetManagementRecorder

func SetManagementRecorder(r record.EventRecorder)

func SveltosClusterPredicates

func SveltosClusterPredicates(logger logr.Logger) predicate.Funcs

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

Types

type ClusterHealthCheckReconciler

type ClusterHealthCheckReconciler struct {
	client.Client
	Scheme               *runtime.Scheme
	ConcurrentReconciles int
	Deployer             deployer.DeployerInterface
	ShardKey             string // when set, only clusters matching the ShardKey will be reconciled
	// use a Mutex to update Map as MaxConcurrentReconciles is higher than one
	Mux sync.Mutex

	// key: Sveltos/CAPI Cluster: value: set of all ClusterHealthCheck instances matching the Cluster
	ClusterMap map[corev1.ObjectReference]*libsveltosset.Set
	// key: ClusterHealthCheck: value: set of Sveltos/CAPI Clusters matched
	CHCToClusterMap map[types.NamespacedName]*libsveltosset.Set

	// key: ClusterHealthCheck; value ClusterHealthCheck Selector
	ClusterHealthChecks map[corev1.ObjectReference]libsveltosv1beta1.Selector

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

	// key: HealthCheck: value: set of all ClusterHealthCheck referencing it
	HealthCheckMap map[corev1.ObjectReference]*libsveltosset.Set

	// Key: ClusterHealthCheck: value: set of HealthChecks referenced
	CHCToHealthCheckMap map[types.NamespacedName]*libsveltosset.Set
}

ClusterHealthCheckReconciler reconciles a ClusterHealthCheck object

func (*ClusterHealthCheckReconciler) Reconcile

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

func (*ClusterHealthCheckReconciler) SetupWithManager

SetupWithManager sets up the controller with the Manager.

func (*ClusterHealthCheckReconciler) WatchForCAPI

type ClusterPredicate added in v0.29.0

type ClusterPredicate struct {
	Logger logr.Logger
}

func (ClusterPredicate) Create added in v0.29.0

func (ClusterPredicate) Delete added in v0.29.0

func (ClusterPredicate) Generic added in v0.29.0

func (ClusterPredicate) Update added in v0.29.0

type ClusterReconciler added in v0.7.0

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

ClusterReconciler reconciles a Cluster object

func (*ClusterReconciler) Reconcile added in v0.7.0

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

func (*ClusterReconciler) SetupWithManager added in v0.7.0

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

SetupWithManager sets up the controller with the Manager.

type HealthCheckReconciler added in v0.7.0

type HealthCheckReconciler struct {
	client.Client
	Scheme                *runtime.Scheme
	HealthCheckReportMode ReportMode
	ShardKey              string // when set, only clusters matching the ShardKey will be reconciled
	Version               string
}

HealthCheckReconciler reconciles a HealthCheck object

func (*HealthCheckReconciler) Reconcile added in v0.7.0

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

+kubebuilder:rbac:groups=lib.projectsveltos.io,resources=healthchecks,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=lib.projectsveltos.io,resources=healthchecks/status,verbs=get;update;patch +kubebuilder:rbac:groups=lib.projectsveltos.io,resources=healthchecks/finalizers,verbs=update

func (*HealthCheckReconciler) SetupWithManager added in v0.7.0

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

SetupWithManager sets up the controller with the Manager.

type MachinePredicate added in v0.29.0

type MachinePredicate struct {
	Logger logr.Logger
}

func (MachinePredicate) Create added in v0.29.0

func (MachinePredicate) Delete added in v0.29.0

func (MachinePredicate) Generic added in v0.29.0

func (MachinePredicate) Update added in v0.29.0

type ReloaderReportReconciler added in v0.15.0

type ReloaderReportReconciler struct {
	client.Client
	Scheme             *runtime.Scheme
	ReloaderReportMode ReportMode
	ShardKey           string // when set, only clusters matching the ShardKey will be reconciled
	Version            string
}

ReloaderReportReconciler reconciles a ReloaderReport object

func (*ReloaderReportReconciler) Reconcile added in v0.15.0

func (*ReloaderReportReconciler) SetupWithManager added in v0.15.0

func (r *ReloaderReportReconciler) SetupWithManager(mgr ctrl.Manager, collectionInterval int) error

SetupWithManager sets up the controller with the Manager.

type ReportMode added in v0.7.0

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

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

type SveltosClusterReconciler added in v0.7.0

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

SveltosClusterReconciler reconciles a SveltosCluster object

func (*SveltosClusterReconciler) Reconcile added in v0.7.0

func (*SveltosClusterReconciler) SetupWithManager added in v0.7.0

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