提交 26329c63 编写于 作者: S Sebastian Florek 提交者: GitHub

Fix cascading delete (#1941)

* Fix cascading delete

* Fix test
上级 61898538
......@@ -17,8 +17,8 @@ package common
import (
"fmt"
api "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
api "k8s.io/client-go/pkg/api/v1"
restclient "k8s.io/client-go/rest"
)
......@@ -82,9 +82,9 @@ func (verber *ResourceVerber) Delete(kind string, namespaceSet bool, namespace s
client := verber.getRESTClientByType(resourceSpec.ClientType)
// Do cascade delete by default, as this is what users typically expect.
defaultOrphanDependents := false
defaultPropagationPolicy := api.DeletePropagationForeground
defaultDeleteOptions := &api.DeleteOptions{
OrphanDependents: &defaultOrphanDependents,
PropagationPolicy: &defaultPropagationPolicy,
}
req := client.Delete().
......
......@@ -11,7 +11,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
api "k8s.io/client-go/pkg/api/v1"
restclient "k8s.io/client-go/rest"
)
......@@ -31,7 +30,7 @@ func (c *FakeRESTClient) Delete() *restclient.Request {
groupVersion := schema.GroupVersion{Group: "meta.k8s.io", Version: "v1"}
scheme.AddKnownTypes(groupVersion, &api.DeleteOptions{})
scheme.AddKnownTypes(groupVersion, &metaV1.DeleteOptions{})
factory := runtimeserializer.NewCodecFactory(scheme)
codec := testapi.TestCodec(factory, metaV1.SchemeGroupVersion)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册