Merge pull request #47138 from smarterclayton/delete_collection

Automatic merge from submit-queue (batch tested with PRs 46979, 47078, 47138, 46916)

DeleteCollection should include uninitialized resources

Users who delete a collection expect all resources to be deleted, and
users can also delete an uninitialized resource. To preserve this
expectation, DeleteCollection selects all resources regardless of
initialization.

The namespace controller should list uninitialized resources in order to
gate cleanup of a namespace.

Fixes #47137
This commit is contained in:
Kubernetes Submit Queue
2017-06-07 19:01:47 -07:00
committed by GitHub
5 changed files with 127 additions and 6 deletions

View File

@@ -379,7 +379,7 @@ func (d *namespacedResourcesDeleter) listCollection(
}
apiResource := metav1.APIResource{Name: gvr.Resource, Namespaced: true}
obj, err := dynamicClient.Resource(&apiResource, namespace).List(metav1.ListOptions{})
obj, err := dynamicClient.Resource(&apiResource, namespace).List(metav1.ListOptions{IncludeUninitialized: true})
if err == nil {
unstructuredList, ok := obj.(*unstructured.UnstructuredList)
if !ok {
@@ -553,7 +553,7 @@ func (d *namespacedResourcesDeleter) estimateGracefulTerminationForPods(ns strin
if podsGetter == nil || reflect.ValueOf(podsGetter).IsNil() {
return estimate, fmt.Errorf("unexpected: podsGetter is nil. Cannot estimate grace period seconds for pods")
}
items, err := podsGetter.Pods(ns).List(metav1.ListOptions{})
items, err := podsGetter.Pods(ns).List(metav1.ListOptions{IncludeUninitialized: true})
if err != nil {
return estimate, err
}