Skip to content

Commit 267da59

Browse files
committed
keep old CLI semantic and use master URL as key
1 parent de70e52 commit 267da59

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

main.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var (
3636
)
3737

3838
type Config struct {
39-
Masters map[string]string
39+
Masters []string
4040
KubeConfig string
4141
DryRun bool
4242
LogFormat string
@@ -120,11 +120,8 @@ Example:
120120
app.Version(version + "\nbuild time: " + buildstamp + "\nGit ref: " + githash)
121121
app.DefaultEnvars()
122122

123-
// initialize Masters map to avoid nil map assignment
124-
cfg.Masters = make(map[string]string)
125-
126123
// Flags related to Kubernetes
127-
app.Flag("master", "The Kubernetes API server to connect to (default: auto-detect)").Default("").StringMapVar(&cfg.Masters)
124+
app.Flag("master", "The Kubernetes API server to connect to (default: auto-detect)").Default("").StringsVar(&cfg.Masters)
128125
app.Flag("kubeconfig", "Retrieve target cluster configuration from a Kubernetes configuration file (default: auto-detect)").Default(defaultConfig.KubeConfig).StringVar(&cfg.KubeConfig)
129126
app.Flag("use-platform-credentials", "Use Platform credentials (default: disabled)").BoolVar(&cfg.UsePlatformCredentials)
130127
app.Flag("credentials-dir", "Directory where the Platform credentials are stored (default: /meta/credentials)").Default(auth.DefaultCredentialsDir).Envar(auth.CredentialsDirEnvar).StringVar(&cfg.CredentialsDir)
@@ -203,8 +200,8 @@ func newKubeClients(cfg *Config) map[string]kubernetes.Interface {
203200
}
204201
log.Debugf("use config file %s", kubeconfig)
205202
clients := map[string]kubernetes.Interface{}
206-
for cluster, master := range cfg.Masters {
207-
clients[cluster] = newKubeClient(cfg, master, kubeconfig)
203+
for _, master := range cfg.Masters {
204+
clients[master] = newKubeClient(cfg, master, kubeconfig)
208205
}
209206
return clients
210207
}

0 commit comments

Comments
 (0)