Merge pull request #3550 from fluxcd/fix-tree-crds

flux tree: Set CRDs GroupKind in output
pull/3545/head
Stefan Prodan 2 years ago committed by GitHub
commit 176444263c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}
@ -312,7 +313,10 @@ func getHelmReleaseInventory(ctx context.Context, objectKey client.ObjectKey, ku
if !found {
result = append(result, object.ObjMetadata{
Name: crd.GetName(),
GroupKind: crd.GroupVersionKind().GroupKind(),
GroupKind: schema.GroupKind{
Group: apiextensionsv1.GroupName,
Kind: crdKind,
},
})
}
}

Loading…
Cancel
Save