Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigMapPredicates(logger logr.Logger) predicate.Funcs
- func GetClusterSummaryName(profileKind, profileName, clusterName string, isSveltosCluster bool) string
- func InitScheme() (*runtime.Scheme, error)
- func RegisterFeatures(d deployer.DeployerInterface, setupLog logr.Logger)
- func SecretPredicates(logger logr.Logger) predicate.Funcs
- func SetDriftdetectionConfigMap(name string)
- func SetManagementClusterAccess(c client.Client, config *rest.Config)
- func SetPredicates(logger logr.Logger) predicate.Funcs
- func SetVersion(v string)
- func SveltosClusterPredicates(logger logr.Logger) predicate.Funcs
- type ClusterPredicate
- func (p ClusterPredicate) Create(obj event.TypedCreateEvent[*clusterv1.Cluster]) bool
- func (p ClusterPredicate) Delete(obj event.TypedDeleteEvent[*clusterv1.Cluster]) bool
- func (c ClusterPredicate) Generic(obj event.TypedGenericEvent[*clusterv1.Cluster]) bool
- func (p ClusterPredicate) Update(obj event.TypedUpdateEvent[*clusterv1.Cluster]) bool
- type ClusterProfileReconciler
- func (r *ClusterProfileReconciler) GetController() controller.Controller
- func (r *ClusterProfileReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)
- func (r *ClusterProfileReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *ClusterProfileReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
- type ClusterSetReconciler
- func (r *ClusterSetReconciler) GetController() controller.Controller
- func (r *ClusterSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)
- func (r *ClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *ClusterSetReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
- type ClusterSummaryReconciler
- func (r *ClusterSummaryReconciler) GetController() controller.Controller
- func (r *ClusterSummaryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)
- func (r *ClusterSummaryReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
- func (r *ClusterSummaryReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
- func (r *ClusterSummaryReconciler) WatchForFlux(mgr ctrl.Manager, c controller.Controller) error
- type FluxBucketPredicate
- func (p FluxBucketPredicate) Create(obj event.TypedCreateEvent[*sourcev1b2.Bucket]) bool
- func (p FluxBucketPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1b2.Bucket]) bool
- func (p FluxBucketPredicate) Generic(obj event.TypedGenericEvent[*sourcev1b2.Bucket]) bool
- func (p FluxBucketPredicate) Update(obj event.TypedUpdateEvent[*sourcev1b2.Bucket]) bool
- type FluxGitRepositoryPredicate
- func (p FluxGitRepositoryPredicate) Create(obj event.TypedCreateEvent[*sourcev1.GitRepository]) bool
- func (p FluxGitRepositoryPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1.GitRepository]) bool
- func (p FluxGitRepositoryPredicate) Generic(obj event.TypedGenericEvent[*sourcev1.GitRepository]) bool
- func (p FluxGitRepositoryPredicate) Update(obj event.TypedUpdateEvent[*sourcev1.GitRepository]) bool
- type FluxOCIRepositoryPredicate
- func (p FluxOCIRepositoryPredicate) Create(obj event.TypedCreateEvent[*sourcev1b2.OCIRepository]) bool
- func (p FluxOCIRepositoryPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1b2.OCIRepository]) bool
- func (p FluxOCIRepositoryPredicate) Generic(obj event.TypedGenericEvent[*sourcev1b2.OCIRepository]) bool
- func (p FluxOCIRepositoryPredicate) Update(obj event.TypedUpdateEvent[*sourcev1b2.OCIRepository]) bool
- type MachinePredicate
- func (p MachinePredicate) Create(obj event.TypedCreateEvent[*clusterv1.Machine]) bool
- func (p MachinePredicate) Delete(obj event.TypedDeleteEvent[*clusterv1.Machine]) bool
- func (p MachinePredicate) Generic(obj event.TypedGenericEvent[*clusterv1.Machine]) bool
- func (p MachinePredicate) Update(obj event.TypedUpdateEvent[*clusterv1.Machine]) bool
- type NonRetriableError
- type ProfileReconciler
- func (r *ProfileReconciler) GetController() controller.Controller
- func (r *ProfileReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)
- func (r *ProfileReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *ProfileReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
- type ReportMode
- type SetReconciler
- func (r *SetReconciler) GetController() controller.Controller
- func (r *SetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)
- func (r *SetReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *SetReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
Constants ¶
const ( // ClusterSummaryLabelName is added to each policy deployed by a ClusterSummary // instance to a CAPI Cluster ClusterSummaryLabelName = "projectsveltos.io/cluster-summary-name" // ClusterProfileLabelName is added to all ClusterSummary instances created // by a ClusterProfile instance ClusterProfileLabelName = "projectsveltos.io/cluster-profile-name" // ProfileLabelName is added to all ClusterSummary instances created // by a Profile instance ProfileLabelName = "projectsveltos.io/profile-name" )
Variables ¶
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 ClusterSummaries.", 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 ClusterSummaries.", 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 ClusterSummaries.", e.Object.GetObjectKind())) return false } )
Functions ¶
func ConfigMapPredicates ¶
ConfigMapPredicates predicates for ConfigMaps. ClusterSummaryReconciler watches ConfigMap events and react to those by reconciling itself based on following predicates
func GetClusterSummaryName ¶
func GetClusterSummaryName(profileKind, profileName, clusterName string, isSveltosCluster bool) string
GetClusterSummaryName returns the ClusterSummary name given a ClusterProfile/Profile kind/name and cluster type/Name.
func InitScheme ¶
func RegisterFeatures ¶
func RegisterFeatures(d deployer.DeployerInterface, setupLog logr.Logger)
func SecretPredicates ¶
SecretPredicates predicates for Secrets. ClusterSummaryReconciler watches Secret events and react to those by reconciling itself based on following predicates
func SetDriftdetectionConfigMap ¶ added in v0.34.0
func SetDriftdetectionConfigMap(name string)
func SetPredicates ¶ added in v0.26.0
SetPredicates predicates for ClusterSet/Set. ClusterProfileReconciler watches ClusterSet/Set events and react to those by reconciling itself based on following predicates
func SetVersion ¶ added in v0.22.0
func SetVersion(v string)
Types ¶
type ClusterPredicate ¶ added in v0.29.0
func (ClusterPredicate) Create ¶ added in v0.29.0
func (p ClusterPredicate) Create(obj event.TypedCreateEvent[*clusterv1.Cluster]) bool
func (ClusterPredicate) Delete ¶ added in v0.29.0
func (p ClusterPredicate) Delete(obj event.TypedDeleteEvent[*clusterv1.Cluster]) bool
func (ClusterPredicate) Generic ¶ added in v0.29.0
func (c ClusterPredicate) Generic(obj event.TypedGenericEvent[*clusterv1.Cluster]) bool
func (ClusterPredicate) Update ¶ added in v0.29.0
func (p ClusterPredicate) Update(obj event.TypedUpdateEvent[*clusterv1.Cluster]) bool
type ClusterProfileReconciler ¶
type ClusterProfileReconciler struct { client.Client Scheme *runtime.Scheme ConcurrentReconciles int Logger logr.Logger // use a Mutex to update Map as MaxConcurrentReconciles is higher than one Mux sync.Mutex // key: ClusterSet: value ClusterProfiles currently referencing the ClusterSet ClusterSetMap map[corev1.ObjectReference]*libsveltosset.Set // key: Sveltos/Cluster; value: set of all ClusterProfiles matching the Cluster ClusterMap map[corev1.ObjectReference]*libsveltosset.Set // key: ClusterProfile; value ClusterProfile Selector ClusterProfiles map[corev1.ObjectReference]libsveltosv1beta1.Selector // For each cluster contains current labels // This is needed in following scenario: // - ClusterProfile is created // - Cluster is created with labels matching ClusterProfile // - When first control plane machine in such cluster becomes available // we need Cluster labels to know which ClusterProfile to reconcile ClusterLabels map[corev1.ObjectReference]map[string]string // contains filtered or unexported fields }
ClusterProfileReconciler reconciles a ClusterProfile object
func (*ClusterProfileReconciler) GetController ¶ added in v0.26.0
func (r *ClusterProfileReconciler) GetController() controller.Controller
func (*ClusterProfileReconciler) SetupWithManager ¶
func (r *ClusterProfileReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*ClusterProfileReconciler) WatchForCAPI ¶
func (r *ClusterProfileReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
type ClusterSetReconciler ¶ added in v0.26.0
type ClusterSetReconciler struct { client.Client Scheme *runtime.Scheme ConcurrentReconciles int Logger logr.Logger // use a Mutex to update Map as MaxConcurrentReconciles is higher than one Mux sync.Mutex // key: Sveltos/Cluster; value: set of all ClusterSets matching the Cluster ClusterMap map[corev1.ObjectReference]*libsveltosset.Set // key: ClusterSet; value: set of Sveltos/CAPI Clusters matched ClusterSetMap map[corev1.ObjectReference]*libsveltosset.Set // key: ClusterSets; value ClusterSet Selector ClusterSets map[corev1.ObjectReference]libsveltosv1beta1.Selector // For each cluster contains current labels // This is needed in following scenario: // - ClusterSet is created // - Cluster is created with labels matching ClusterSet // - When first control plane machine in such cluster becomes available // we need Cluster labels to know which ClusterSet to reconcile ClusterLabels map[corev1.ObjectReference]map[string]string // contains filtered or unexported fields }
ClusterSetReconciler reconciles a ClusterSet object
func (*ClusterSetReconciler) GetController ¶ added in v0.26.0
func (r *ClusterSetReconciler) GetController() controller.Controller
func (*ClusterSetReconciler) SetupWithManager ¶ added in v0.26.0
func (r *ClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*ClusterSetReconciler) WatchForCAPI ¶ added in v0.26.0
func (r *ClusterSetReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
type ClusterSummaryReconciler ¶
type ClusterSummaryReconciler struct { *rest.Config client.Client Scheme *runtime.Scheme Logger logr.Logger ReportMode ReportMode AgentInMgmtCluster bool // if true, indicates drift-detection-manager needs to be started in the management cluster ShardKey string // when set, only clusters matching the ShardKey will be reconciled Version string Deployer deployer.DeployerInterface ConcurrentReconciles int PolicyMux sync.Mutex // use a Mutex to update Map as MaxConcurrentReconciles is higher than one ReferenceMap map[corev1.ObjectReference]*libsveltosset.Set // key: Referenced object; value: set of all ClusterSummaries referencing the resource ClusterMap map[corev1.ObjectReference]*libsveltosset.Set // key: Sveltos/Cluster; value: set of all ClusterSummaries for that Cluster ConflictRetryTime time.Duration // contains filtered or unexported fields }
ClusterSummaryReconciler reconciles a ClusterSummary object
func (*ClusterSummaryReconciler) GetController ¶ added in v0.26.0
func (r *ClusterSummaryReconciler) GetController() controller.Controller
func (*ClusterSummaryReconciler) SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.
func (*ClusterSummaryReconciler) WatchForCAPI ¶
func (r *ClusterSummaryReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
func (*ClusterSummaryReconciler) WatchForFlux ¶
func (r *ClusterSummaryReconciler) WatchForFlux(mgr ctrl.Manager, c controller.Controller) error
type FluxBucketPredicate ¶ added in v0.29.0
func (FluxBucketPredicate) Create ¶ added in v0.29.0
func (p FluxBucketPredicate) Create(obj event.TypedCreateEvent[*sourcev1b2.Bucket]) bool
func (FluxBucketPredicate) Delete ¶ added in v0.29.0
func (p FluxBucketPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1b2.Bucket]) bool
func (FluxBucketPredicate) Generic ¶ added in v0.29.0
func (p FluxBucketPredicate) Generic(obj event.TypedGenericEvent[*sourcev1b2.Bucket]) bool
func (FluxBucketPredicate) Update ¶ added in v0.29.0
func (p FluxBucketPredicate) Update(obj event.TypedUpdateEvent[*sourcev1b2.Bucket]) bool
type FluxGitRepositoryPredicate ¶ added in v0.29.0
func (FluxGitRepositoryPredicate) Create ¶ added in v0.29.0
func (p FluxGitRepositoryPredicate) Create(obj event.TypedCreateEvent[*sourcev1.GitRepository]) bool
func (FluxGitRepositoryPredicate) Delete ¶ added in v0.29.0
func (p FluxGitRepositoryPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1.GitRepository]) bool
func (FluxGitRepositoryPredicate) Generic ¶ added in v0.29.0
func (p FluxGitRepositoryPredicate) Generic(obj event.TypedGenericEvent[*sourcev1.GitRepository]) bool
func (FluxGitRepositoryPredicate) Update ¶ added in v0.29.0
func (p FluxGitRepositoryPredicate) Update(obj event.TypedUpdateEvent[*sourcev1.GitRepository]) bool
type FluxOCIRepositoryPredicate ¶ added in v0.29.0
func (FluxOCIRepositoryPredicate) Create ¶ added in v0.29.0
func (p FluxOCIRepositoryPredicate) Create(obj event.TypedCreateEvent[*sourcev1b2.OCIRepository]) bool
func (FluxOCIRepositoryPredicate) Delete ¶ added in v0.29.0
func (p FluxOCIRepositoryPredicate) Delete(obj event.TypedDeleteEvent[*sourcev1b2.OCIRepository]) bool
func (FluxOCIRepositoryPredicate) Generic ¶ added in v0.29.0
func (p FluxOCIRepositoryPredicate) Generic(obj event.TypedGenericEvent[*sourcev1b2.OCIRepository]) bool
func (FluxOCIRepositoryPredicate) Update ¶ added in v0.29.0
func (p FluxOCIRepositoryPredicate) Update(obj event.TypedUpdateEvent[*sourcev1b2.OCIRepository]) bool
type MachinePredicate ¶ added in v0.29.0
func (MachinePredicate) Create ¶ added in v0.29.0
func (p MachinePredicate) Create(obj event.TypedCreateEvent[*clusterv1.Machine]) bool
func (MachinePredicate) Delete ¶ added in v0.29.0
func (p MachinePredicate) Delete(obj event.TypedDeleteEvent[*clusterv1.Machine]) bool
func (MachinePredicate) Generic ¶ added in v0.29.0
func (p MachinePredicate) Generic(obj event.TypedGenericEvent[*clusterv1.Machine]) bool
func (MachinePredicate) Update ¶ added in v0.29.0
func (p MachinePredicate) Update(obj event.TypedUpdateEvent[*clusterv1.Machine]) bool
type NonRetriableError ¶ added in v0.22.0
type NonRetriableError struct {
Message string
}
func (*NonRetriableError) Error ¶ added in v0.22.0
func (r *NonRetriableError) Error() string
type ProfileReconciler ¶ added in v0.21.0
type ProfileReconciler struct { client.Client Scheme *runtime.Scheme ConcurrentReconciles int Logger logr.Logger // use a Mutex to update Map as MaxConcurrentReconciles is higher than one Mux sync.Mutex // key: Set; value: set of Profiles currently referencing the Set SetMap map[corev1.ObjectReference]*libsveltosset.Set // key: Sveltos/Cluster; value: set of all Profiles matching the Cluster ClusterMap map[corev1.ObjectReference]*libsveltosset.Set // key: Profile; value Profile Selector Profiles map[corev1.ObjectReference]libsveltosv1beta1.Selector // For each cluster contains current labels // This is needed in following scenario: // - Profile is created // - Cluster is created with labels matching Profile // - When first control plane machine in such cluster becomes available // we need Cluster labels to know which Profile to reconcile ClusterLabels map[corev1.ObjectReference]map[string]string // contains filtered or unexported fields }
ProfileReconciler reconciles a Profile object
func (*ProfileReconciler) GetController ¶ added in v0.26.0
func (r *ProfileReconciler) GetController() controller.Controller
func (*ProfileReconciler) SetupWithManager ¶ added in v0.21.0
func (r *ProfileReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*ProfileReconciler) WatchForCAPI ¶ added in v0.21.0
func (r *ProfileReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
type ReportMode ¶
type ReportMode int
const ( // Default mode. In this mode, addon-controller running // in the management cluster periodically collects/processes // ResourceSummaries from Sveltos/CAPI Clusters CollectFromManagementCluster ReportMode = iota // In this mode, drift detection manager sends ResourceSummaries // updates to management cluster. AgentSendUpdatesNoGateway )
type SetReconciler ¶ added in v0.26.0
type SetReconciler struct { client.Client Scheme *runtime.Scheme ConcurrentReconciles int Logger logr.Logger // use a Mutex to update Map as MaxConcurrentReconciles is higher than one Mux sync.Mutex // key: Sveltos/Cluster; value: set of all Sets matching the Cluster ClusterMap map[corev1.ObjectReference]*libsveltosset.Set // key: Set; value: set of Sveltos/CAPI Clusters matched SetMap map[corev1.ObjectReference]*libsveltosset.Set // key: Sets; value Set Selector Sets map[corev1.ObjectReference]libsveltosv1beta1.Selector // For each cluster contains current labels // This is needed in following scenario: // - Set is created // - Cluster is created with labels matching Set // - When first control plane machine in such cluster becomes available // we need Cluster labels to know which Set to reconcile ClusterLabels map[corev1.ObjectReference]map[string]string // contains filtered or unexported fields }
SetReconciler reconciles a Set object
func (*SetReconciler) GetController ¶ added in v0.26.0
func (r *SetReconciler) GetController() controller.Controller
func (*SetReconciler) SetupWithManager ¶ added in v0.26.0
func (r *SetReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*SetReconciler) WatchForCAPI ¶ added in v0.26.0
func (r *SetReconciler) WatchForCAPI(mgr ctrl.Manager, c controller.Controller) error
Source Files ¶
- clusterprofile_controller.go
- clusterprofile_predicates.go
- clusterprofile_transformations.go
- clusterset_controller.go
- clusterset_transformations.go
- clustersummary_controller.go
- clustersummary_deployer.go
- clustersummary_features.go
- clustersummary_predicates.go
- clustersummary_transformations.go
- clustersummary_watchers.go
- conflicts.go
- drift-detection-utils.go
- flux_source.go
- handlers_helm.go
- handlers_kustomize.go
- handlers_resources.go
- handlers_utils.go
- labels.go
- lua_utils.go
- management_cluster.go
- metrics.go
- profile_controller.go
- profile_transformation_common.go
- profile_transformations.go
- profile_utils.go
- reloader_utils.go
- resourcesummary.go
- resourcesummary_collection.go
- set_controller.go
- set_transformations.go
- set_utils.go
- template_instantiation.go
- templateresourcedef_utils.go
- utils.go
- validate_health.go