@@ -178,8 +178,14 @@ func (d *deployer) verifyKopsFlags() error {
178178 klog .Infof ("Using cluster name: %v" , d .ClusterName )
179179 }
180180
181- if d .KopsBinaryPath == "" && d .KopsVersionMarker == "" {
182- return errors .New ("missing required --kops-binary-path when --kops-version-marker is not used" )
181+ if d .KopsBinaryPath == "" && d .KopsVersionMarker == "" && d .KopsVersion == "" {
182+ return errors .New ("atleast one of --kops-binary-path, --kops-version-marker, --kops-version must be set" )
183+ }
184+ if d .KopsVersionMarker != "" && d .KopsVersion != "" {
185+ return errors .New ("you can't set kops-version-marker and kops-version at the same time" )
186+ }
187+ if d .KopsBinaryPath != "" && (d .KopsVersion != "" || d .KopsVersionMarker != "" ) {
188+ return errors .New ("you can't set kops-binary-path with kops-version-marker or kops-version at the same time" )
183189 }
184190
185191 if d .ControlPlaneCount == 0 {
@@ -220,7 +226,8 @@ func (d *deployer) env() []string {
220226 }
221227 }
222228
223- if d .CloudProvider == "aws" {
229+ switch d .CloudProvider {
230+ case "aws" :
224231 // Pass through some env vars if set
225232 for _ , k := range []string {"AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE" , "AWS_CONTAINER_CREDENTIALS_FULL_URI" , "AWS_PROFILE" , "AWS_SHARED_CREDENTIALS_FILE" } {
226233 v := os .Getenv (k )
@@ -231,7 +238,7 @@ func (d *deployer) env() []string {
231238 // Recognized by the e2e framework
232239 // https://github.com/kubernetes/kubernetes/blob/a750d8054a6cb3167f495829ce3e77ab0ccca48e/test/e2e/framework/ssh/ssh.go#L59-L62
233240 vars = append (vars , fmt .Sprintf ("KUBE_SSH_KEY_PATH=%v" , d .SSHPrivateKeyPath ))
234- } else if d . CloudProvider == "azure" {
241+ case "azure" :
235242 // Pass through some env vars if set
236243 for _ , k := range []string {"AZURE_TENANT_ID" , "AZURE_SUBSCRIPTION_ID" , "AZURE_CLIENT_ID" , "AZURE_FEDERATED_TOKEN_FILE" , "AZURE_STORAGE_ACCOUNT" } {
237244 v := os .Getenv (k )
@@ -241,7 +248,7 @@ func (d *deployer) env() []string {
241248 klog .Warningf ("Azure env var %q not found or empty" , k )
242249 }
243250 }
244- } else if d . CloudProvider == "digitalocean" {
251+ case "digitalocean" :
245252 // Pass through some env vars if set
246253 for _ , k := range []string {"DIGITALOCEAN_ACCESS_TOKEN" , "S3_ACCESS_KEY_ID" , "S3_SECRET_ACCESS_KEY" } {
247254 v := os .Getenv (k )
@@ -251,7 +258,7 @@ func (d *deployer) env() []string {
251258 klog .Warningf ("DO env var %q not found or empty" , k )
252259 }
253260 }
254- } else if d . CloudProvider == "gce" {
261+ case "gce" :
255262 if d .GCPProject != "" {
256263 vars = append (vars , fmt .Sprintf ("GCP_PROJECT=%v" , d .GCPProject ))
257264 }
0 commit comments