From 87232fd4ddbd17ec5eda7c6f4098e9fe6a86aec2 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 1 Feb 2023 12:41:35 +0200 Subject: [PATCH] flux tree: Set CRDs GroupKind in output Signed-off-by: Stefan Prodan --- cmd/flux/tree_kustomization.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/flux/tree_kustomization.go b/cmd/flux/tree_kustomization.go index 59dd3dd3..3d9bc370 100644 --- a/cmd/flux/tree_kustomization.go +++ b/cmd/flux/tree_kustomization.go @@ -298,12 +298,13 @@ func getHelmReleaseInventory(ctx context.Context, objectKey client.ObjectKey, ku fmt.Sprintf("%s/name", helmv2.GroupVersion.Group): hr.GetName(), fmt.Sprintf("%s/namespace", helmv2.GroupVersion.Group): hr.GetNamespace(), } + crdKind := "CustomResourceDefinition" var list apiextensionsv1.CustomResourceDefinitionList if err := kubeClient.List(ctx, &list, selector); err == nil { for _, crd := range list.Items { found := false for _, r := range result { - if r.Name == crd.GetName() && r.GroupKind == crd.GroupVersionKind().GroupKind() { + if r.Name == crd.GetName() && r.GroupKind.Kind == crdKind { found = true break } @@ -311,8 +312,11 @@ func getHelmReleaseInventory(ctx context.Context, objectKey client.ObjectKey, ku if !found { result = append(result, object.ObjMetadata{ - Name: crd.GetName(), - GroupKind: crd.GroupVersionKind().GroupKind(), + Name: crd.GetName(), + GroupKind: schema.GroupKind{ + Group: apiextensionsv1.GroupName, + Kind: crdKind, + }, }) } }