mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Report error when illegal values are provided for configType and overrideType
This commit is contained in:
parent
9516ade5c4
commit
d127ef5a44
@ -273,6 +273,32 @@ func (az *Cloud) initializeCloudFromConfig(config *Config, fromSecret bool) erro
|
||||
config.VMType = vmTypeStandard
|
||||
}
|
||||
|
||||
if config.OverrideType == "" {
|
||||
// The default override type is secretOverrideTypeCan.
|
||||
config.OverrideType = secretOverrideTypeCan
|
||||
} else {
|
||||
supportedOverrideTypes := sets.NewString(
|
||||
string(secretOverrideTypeCan),
|
||||
string(secretOverrideTypeMust),
|
||||
string(secretOverrideTypeNo))
|
||||
if !supportedOverrideTypes.Has(string(config.OverrideType)) {
|
||||
return fmt.Errorf("overrideType %v is not supported, supported values are %v", config.OverrideType, supportedOverrideTypes.List())
|
||||
}
|
||||
}
|
||||
|
||||
if config.ConfigType == "" {
|
||||
// The default config type is secretConfigureAll.
|
||||
config.ConfigType = secretConfigureAll
|
||||
} else {
|
||||
supportedConfigTypes := sets.NewString(
|
||||
string(secretConfigureAll),
|
||||
string(secretConfigureNode),
|
||||
string(secretConfigureControlPlane))
|
||||
if !supportedConfigTypes.Has(string(config.ConfigType)) {
|
||||
return fmt.Errorf("configType %v is not supported, supported values are %v", config.ConfigType, supportedConfigTypes.List())
|
||||
}
|
||||
}
|
||||
|
||||
env, err := auth.ParseAzureEnvironment(config.Cloud)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
Loading…
Reference in New Issue
Block a user