Skip to content

Commit

Permalink
correctly delete app
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiouxme committed Dec 20, 2017
1 parent e7a13f6 commit 353f7ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/oc/admin/diagnostics/diagnostics/cluster/app_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,20 @@ func (d *AppCreate) cleanup() {
func (d *AppCreate) cleanupApp() {
errs := []error{}
d.out.Debug("DCluAC010", fmt.Sprintf("%s: Deleting components of app '%s' if present.", now(), d.appName))
appscmd.NewDeploymentConfigReaper(d.AppsClient, d.KubeClient)

// reap the DC's deployments first
if err := appscmd.NewDeploymentConfigReaper(d.AppsClient, d.KubeClient).Stop(d.project, d.appName, time.Duration(1)*time.Second, nil); err != nil {
errs = append(errs, err)
}

// then delete the DC and its service
if err := d.AppsClient.Apps().DeploymentConfigs(d.project).Delete(d.appName, nil); err != nil {
errs = append(errs, err)
}
if err := d.KubeClient.Core().Services(d.project).Delete(d.appName, nil); err != nil {
errs = append(errs, err)
}

if len(errs) > 0 {
d.out.Debug("DCluAC013", fmt.Sprintf("%s: Deleting components of app '%s' failed: %v", now(), d.appName, errs))
}
Expand Down

0 comments on commit 353f7ec

Please sign in to comment.