Skip to content

Commit

Permalink
refine clean logic (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojingchen authored Aug 5, 2019
1 parent 6b9cc3a commit c348598
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,12 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterConfig) error {

setStr := label.New().Instance(info.ClusterName).String()

// delete all jobs
allJobsSet := label.Label{}.Instance(info.ClusterName).String()
if res, err := exec.Command("kubectl", "delete", "jobs", "-n", info.Namespace, "-l", allJobsSet).CombinedOutput(); err != nil {
return fmt.Errorf("failed to delete jobs: %v, %s", err, string(res))
}

resources := []string{"pvc"}
for _, resource := range resources {
if res, err := exec.Command("kubectl", "delete", resource, "-n", info.Namespace, "-l",
Expand All @@ -627,12 +633,6 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterConfig) error {
}
}

// delete all jobs
allJobsSet := label.Label{}.Instance(info.ClusterName).String()
if res, err := exec.Command("kubectl", "delete", "jobs", "-n", info.Namespace, "-l", allJobsSet).CombinedOutput(); err != nil {
return fmt.Errorf("failed to delete jobs: %v, %s", err, string(res))
}

// delete all configmaps
allConfigMaps := label.New().Instance(info.ClusterName).String()
if res, err := exec.Command("kubectl", "delete", "configmaps", "-n", info.Namespace, "-l", allConfigMaps).CombinedOutput(); err != nil {
Expand Down

0 comments on commit c348598

Please sign in to comment.