@@ -29,21 +29,22 @@ import (
29
29
)
30
30
31
31
var (
32
- kubeconfig , masterURL string
33
- log = logf .RuntimeLog .WithName ("client" ).WithName ("config" )
32
+ kubeconfig , controlPlaneURL string
33
+ log = logf .RuntimeLog .WithName ("client" ).WithName ("config" )
34
34
)
35
35
36
36
func init () {
37
37
// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
38
38
flag .StringVar (& kubeconfig , "kubeconfig" , "" ,
39
39
"Paths to a kubeconfig. Only required if out-of-cluster." )
40
40
41
- flag .StringVar (& masterURL , "master" , "" ,
42
- "The address of the Kubernetes API server. Overrides any value in kubeconfig. " +
41
+ // This flag is deprecated, it'll be removed in a future iteration, please switch to --kubeconfig.
42
+ flag .StringVar (& controlPlaneURL , "master" , "" ,
43
+ "(Deprecated: switch to `--kubeconfig`) The address of the Kubernetes API server. Overrides any value in kubeconfig. " +
43
44
"Only required if out-of-cluster." )
44
45
}
45
46
46
- // GetConfig creates a *rest.Config for talking to a Kubernetes apiserver .
47
+ // GetConfig creates a *rest.Config for talking to a Kubernetes API server .
47
48
// If --kubeconfig is set, will use the kubeconfig file at that location. Otherwise will assume running
48
49
// in cluster and use the cluster provided kubeconfig.
49
50
//
@@ -59,11 +60,11 @@ func init() {
59
60
func GetConfig () (* rest.Config , error ) {
60
61
// If a flag is specified with the config location, use that
61
62
if len (kubeconfig ) > 0 {
62
- return clientcmd .BuildConfigFromFlags (masterURL , kubeconfig )
63
+ return clientcmd .BuildConfigFromFlags (controlPlaneURL , kubeconfig )
63
64
}
64
65
// If an env variable is specified with the config locaiton, use that
65
66
if len (os .Getenv ("KUBECONFIG" )) > 0 {
66
- return clientcmd .BuildConfigFromFlags (masterURL , os .Getenv ("KUBECONFIG" ))
67
+ return clientcmd .BuildConfigFromFlags (controlPlaneURL , os .Getenv ("KUBECONFIG" ))
67
68
}
68
69
// If no explicit location, try the in-cluster config
69
70
if c , err := rest .InClusterConfig (); err == nil {
0 commit comments