Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions util/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ func GetLiveResource(dclient dynamic.Interface, obj *unstructured.Unstructured,
return liveObj, nil
}

func IsCRDGroupVersionKind(gvk schema.GroupVersionKind) bool {
return gvk.Kind == CustomResourceDefinitionKind && gvk.Group == "apiextensions.k8s.io"
}

func IsCRD(obj *unstructured.Unstructured) bool {
return obj.GroupVersionKind().Kind == CustomResourceDefinitionKind && obj.GroupVersionKind().Group == "apiextensions.k8s.io"
return IsCRDGroupVersionKind(obj.GroupVersionKind())
}

func WatchResourcesWithLabel(ctx context.Context, config *rest.Config, namespace string, labelName string) (chan watch.Event, error) {
Expand Down Expand Up @@ -399,7 +403,7 @@ func DeleteResourceWithLabel(config *rest.Config, namespace string, labelName st
return err
}

if deleteCollectionSupported || deleteSupported {
if deleteCollectionSupported || deleteSupported && !IsCRDGroupVersionKind(schema.FromAPIVersionAndKind(apiResourcesList.GroupVersion, apiResource.Kind)) {
resourceInterfaces = append(resourceInterfaces, resClient{
dclient.Resource(&apiResource, namespace),
deleteCollectionSupported,
Expand Down