From 7130d1acc2638c4ed7c76141811f5f04ed2e1102 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 25 Apr 2018 18:02:30 -0400 Subject: [PATCH] client-go should not take a dependency on the v1 api lightly These constants will never change, and tools/ should not be depending on core/api/v1 (there is nothing v1 specific about them). Kubernetes-commit: aa9fd2bf11ae6be922b5b0fe45f5254c40366b2e --- tools/clientcmd/client_config.go | 3 +-- tools/clientcmd/merged_client_builder.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/clientcmd/client_config.go b/tools/clientcmd/client_config.go index 93e99a94..66331a7a 100644 --- a/tools/clientcmd/client_config.go +++ b/tools/clientcmd/client_config.go @@ -27,7 +27,6 @@ import ( "github.com/golang/glog" "github.com/imdario/mergo" - "k8s.io/api/core/v1" restclient "k8s.io/client-go/rest" clientauth "k8s.io/client-go/tools/auth" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" @@ -338,7 +337,7 @@ func (config *DirectClientConfig) Namespace() (string, bool, error) { } if len(configContext.Namespace) == 0 { - return v1.NamespaceDefault, false, nil + return "default", false, nil } return configContext.Namespace, false, nil diff --git a/tools/clientcmd/merged_client_builder.go b/tools/clientcmd/merged_client_builder.go index 3f02111b..05038133 100644 --- a/tools/clientcmd/merged_client_builder.go +++ b/tools/clientcmd/merged_client_builder.go @@ -22,7 +22,6 @@ import ( "github.com/golang/glog" - "k8s.io/api/core/v1" restclient "k8s.io/client-go/rest" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) @@ -145,7 +144,7 @@ func (config *DeferredLoadingClientConfig) Namespace() (string, bool, error) { if len(ns) > 0 { // if we got a non-default namespace from the kubeconfig, use it - if ns != v1.NamespaceDefault { + if ns != "default" { return ns, false, nil }