Documentation
¶
Index ¶
- func CommitStagedResourcesForDeployment(ctx context.Context, c client.Client, ...) error
- func DiscardStagedResourcesForDeployment(ctx context.Context, c client.Client, ...) error
- func GetClusterLabels(clusterNamespace, clusterName string) map[string]string
- func GetDeploymentStatus(ctx context.Context, c client.Client, ...) (*libsveltosv1beta1.ConfigurationGroupStatus, error)
- func GetRemoveStatus(ctx context.Context, c client.Client, ...) (*libsveltosv1beta1.ConfigurationGroupStatus, error)
- func GetRequestorFeature(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
- func GetRequestorHash(ctx context.Context, c client.Client, ...) ([]byte, error)
- func GetRequestorKind(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
- func GetRequestorName(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
- func GetSourceStatus(ctx context.Context, c client.Client, ...) (*libsveltosv1beta1.SourceStatus, error)
- func IsActionNotSetToDeploy(err error) bool
- func IsBeingProvisioned(ctx context.Context, c client.Client, ...) bool
- func IsBeingRemoved(ctx context.Context, c client.Client, ...) bool
- func IsProcessingMismatch(err error) bool
- func RecordResourcesForDeployment(ctx context.Context, c client.Client, ...) error
- func RemoveDeployedResources(ctx context.Context, c client.Client, ...) error
- func StageResourcesForDeployment(ctx context.Context, c client.Client, ...) error
- func TerminateDeploymentTracking(ctx context.Context, c client.Client, ...) error
- type ActionNotSetToDeployError
- type BundleOption
- type BundleOptions
- type Option
- func WithAnnotations(annotations map[string]string) Option
- func WithContinueOnConflict(continueOnConflict bool) Option
- func WithContinueOnError(continueOnError bool) Option
- func WithDeployedGVKs(gvks []string) Option
- func WithDriftDetection() Option
- func WithDriftDetectionPatches(driftExclusions []libsveltosv1beta1.DriftExclusion) Option
- func WithDryRun() Option
- func WithLeavePolicies() Option
- func WithMaxConsecutiveFailures(maxConsecutiveFailures uint) Option
- func WithReloader() Option
- func WithRequestorHash(hash []byte) Option
- func WithServiceAccount(namespace, name string) Option
- func WithSourceRef(sourceRef *corev1.ObjectReference) Option
- func WithSourceStatus(sourceStatus libsveltosv1beta1.SourceStatus) Option
- func WithTier(tier int32) Option
- func WithValidateHealths(validateHealths []libsveltosv1beta1.ValidateHealth) Option
- type Options
- type ProcessingMismatchError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitStagedResourcesForDeployment ¶
func CommitStagedResourcesForDeployment(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger, setters ...Option) error
CommitStagedResourcesForDeployment marks the resources that have been previously staged using StageResourcesForDeployment as ready for deployment to the specified SveltosCluster. This method is called by a management cluster component after it has successfully prepared all the necessary resources across potentially multiple calls to StageResourcesForDeployment. Once committed, the agent in the managed cluster will be able to fetch these resources for deployment. - requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method. - clusterNamespace/clusterName identify the target SveltosCluster.
func DiscardStagedResourcesForDeployment ¶
func DiscardStagedResourcesForDeployment(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) error
DiscardStagedResourcesForDeployment removes all resources that have been temporarily stored via calls to StageResourcesForDeployment for a specific component and target cluster. This method is intended to be used when the process of preparing resources fails, effectively canceling the staging operation and preventing these resources from being committed for deployment. - requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method. - clusterNamespace/clusterName identify the target SveltosCluster.
func GetClusterLabels ¶
GetClusterLabels returns a map of labels used to filter ConfigurationGroups for a specific cluster. It takes the cluster namespace and cluster name as input.
func GetDeploymentStatus ¶
func GetDeploymentStatus(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) (*libsveltosv1beta1.ConfigurationGroupStatus, error)
For SveltosClusters operating in pull mode, this method is invoked by components on the management cluster to retrieve the deployment status of managed resources.
func GetRemoveStatus ¶
func GetRemoveStatus(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) (*libsveltosv1beta1.ConfigurationGroupStatus, error)
For SveltosClusters operating in pull mode, this method is invoked by components on the management cluster to retrieve the withdrawal status of managed resources.
func GetRequestorFeature ¶
func GetRequestorFeature(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
GetRequestorFeature returns a string representing the feature that caused the ConfigurationGroup to be created
func GetRequestorHash ¶
func GetRequestorHash(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) ([]byte, error)
GetRequestorHash returns the hash of the requestor at last time configuration for sveltos-applier was created
func GetRequestorKind ¶
func GetRequestorKind(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
func GetRequestorName ¶
func GetRequestorName(configurationGroup *libsveltosv1beta1.ConfigurationGroup) (string, error)
func GetSourceStatus ¶
func GetSourceStatus(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) (*libsveltosv1beta1.SourceStatus, error)
GetSourceStatus retrieves the SourceStatus of the ConfigurationGroup associated with a specific requestor.
This function identifies a ConfigurationGroup using the provided cluster details (namespace, name), requestor details (kind, name, feature), and then extracts its SourceStatus.
Returns:
*libsveltosv1beta1.SourceStatus: A pointer to the SourceStatus of the found ConfigurationGroup.
Returns nil if the ConfigurationGroup is not found or in case of an error.
error: An error if there was a problem retrieving the ConfigurationGroup or its status.
Returns nil if the operation was successful and the status was retrieved (or if the CG was not found).
func IsActionNotSetToDeploy ¶ added in v1.3.0
IsActionNotSetToDeploy checks if an error is a ActionNotSetToDeploy
func IsBeingProvisioned ¶
func IsBeingProvisioned(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) bool
IsBeingProvisioned returns true if content is currently being or has been deployed. A ConfigurationGroup is considered "being provisioned" when it's ready for processing and the requestor hashes match, regardless of whether deployment is complete.
func IsBeingRemoved ¶
func IsBeingRemoved(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) bool
IsBeingRemoved returns true if the ConfigurationGroup is currently being removed or has already been removed. This includes cases where the resource no longer exists or when it's ready for removal processing.
func IsProcessingMismatch ¶
IsProcessingMismatch checks if an error is a ProcessingMismatchError
func RecordResourcesForDeployment ¶
func RecordResourcesForDeployment(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, resources map[string][]unstructured.Unstructured, logger logr.Logger, setters ...Option) error
For SveltosClusters in pull mode, this method is called by management cluster components to register resources intended for deployment. The agent in the managed cluster will subsequently fetch these resources. - requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method. - resources is the list of resources to deploy. - clusterNamespace/clusterName identify the target SveltosCluster.
func RemoveDeployedResources ¶
func RemoveDeployedResources(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger, setters ...Option) error
RemoveDeployedResources marks resources for deletion in the managed cluster. For SveltosClusters in pull mode, this method is called by management cluster components to indicate that previously deployed resources should be removed. The agent in the managed cluster will detect this change and remove the corresponding resources.
- requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method.
- clusterNamespace/clusterName identify the target SveltosCluster.
This method marks the ConfigurationGroup Action field to ActionRemove and removes all referenced ConfigurationBundles, effectively signaling to the agent that all associated resources should be cleaned up from the managed cluster.
func StageResourcesForDeployment ¶
func StageResourcesForDeployment(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, resources map[string][]unstructured.Unstructured, skipTracking bool, logger logr.Logger, setters ...BundleOption) error
StageResourcesForDeployment is called by management cluster components to register resources that are being prepared for deployment to SveltosClusters in pull mode. Unlike RecordResourcesForDeployment, this method does not immediately make the resources available to the agent in the managed cluster. Resources staged via this method will be made available for deployment at a later point (after CommitStagedResourcesForDeployment is called). - requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method. - resources is the list of resources to deploy. - clusterNamespace/clusterName identify the target SveltosCluster.
func TerminateDeploymentTracking ¶
func TerminateDeploymentTracking(ctx context.Context, c client.Client, clusterNamespace, clusterName, requestorKind, requestorName, requestorFeature string, logger logr.Logger) error
TerminateDeploymentTracking permanently removes the internal records associated with a deployment on a managed cluster. This action signifies the end of the tracking and management of resources for a specific deployment, typically after resources have been successfully deployed or removed from the managed cluster or if the deployment attempt is being abandoned.
For SveltosClusters in pull mode, this method is called by management cluster components to finalize the lifecycle of a deployment and clean up the corresponding internal ConfigurationGroup resource.
- requestorKind, requestorName, and requestorFeature uniquely identify the component in the management cluster invoking this method.
- clusterNamespace/clusterName identify the target SveltosCluster for which deployment tracking is being terminated.
This method locates and deletes the ConfigurationGroup resource associated with the specified cluster and requestor.
It returns an error if it fails to locate or delete the ConfigurationGroup.
Types ¶
type ActionNotSetToDeployError ¶ added in v1.3.0
type ActionNotSetToDeployError struct {
Message string
}
func NewActionNotSetToDeploy ¶ added in v1.3.0
func NewActionNotSetToDeploy(msg string) *ActionNotSetToDeployError
NewActionNotSetToDeploy creates a new ActionNotSetToDeploy
func (*ActionNotSetToDeployError) Error ¶ added in v1.3.0
func (e *ActionNotSetToDeployError) Error() string
type BundleOption ¶
type BundleOption func(*BundleOptions)
func WithReleaseInfo ¶
func WithReleaseInfo(namespace, name, repoURL, chartVersion, icon string, uninstall, isLast bool) BundleOption
func WithResourceInfo ¶ added in v1.2.1
func WithResourceInfo(kind, namespace, name string, tier int32) BundleOption
func WithTimeout ¶
func WithTimeout(timeout *metav1.Duration) BundleOption
type BundleOptions ¶
type BundleOptions struct {
Timeout *metav1.Duration
ReleaseNamespace string
ReleaseName string
ChartVersion string
Icon string
RepoURL string
UninstallRealease bool
IsLastHelmReleaseBundle bool
ReferencedObjectKind string
ReferencedObjectNamespace string
ReferencedObjectName string
ReferencedTier int32
}
type Option ¶
type Option func(*Options)
func WithAnnotations ¶
func WithContinueOnConflict ¶
func WithContinueOnError ¶
func WithDeployedGVKs ¶
func WithDriftDetection ¶
func WithDriftDetection() Option
func WithDriftDetectionPatches ¶
func WithDriftDetectionPatches(driftExclusions []libsveltosv1beta1.DriftExclusion) Option
func WithDryRun ¶
func WithDryRun() Option
func WithLeavePolicies ¶
func WithLeavePolicies() Option
func WithReloader ¶
func WithReloader() Option
func WithRequestorHash ¶
func WithServiceAccount ¶
func WithSourceRef ¶
func WithSourceRef(sourceRef *corev1.ObjectReference) Option
func WithSourceStatus ¶
func WithSourceStatus(sourceStatus libsveltosv1beta1.SourceStatus) Option
func WithValidateHealths ¶
func WithValidateHealths(validateHealths []libsveltosv1beta1.ValidateHealth) Option
type Options ¶
type Options struct {
SourceRef *corev1.ObjectReference
SourceStatus libsveltosv1beta1.SourceStatus
Tier int32
DryRun bool
Reloader bool
DriftDetection bool
DriftExclusion []libsveltosv1beta1.DriftExclusion
ContinueOnConflict bool
ContinueOnError bool
MaxConsecutiveFailures *uint
LeavePolicies bool
ValidateHealths []libsveltosv1beta1.ValidateHealth
DeployedGVKs []string
Annotations map[string]string
RequestorHash []byte
ServiceAccount types.NamespacedName
}
type ProcessingMismatchError ¶
type ProcessingMismatchError struct {
Message string
}
ProcessingMismatchError represents an error when the resource has not been fully processed, either due to generation mismatch or requestor hash mismatch, indicating reconciliation is needed.
func NewProcessingMismatchError ¶
func NewProcessingMismatchError(msg string) *ProcessingMismatchError
NewProcessingMismatchError creates a new ProcessingMismatchError
func (*ProcessingMismatchError) Error ¶
func (e *ProcessingMismatchError) Error() string