Skip to content

Commit 06dd4b4

Browse files
committed
Use GroupKind for index instead of GroupVersionKind
Signed-off-by: Matheus Pimenta <[email protected]>
1 parent 8d294e4 commit 06dd4b4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/inventory/inventory.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,26 @@ func parseManifest(manifest string) ([]*unstructured.Unstructured, error) {
7878
// This is necessary because Helm manifests don't include namespace for namespaced resources.
7979
func setNamespaces(objects []*unstructured.Unstructured, releaseNamespace string, c client.Client) []string {
8080
var warnings []string
81-
isNamespacedGVK := map[schema.GroupVersionKind]bool{}
81+
isNamespacedGK := map[schema.GroupKind]bool{}
8282

8383
for _, obj := range objects {
8484
if obj.GetNamespace() != "" {
8585
continue
8686
}
8787

88-
objGVK := obj.GetObjectKind().GroupVersionKind()
89-
if _, ok := isNamespacedGVK[objGVK]; !ok {
88+
objGK := obj.GetObjectKind().GroupVersionKind().GroupKind()
89+
if _, ok := isNamespacedGK[objGK]; !ok {
9090
namespaced, err := apiutil.IsObjectNamespaced(obj, c.Scheme(), c.RESTMapper())
9191
if err != nil {
9292
warnings = append(warnings, fmt.Sprintf(
9393
"failed to determine if %s is namespace scoped, skipping namespace: %s",
94-
objGVK.Kind, err.Error()))
94+
objGK.Kind, err.Error()))
9595
continue
9696
}
97-
isNamespacedGVK[objGVK] = namespaced
97+
isNamespacedGK[objGK] = namespaced
9898
}
9999

100-
if isNamespacedGVK[objGVK] {
100+
if isNamespacedGK[objGK] {
101101
obj.SetNamespace(releaseNamespace)
102102
}
103103
}

0 commit comments

Comments
 (0)