From 09608eeb6e98f20b694375aaf27883bd2fb219c1 Mon Sep 17 00:00:00 2001 From: valorl <11498571+valorl@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:31:52 +0200 Subject: [PATCH] fix: use correct GVK when discovering resources The assignment of GroupVersion as Group results in invalid request URIs with a duplicate version element, resulting in 404s. (cherry picked from commit 8f87f0eb051f8ca801ca43615fe4c77bb5efed25) --- kubernetes/resource_kubectl_manifest.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kubernetes/resource_kubectl_manifest.go b/kubernetes/resource_kubectl_manifest.go index 78883227..cbfe34a8 100644 --- a/kubernetes/resource_kubectl_manifest.go +++ b/kubernetes/resource_kubectl_manifest.go @@ -866,8 +866,9 @@ func checkAPIResourceIsPresent(available []*meta_v1.APIResourceList, resource me group := rList.GroupVersion for _, r := range rList.APIResources { if group == resource.GroupVersionKind().GroupVersion().String() && r.Kind == resource.GetKind() { - r.Group = rList.GroupVersion - r.Kind = rList.Kind + r.Group = resource.GroupVersionKind().Group + r.Version = resource.GroupVersionKind().Version + r.Kind = resource.GroupVersionKind().Kind return &r, true } }