From fa2000745a9916bbf6066895ef4dabaf45258414 Mon Sep 17 00:00:00 2001 From: Shawn Hurley Date: Tue, 6 Nov 2018 16:04:08 -0500 Subject: [PATCH] pkg/k8sutil,cmd/up/local: Fixing kubeconfig environment variable. (#705) --- commands/operator-sdk/cmd/up/local.go | 2 ++ pkg/k8sutil/constants.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/operator-sdk/cmd/up/local.go b/commands/operator-sdk/cmd/up/local.go index b712f2255a..7355e149cf 100644 --- a/commands/operator-sdk/cmd/up/local.go +++ b/commands/operator-sdk/cmd/up/local.go @@ -126,6 +126,8 @@ func upLocal() { } func upLocalAnsible() { + // Set the kubeconfig that the manager will be able to grab + os.Setenv(k8sutil.KubeConfigEnvVar, kubeConfig) mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{Namespace: namespace}) if err != nil { log.Fatal(err) diff --git a/pkg/k8sutil/constants.go b/pkg/k8sutil/constants.go index d5b75cd39e..0ac85c02cc 100644 --- a/pkg/k8sutil/constants.go +++ b/pkg/k8sutil/constants.go @@ -15,9 +15,9 @@ package k8sutil const ( - // KubeConfigEnvVar defines the env variable KUBERNETES_CONFIG which + // KubeConfigEnvVar defines the env variable KUBECONFIG which // contains the kubeconfig file path. - KubeConfigEnvVar = "KUBERNETES_CONFIG" + KubeConfigEnvVar = "KUBECONFIG" // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE // which is the namespace that the pod is currently running in.