// ConfirmUsable looks a particular context and determines if that particular part of the config is useable. There might still be errors in the config,
@@ -153,5 +150,4 @@ func BindContextFlags(contextInfo *clientcmdapi.Context, flags *pflag.FlagSet, f
flags.StringVar(&contextInfo.Cluster,flagNames.ClusterName,"","The name of the kubeconfig cluster to use")
flags.StringVar(&contextInfo.AuthInfo,flagNames.AuthInfoName,"","The name of the kubeconfig user to use")
flags.StringVarP(&contextInfo.Namespace,flagNames.Namespace,flagNames.NamespaceShort,"","If present, the namespace scope for this CLI request.")
flags.StringVar(&contextInfo.NamespacePath,flagNames.NamespacePath,"","Path to the namespace info file that holds the namespace context to use for CLI requests.")
// TODO remove once people have been given enough time to notice
funcNewCmdNamespace(outio.Writer)*cobra.Command{
cmd:=&cobra.Command{
Use:"namespace [<namespace>]",
Short:"Set and view the current Kubernetes namespace",
Long:`Set and view the current Kubernetes namespace scope for command line requests.
A Kubernetes namespace subdivides the cluster into groups of logically related pods, services, and replication controllers.
Examples:
$ kubectl namespace
Using namespace default
Short:"SUPERCEDED: Set and view the current Kubernetes namespace",
Long:`SUPERCEDED: Set and view the current Kubernetes namespace scope for command line requests.
$ kubectl namespace other
Set current namespace to other`,
namespace has been superceded by the context.namespace field of .kubeconfig files. See 'kubectl config set-context --help' for more details.
`,
Run:func(cmd*cobra.Command,args[]string){
nsPath:=GetFlagString(cmd,"ns-path")
varerrerror
varns*kubectl.NamespaceInfo
switchlen(args){
case0:
ns,err=kubectl.LoadNamespaceInfo(nsPath)
fmt.Printf("Using namespace %s\n",ns.Namespace)
case1:
ns=&kubectl.NamespaceInfo{Namespace:args[0]}
err=kubectl.SaveNamespaceInfo(nsPath,ns)
fmt.Printf("Set current namespace to %s\n",ns.Namespace)
default:
usageError(cmd,"kubectl namespace [<namespace>]")
}
checkErr(err)
glog.Errorln("namespace has been superceded by the context.namespace field of .kubeconfig files. See 'kubectl config set-context --help' for more details.")