Skip to content

Commit

Permalink
Master -> Control Plane
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <vincepri@vmware.com>
  • Loading branch information
vincepri committed Jan 17, 2019
1 parent 752e0b5 commit b194e87
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/client/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ import (
)

var (
kubeconfig, masterURL string
log = logf.RuntimeLog.WithName("client").WithName("config")
kubeconfig, controlPlaneURL string
log = logf.RuntimeLog.WithName("client").WithName("config")
)

func init() {
// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
flag.StringVar(&kubeconfig, "kubeconfig", "",
"Paths to a kubeconfig. Only required if out-of-cluster.")

flag.StringVar(&masterURL, "master", "",
"The address of the Kubernetes API server. Overrides any value in kubeconfig. "+
// This flag is deprecated, it'll be removed in a future iteration, please switch to --kubeconfig.
flag.StringVar(&controlPlaneURL, "master", "",
"(Deprecated: switch to `--kubeconfig`) The address of the Kubernetes API server. Overrides any value in kubeconfig. "+
"Only required if out-of-cluster.")
}

// GetConfig creates a *rest.Config for talking to a Kubernetes apiserver.
// GetConfig creates a *rest.Config for talking to a Kubernetes API server.
// If --kubeconfig is set, will use the kubeconfig file at that location. Otherwise will assume running
// in cluster and use the cluster provided kubeconfig.
//
Expand All @@ -59,11 +60,11 @@ func init() {
func GetConfig() (*rest.Config, error) {
// If a flag is specified with the config location, use that
if len(kubeconfig) > 0 {
return clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
return clientcmd.BuildConfigFromFlags(controlPlaneURL, kubeconfig)
}
// If an env variable is specified with the config locaiton, use that
if len(os.Getenv("KUBECONFIG")) > 0 {
return clientcmd.BuildConfigFromFlags(masterURL, os.Getenv("KUBECONFIG"))
return clientcmd.BuildConfigFromFlags(controlPlaneURL, os.Getenv("KUBECONFIG"))
}
// If no explicit location, try the in-cluster config
if c, err := rest.InClusterConfig(); err == nil {
Expand Down

0 comments on commit b194e87

Please sign in to comment.