Documentation ¶
Index ¶
- Constants
- Variables
- func ClusterPredicates(logger logr.Logger) predicate.Funcs
- func ConfigMapPredicates(logger logr.Logger) predicate.Funcs
- func GetClusterSummaryName(clusterProfileName, clusterName string) string
- func InitScheme() (*runtime.Scheme, error)
- func MachinePredicates(logger logr.Logger) predicate.Funcs
- func RegisterFeatures(d deployer.DeployerInterface, setupLog logr.Logger)
- func SecretPredicates(logger logr.Logger) predicate.Funcs
- func SetManagementClusterAccess(c client.Client, config *rest.Config)
- type ClusterProfileReconciler
- type ClusterSummaryReconciler
- type Set
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-feature-name" // ReferenceLabelKind is added to each policy deployed by a ClusterSummary // instance to a CAPI Cluster. Indicates the Kind (ConfigMap or Secret) // containing the policy. ReferenceLabelKind = "projectsveltos.io/reference-kind" // ReferenceLabelName is added to each policy deployed by a ClusterSummary // instance to a CAPI Cluster. Indicates the name of the ConfigMap/Secret // containing the policy. ReferenceLabelName = "projectsveltos.io/reference-name" // ReferenceLabelNamespace is added to each policy deployed by a ClusterSummary // instance to a CAPI Cluster. Indicates the namespace of the ConfigMap/Secret // containing the policy. ReferenceLabelNamespace = "projectsveltos.io/reference-namespace" // clusterLabelNamespace is the label set on ClusterSummary instances created // by a ClusterProfile instance for a given cluster ClusterLabelNamespace = "projectsveltos.io/cluster-namespace" // clusterLabelName is the label set on ClusterSummary instances created // by a ClusterProfile instance for a given cluster ClusterLabelName = "projectsveltos.io/cluster-name" // PolicyTemplate is the annotation that must be set on a policy when the // policy is a template and needs variable sustitution. PolicyTemplate = "projectsveltos.io/template" // PolicyHash is the annotation set on a policy when deployed in a CAPI // cluster. PolicyHash = "projectsveltos.io/hash" )
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 ClusterPredicates ¶
ClusterPredicates predicates for v1Cluster. ClusterProfileReconciler watches v1Cluster events and react to those by reconciling itself based on following predicates
func ConfigMapPredicates ¶
ConfigMapPredicates predicates for ConfigMaps. ClusterSummaryReconciler watches ConfigMap events and react to those by reconciling itself based on following predicates
func GetClusterSummaryName ¶
GetClusterSummaryName returns the ClusterSummary name given a ClusterProfile name and CAPI cluster Namespace/Name. This method does not guarantee that name is not already in use. Caller of this method needs to handle that scenario
func InitScheme ¶
func MachinePredicates ¶
MachinePredicates predicates for v1Machine. ClusterProfileReconciler 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 ¶
SecretPredicates predicates for Secrets. ClusterSummaryReconciler watches Secret events and react to those by reconciling itself based on following predicates
Types ¶
type ClusterProfileReconciler ¶
type ClusterProfileReconciler struct { client.Client Scheme *runtime.Scheme ConcurrentReconciles int // use a Mutex to update Map as MaxConcurrentReconciles is higher than one Mux sync.Mutex // key: CAPI Cluster namespace/name; value: set of all ClusterProfiles matching the Cluster ClusterMap map[configv1alpha1.PolicyRef]*Set // key: ClusterProfile; value: set of CAPI Clusters matched ClusterProfileMap map[configv1alpha1.PolicyRef]*Set // key: ClusterProfile; value ClusterProfile Selector ClusterProfiles map[configv1alpha1.PolicyRef]configv1alpha1.Selector }
ClusterProfileReconciler reconciles a ClusterProfile object
func (*ClusterProfileReconciler) SetupWithManager ¶
func (r *ClusterProfileReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ClusterSummaryReconciler ¶
type ClusterSummaryReconciler struct { *rest.Config client.Client Scheme *runtime.Scheme Deployer deployer.DeployerInterface ConcurrentReconciles int PolicyMux sync.Mutex // use a Mutex to update Map as MaxConcurrentReconciles is higher than one ReferenceMap map[configv1alpha1.PolicyRef]*Set // key: Referenced object; value: set of all ClusterSummaries referencing the resource ClusterSummaryMap map[types.NamespacedName]*Set // key: ClusterSummary namespace/name; value: set of referenced resources }
ClusterSummaryReconciler reconciles a ClusterSummary object
func (*ClusterSummaryReconciler) SetupWithManager ¶
func (r *ClusterSummaryReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
Source Files ¶
- clusterprofile_controller.go
- clusterprofile_predicates.go
- clusterprofile_transformations.go
- clustersummary_controller.go
- clustersummary_deployer.go
- clustersummary_features.go
- clustersummary_predicates.go
- clustersummary_transformations.go
- handlers_helm.go
- handlers_resources.go
- handlers_utils.go
- labels.go
- management_cluster.go
- set.go
- template_utils.go
- utils.go