Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions controllers/handlers_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func undeployHelmChartsInPullMode(ctx context.Context, c client.Client, clusterS
if err != nil {
return err
}
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureHelm, profileRef, nil, true)
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureHelm, profileRef, nil, false, true)

// If charts have pre/post delete hooks, those need to be deployed. A ConfigurationGroup to deploy those
// is created. If this does not exist yet assume we still have to deploy those.
Expand Down Expand Up @@ -5314,7 +5314,7 @@ func commitStagedResourcesForDeployment(ctx context.Context, clusterSummary *con
}

// if a stale helm release is being deleted, run the pre/post delete checks
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureHelm, profileRef, configurationHash, len(staleReleases) != 0)
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureHelm, profileRef, configurationHash, true, len(staleReleases) != 0)
// Commit deployment
return pullmode.CommitStagedResourcesForDeployment(ctx, getManagementClusterClient(),
clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, configv1beta1.ClusterSummaryKind,
Expand Down
2 changes: 1 addition & 1 deletion controllers/handlers_kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func processKustomizeDeployment(ctx context.Context, remoteRestConfig *rest.Conf

if isPullMode {
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureKustomize, profileRef,
configurationHash, false)
configurationHash, true, false)
err = pullmode.CommitStagedResourcesForDeployment(ctx, c,
clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, configv1beta1.ClusterSummaryKind,
clusterSummary.Name, string(libsveltosv1beta1.FeatureKustomize),
Expand Down
4 changes: 2 additions & 2 deletions controllers/handlers_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func postProcessDeployedResources(ctx context.Context, remoteRestConfig *rest.Co

if isPullMode {
setters := prepareSetters(clusterSummary, libsveltosv1beta1.FeatureResources, profileRef,
configurationHash, false)
configurationHash, true, false)
err = pullmode.CommitStagedResourcesForDeployment(ctx, c,
clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, configv1beta1.ClusterSummaryKind,
clusterSummary.Name, string(libsveltosv1beta1.FeatureResources),
Expand Down Expand Up @@ -500,7 +500,7 @@ func pullModeUndeployResources(ctx context.Context, c client.Client, clusterSumm
return err
}

setters := prepareSetters(clusterSummary, fID, profileRef, nil, true)
setters := prepareSetters(clusterSummary, fID, profileRef, nil, false, true)

// discard all previous staged resources. This will instruct agent to undeploy
err = pullmode.RemoveDeployedResources(ctx, c, clusterSummary.Spec.ClusterNamespace,
Expand Down
9 changes: 5 additions & 4 deletions controllers/handlers_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ func getPatchesHash(ctx context.Context, clusterSummary *configv1beta1.ClusterSu
}

func prepareSetters(clusterSummary *configv1beta1.ClusterSummary, featureID libsveltosv1beta1.FeatureID,
profileRef *corev1.ObjectReference, configurationHash []byte, includeDeleteChecks bool) []pullmode.Option {
profileRef *corev1.ObjectReference, configurationHash []byte, includeDeployChecks, includeDeleteChecks bool) []pullmode.Option {

setters := make([]pullmode.Option, 0)
if clusterSummary.Spec.ClusterProfileSpec.SyncMode == configv1beta1.SyncModeContinuousWithDriftDetection {
Expand Down Expand Up @@ -1604,11 +1604,12 @@ func prepareSetters(clusterSummary *configv1beta1.ClusterSummary, featureID libs
setters = append(setters, pullmode.WithTier(clusterSummary.Spec.ClusterProfileSpec.Tier),
pullmode.WithContinueOnConflict(clusterSummary.Spec.ClusterProfileSpec.ContinueOnConflict),
pullmode.WithContinueOnError(clusterSummary.Spec.ClusterProfileSpec.ContinueOnError),
pullmode.WithPreDeployChecks(clusterSummary.Spec.ClusterProfileSpec.PreDeployChecks),
pullmode.WithDeployedGVKs(gvks))

if clusterSummary.DeletionTimestamp.IsZero() {
setters = append(setters, pullmode.WithValidateHealths(clusterSummary.Spec.ClusterProfileSpec.ValidateHealths))
if includeDeployChecks {
setters = append(setters,
pullmode.WithPreDeployChecks(clusterSummary.Spec.ClusterProfileSpec.PreDeployChecks),
pullmode.WithValidateHealths(clusterSummary.Spec.ClusterProfileSpec.ValidateHealths))
}

if includeDeleteChecks {
Expand Down
Loading