|
36 | 36 | ) |
37 | 37 |
|
38 | 38 | type Config struct { |
39 | | - Masters map[string]string |
| 39 | + Masters []string |
40 | 40 | KubeConfig string |
41 | 41 | DryRun bool |
42 | 42 | LogFormat string |
@@ -120,11 +120,8 @@ Example: |
120 | 120 | app.Version(version + "\nbuild time: " + buildstamp + "\nGit ref: " + githash) |
121 | 121 | app.DefaultEnvars() |
122 | 122 |
|
123 | | - // initialize Masters map to avoid nil map assignment |
124 | | - cfg.Masters = make(map[string]string) |
125 | | - |
126 | 123 | // 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) |
128 | 125 | app.Flag("kubeconfig", "Retrieve target cluster configuration from a Kubernetes configuration file (default: auto-detect)").Default(defaultConfig.KubeConfig).StringVar(&cfg.KubeConfig) |
129 | 126 | app.Flag("use-platform-credentials", "Use Platform credentials (default: disabled)").BoolVar(&cfg.UsePlatformCredentials) |
130 | 127 | 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 { |
203 | 200 | } |
204 | 201 | log.Debugf("use config file %s", kubeconfig) |
205 | 202 | 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) |
208 | 205 | } |
209 | 206 | return clients |
210 | 207 | } |
|
0 commit comments