clusterops

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
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

This section is empty.

Functions

func ConvertHelmResourcesToObjectReference

func ConvertHelmResourcesToObjectReference(helmResources []libsveltosv1beta1.HelmResources,
) []corev1.ObjectReference

ConvertHelmResourcesToObjectReference converts a slice of HelmResources to a slice of ObjectReference

func ConvertResourceReportsToObjectReference

func ConvertResourceReportsToObjectReference(resourceReports []libsveltosv1beta1.ResourceReport,
) []corev1.ObjectReference

ConvertResourceReportsToObjectReference converts a slice of ResourceReports to a slice of ObjectReference

func FetchJobManifest added in v1.14.0

func FetchJobManifest(ctx context.Context, mgmtClient client.Client, clusterNamespace, clusterName string,
	clusterType libsveltosv1beta1.ClusterType, jobRef *libsveltosv1beta1.PolicyRef, logger logr.Logger) (*batchv1.Job, error)

FetchJobManifest resolves jobRef (Cluster-field templating on namespace/name, same as any other referenced resource) and decodes the referenced ConfigMap/Secret's content into a Job. It fails if the referenced resource does not contain exactly one valid Job manifest.

This has no proprietary logic of its own - it's a plain read plus the same libsveltos/lib/template resolution every other PolicyRef-style reference already uses - so, unlike running a JobCheck (which does require a Sveltos Enterprise license), fetching the manifest does not. Used both by ResolveJobChecksForPullMode below (addon-controller resolving a Job to stage for sveltos-applier to run in pull mode - itself gated by the pull-mode cluster-count license check, not a JobHealthCheck-specific one) and by the Sveltos Enterprise JobCheck Validator (push mode, after its own separate license check).

func GetClusterReportName

func GetClusterReportName(profileKind, profileName, clusterName string, clusterType libsveltosv1beta1.ClusterType) string

func GetClusterSummary

func GetClusterSummary(ctx context.Context, c client.Client,
	profileKind, profileName string, clusterNamespace, clusterName string,
	clusterType libsveltosv1beta1.ClusterType) (*configv1beta1.ClusterSummary, error)

GetClusterSummary returns the ClusterSummary instance created by a specific ClusterProfile/Profile for a specific Cluster

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 GetPrefix

func GetPrefix(clusterType libsveltosv1beta1.ClusterType) string

func GetReloaderName added in v1.12.0

func GetReloaderName(profileName string, feature libsveltosv1beta1.FeatureID) string

GetReloaderName returns the name used for a Reloader instance created for a given profile and feature.

func GetResourceSummaryNameInManagedCluster

func GetResourceSummaryNameInManagedCluster(clusterSummaryNamespace, clusterSummaryName string) string

func GetResourceSummaryNameInManagemntCluster

func GetResourceSummaryNameInManagemntCluster(clusterSummaryName string) string

func GetResourceSummaryNamespaceInManagedCluster

func GetResourceSummaryNamespaceInManagedCluster(sveltosNamespacxe string) string

func IsReloaderInstalled

func IsReloaderInstalled(ctx context.Context, c client.Client) (bool, error)

IsReloaderInstalled returns true if Reloader CRD is installed, false otherwise

func ResolveJobChecksForPullMode added in v1.14.0

func ResolveJobChecksForPullMode(ctx context.Context, mgmtClient client.Client,
	clusterSummary *configv1beta1.ClusterSummary,
	checks []libsveltosv1beta1.ValidateHealth, logger logr.Logger) (map[string]string, error)

ResolveJobChecksForPullMode resolves every JobCheck entry in checks (fetching JobRef's ConfigMap/Secret and applying Cluster-field templating, via FetchJobManifest - no license check: see FetchJobManifest's comment) and returns the resolved manifests as YAML, keyed by "<job namespace>/<job name>" - ready to stage onto a ConfigurationGroup's PreDeployCheckJobs/ValidateHealthJobs/PreDeleteCheckJobs/PostDeleteCheckJobs field. Returns an empty, non-nil map when checks has no JobCheck entries.

func SetJobHealthCheckValidator added in v1.14.0

func SetJobHealthCheckValidator(fn func(ctx context.Context, deps JobHealthCheckDeps,
	check *libsveltosv1beta1.ValidateHealth, logger logr.Logger) error)

SetJobHealthCheckValidator overrides the JobCheck implementation. Called by a Sveltos Enterprise build's composition root before starting the manager; this package never imports anything private itself.

func UpdateClusterConfiguration

func UpdateClusterConfiguration(ctx context.Context, c client.Client, isDryRun, clean bool,
	clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType,
	profileRef *corev1.ObjectReference, featureID libsveltosv1beta1.FeatureID,
	policyDeployed []configv1beta1.DeployedResource, chartDeployed []configv1beta1.Chart) error

No action in DryRun mode.

func UpdateClusterReportWithResourceReports

func UpdateClusterReportWithResourceReports(ctx context.Context, c client.Client,
	clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType, isDryRun bool,
	profileRef *corev1.ObjectReference, resourceReports []libsveltosv1beta1.ResourceReport,
	featureID libsveltosv1beta1.FeatureID) error

UpdateClusterReportWithResourceReports updates ClusterReport Status with ResourceReports. This is no-op unless mode is DryRun

func UpdateReloaderWithDeployedResources

func UpdateReloaderWithDeployedResources(ctx context.Context, reloaderClient client.Client,
	profileRef *corev1.ObjectReference, feature libsveltosv1beta1.FeatureID,
	resources []corev1.ObjectReference, removeReloader bool,
	logger logr.Logger) error

UpdateReloaderWithDeployedResources updates corresponding Reloader instance in the managed cluster. Reload indicates whether reloader instance needs to be removed, which can happen because ClusterSummary is being deleted or ClusterProfile.Spec.Reloader is set to false.

func ValidateHealthPolicies

func ValidateHealthPolicies(ctx context.Context, mgmtClient client.Client, clusterSummary *configv1beta1.ClusterSummary,
	sveltosNamespace string, remoteConfig *rest.Config, validateHealths []libsveltosv1beta1.ValidateHealth,
	featureID libsveltosv1beta1.FeatureID, isDelete bool, logger logr.Logger) error

ValidateHealthPolicies runs all validateDeployment checks registered for the feature (Helm/Kustomize/Resources)

Types

type HealthCheckError added in v1.6.0

type HealthCheckError struct {
	FeatureID   libsveltosv1beta1.FeatureID
	CheckName   string
	InternalErr error
}

func (*HealthCheckError) Error added in v1.6.0

func (e *HealthCheckError) Error() string

func (*HealthCheckError) Unwrap added in v1.6.0

func (e *HealthCheckError) Unwrap() error

type JobHealthCheckDeps added in v1.14.0

type JobHealthCheckDeps struct {
	MgmtClient       client.Client
	ClusterSummary   *configv1beta1.ClusterSummary
	SveltosNamespace string
	RemoteConfig     *rest.Config
}

JobHealthCheckDeps bundles what the Sveltos Enterprise JobHealthCheck implementation needs.

Jump to

Keyboard shortcuts

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