Skip to content

Commit 339e946

Browse files
committed
feat:remove master flag
1 parent add0b64 commit 339e946

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

pkg/client/config/config.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,14 @@ import (
3030
)
3131

3232
var (
33-
kubeconfig, apiServerURL string
34-
log = logf.RuntimeLog.WithName("client").WithName("config")
33+
kubeconfig string
34+
log = logf.RuntimeLog.WithName("client").WithName("config")
3535
)
3636

3737
func init() {
3838
// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
3939
flag.StringVar(&kubeconfig, "kubeconfig", "",
4040
"Paths to a kubeconfig. Only required if out-of-cluster.")
41-
42-
// This flag is deprecated, it'll be removed in a future iteration, please switch to --kubeconfig.
43-
flag.StringVar(&apiServerURL, "master", "",
44-
"(Deprecated: switch to `--kubeconfig`) The address of the Kubernetes API server. Overrides any value in kubeconfig. "+
45-
"Only required if out-of-cluster.")
4641
}
4742

4843
// GetConfig creates a *rest.Config for talking to a Kubernetes API server.
@@ -105,7 +100,7 @@ func loadConfig(context string) (*rest.Config, error) {
105100

106101
// If a flag is specified with the config location, use that
107102
if len(kubeconfig) > 0 {
108-
return loadConfigWithContext(apiServerURL, &clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfig}, context)
103+
return loadConfigWithContext("", &clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfig}, context)
109104
}
110105

111106
// If the recommended kubeconfig env variable is not specified,
@@ -134,7 +129,7 @@ func loadConfig(context string) (*rest.Config, error) {
134129
loadingRules.Precedence = append(loadingRules.Precedence, path.Join(u.HomeDir, clientcmd.RecommendedHomeDir, clientcmd.RecommendedFileName))
135130
}
136131

137-
return loadConfigWithContext(apiServerURL, loadingRules, context)
132+
return loadConfigWithContext("", loadingRules, context)
138133
}
139134

140135
func loadConfigWithContext(apiServerURL string, loader clientcmd.ClientConfigLoader, context string) (*rest.Config, error) {

pkg/client/config/config_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030

3131
type testCase struct {
3232
text string
33-
apiServerURL string
3433
context string
3534
kubeconfigFlag string
3635
kubeconfigEnv []string
@@ -56,7 +55,6 @@ var _ = Describe("Config", func() {
5655
AfterEach(func() {
5756
os.Unsetenv(clientcmd.RecommendedConfigPathEnvVar)
5857
kubeconfig = ""
59-
apiServerURL = ""
6058
clientcmd.RecommendedHomeFile = origRecommendedHomeFile
6159

6260
err := os.RemoveAll(dir)
@@ -158,12 +156,6 @@ var _ = Describe("Config", func() {
158156
kubeconfigEnv: []string{"kubeconfig-multi-context"},
159157
wantHost: "from-multi-env-1",
160158
},
161-
{
162-
text: "should allow overriding the API server URL",
163-
apiServerURL: "override",
164-
kubeconfigEnv: []string{"kubeconfig-multi-context"},
165-
wantHost: "override",
166-
},
167159
{
168160
text: "should allow overriding the context",
169161
context: "from-multi-env-2",
@@ -183,9 +175,6 @@ var _ = Describe("Config", func() {
183175
})
184176

185177
func setConfigs(tc testCase, dir string) {
186-
// Set API Server URL
187-
apiServerURL = tc.apiServerURL
188-
189178
// Set kubeconfig flag value
190179
if len(tc.kubeconfigFlag) > 0 {
191180
kubeconfig = filepath.Join(dir, tc.kubeconfigFlag)

0 commit comments

Comments
 (0)