From 0ed873d91e0fbdeafd8ee1af006913bd05cd1fcf Mon Sep 17 00:00:00 2001 From: Joaquim Rocha Date: Tue, 26 Sep 2023 17:52:33 +0100 Subject: [PATCH] frontend: Fix regression when applying resources We started using the "apis" prefix when applying resources but need also to distinguish when "api" is needed. --- frontend/src/lib/k8s/apiProxy.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/k8s/apiProxy.ts b/frontend/src/lib/k8s/apiProxy.ts index 1fcab46418..5beeb8c3dc 100644 --- a/frontend/src/lib/k8s/apiProxy.ts +++ b/frontend/src/lib/k8s/apiProxy.ts @@ -562,7 +562,12 @@ async function resourceDefToApiFactory( // this way we always get the right plural name and we also avoid eventually getting // the wrong "known" resource because e.g. there can be CustomResources with the same // kind as a known resource. - const apiResult: APIResourceList = await request(`/apis/${resourceDef.apiVersion}`, {}, false); + const apiPrefix = !!apiGroup ? 'apis' : 'api'; + const apiResult: APIResourceList = await request( + `/${apiPrefix}/${resourceDef.apiVersion}`, + {}, + false + ); if (!apiResult) { throw new Error(`Unkown apiVersion: ${resourceDef.apiVersion}`); }