diff --git a/src/common/k8s-api/kube-api.ts b/src/common/k8s-api/kube-api.ts index 3df8f3216f..d1e2a2c7ca 100644 --- a/src/common/k8s-api/kube-api.ts +++ b/src/common/k8s-api/kube-api.ts @@ -394,16 +394,12 @@ export class KubeApi< } getUrl({ name, namespace }: Partial = {}, query?: Partial) { - if (!this.isNamespaced && namespace) { - throw new Error("Tried to delete cluster scoped resource in a namespace"); - } - const resourcePath = createKubeApiURL({ apiPrefix: this.apiPrefix, apiVersion: this.apiVersionWithGroup, resource: this.apiResource, namespace: this.isNamespaced - ? namespace || "default" + ? namespace ?? "default" // allow `""` to mean all namespaces : undefined, name, }); @@ -612,6 +608,8 @@ export class KubeApi< watchId = `${this.kind.toLowerCase()}-${this.watchId++}`, } = opts ?? {}; + console.log(`watching ${this.apiBase} in namespace="${namespace}"`); + // Create AbortController for this request const abortController = new WrappedAbortController(opts?.abortController);