@@ -140,10 +140,16 @@ func deleteOldDataJobs(ctx *context.Context) error {
140140}
141141
142142func DeleteApp (appName string , keepCache bool ) bool {
143- deployments , _ := config .Kubernetes .ListDeploymentsByLabel ("appName" , appName )
144- for _ , deployment := range deployments {
145- config .Kubernetes .DeleteDeployment (deployment .Name )
143+ wasDeployed := false
144+ if ctx := CurrentContext (appName ); ctx != nil {
145+ updateKilledDataSavedStatuses (ctx )
146+ wasDeployed = true
146147 }
148+
149+ deleteCurrentContext (appName )
150+ uncacheDataSavedStatuses (nil , appName )
151+ uncacheLatestWorkloadIDs (nil , appName )
152+
147153 ingresses , _ := config .Kubernetes .ListIngressesByLabel ("appName" , appName )
148154 for _ , ingress := range ingresses {
149155 config .Kubernetes .DeleteIngress (ingress .Name )
@@ -164,17 +170,11 @@ func DeleteApp(appName string, keepCache bool) bool {
164170 for _ , sparkApp := range sparkApps {
165171 config .Spark .Delete (sparkApp .Name )
166172 }
167-
168- wasDeployed := false
169- if ctx := CurrentContext (appName ); ctx != nil {
170- updateKilledDataSavedStatuses (ctx )
171- wasDeployed = true
173+ deployments , _ := config .Kubernetes .ListDeploymentsByLabel ("appName" , appName )
174+ for _ , deployment := range deployments {
175+ config .Kubernetes .DeleteDeployment (deployment .Name )
172176 }
173177
174- deleteCurrentContext (appName )
175- uncacheDataSavedStatuses (nil , appName )
176- uncacheLatestWorkloadIDs (nil , appName )
177-
178178 if ! keepCache {
179179 config .AWS .DeleteFromS3ByPrefix (filepath .Join (consts .AppsDir , appName ), true )
180180 }
0 commit comments