Skip to content

Commit

Permalink
Don't fallback to automatic noopDelete if cluster is set
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com>
  • Loading branch information
praveenrewar committed May 30, 2023
1 parent 1297080 commit a843001
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/app/app_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ func (a *App) delete(changedFunc func(exec.CmdRunResult)) exec.CmdRunResult {

var result exec.CmdRunResult

appResourcesInSameNs := a.app.Status.Deploy != nil && a.app.Status.Deploy.KappDeployStatus != nil &&
len(a.app.Status.Deploy.KappDeployStatus.AssociatedResources.Namespaces) == 1 &&
a.app.Status.Deploy.KappDeployStatus.AssociatedResources.Namespaces[0] == a.app.Namespace

// Use noopDelete if the namespace is terminating and app resources are in same namespace because
// the app resources will be automatically deleted including the kapp ServiceAccount
noopDelete := a.isNamespaceTerminating() && a.app.Status.Deploy != nil && a.app.Status.Deploy.KappDeployStatus != nil &&
len(a.app.Status.Deploy.KappDeployStatus.AssociatedResources.Namespaces) == 1
noopDelete := a.isNamespaceTerminating() && appResourcesInSameNs && a.app.Spec.Cluster == nil

if !a.app.Spec.NoopDelete && !noopDelete {
for _, dep := range a.app.Spec.Deploy {
Expand Down

0 comments on commit a843001

Please sign in to comment.