Set default namespace as client override
@@ -400,10 +400,15 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
// Configure client-go using provided or ambient kubeconfig file.
//
+ if defaultNamespace := vars["kubernetes:config:namespace"]; defaultNamespace != "" {
+ k.defaultNamespace = defaultNamespace
+ }
+
// Compute config overrides.
overrides := &clientcmd.ConfigOverrides{
Context: clientapi.Context{
Cluster: vars["kubernetes:config:cluster"],
+ Namespace: k.defaultNamespace,
},
CurrentContext: vars["kubernetes:config:context"],
}
@@ -614,10 +619,6 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
kubeconfig = clientcmd.NewInteractiveDeferredLoadingClientConfig(loadingRules, overrides, os.Stdin)
}
- if defaultNamespace := vars["kubernetes:config:namespace"]; defaultNamespace != "" {
- k.defaultNamespace = defaultNamespace
- }
-
var kubeClientSettings KubeClientSettings
if obj, ok := vars["kubernetes:config:kubeClientSettings"]; ok {
err := json.Unmarshal([]byte(obj), &kubeClientSettings)
