Skip to content

Commit

Permalink
CLOUDP-186825: Add deletion protection to deployments
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Vazquez <[email protected]>
  • Loading branch information
josvazg committed Aug 17, 2023
1 parent adc58c2 commit 369cf3d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/controller/atlasdeployment/atlasdeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,19 @@ func (r *AtlasDeploymentReconciler) checkDeploymentIsManaged(
project *mdbv1.AtlasProject,
deployment *mdbv1.AtlasDeployment,
) workflow.Result {
dply := deployment
advancedDeployment := deployment
if deployment.IsLegacyDeployment() {
dply = deployment.DeepCopy()
if err := ConvertLegacyDeployment(&dply.Spec); err != nil {
advancedDeployment = deployment.DeepCopy()
if err := ConvertLegacyDeployment(&advancedDeployment.Spec); err != nil {
result := workflow.Terminate(workflow.Internal, err.Error())
log.Errorw("failed to temporary convert legacy deployment", "error", err)
return result
}
dply.Spec.DeploymentSpec = nil
advancedDeployment.Spec.DeploymentSpec = nil
}

owner, err := customresource.IsOwner(
dply,
advancedDeployment,
r.ObjectDeletionProtection,
customresource.IsResourceManagedByOperator,
managedByAtlas(context, workflowCtx.Client, project.ID(), log),
Expand Down

0 comments on commit 369cf3d

Please sign in to comment.