delete replicaset when delete namespace

This commit is contained in:
mqliang
2016-02-11 15:58:01 +08:00
parent 62e574341c
commit 4f24ea65f2
2 changed files with 12 additions and 1 deletions

View File

@@ -184,6 +184,12 @@ func deleteAllContent(kubeClient clientset.Interface, versions *unversioned.APIV
return estimate, err
}
}
if containsResource(resources, "replicasets") {
err = deleteReplicaSets(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
}
}
return estimate, nil
}
@@ -343,6 +349,10 @@ func deleteDeployments(expClient extensions_unversioned.ExtensionsInterface, ns
return expClient.Deployments(ns).DeleteCollection(nil, api.ListOptions{})
}
func deleteReplicaSets(expClient extensions_unversioned.ExtensionsInterface, ns string) error {
return expClient.ReplicaSets(ns).DeleteCollection(nil, api.ListOptions{})
}
func deleteIngress(expClient extensions_unversioned.ExtensionsInterface, ns string) error {
return expClient.Ingresses(ns).DeleteCollection(nil, api.ListOptions{})
}