mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #91539 from andrewsykim/fix-cloud-provider-deprecation
only log cloud provider deprecation warning for in-tree components
This commit is contained in:
commit
2d327ac455
@ -242,6 +242,8 @@ func CreateNodeDialer(s completedServerRunOptions) (tunneler.Tunneler, *http.Tra
|
||||
if len(s.SSHUser) > 0 {
|
||||
// Get ssh key distribution func, if supported
|
||||
var installSSHKey tunneler.InstallSSHKey
|
||||
|
||||
cloudprovider.DeprecationWarningForProvider(s.CloudProvider.CloudProvider)
|
||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider.CloudProvider, s.CloudProvider.CloudConfigFile)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("cloud provider could not be initialized: %v", err)
|
||||
|
@ -41,6 +41,8 @@ func createCloudProvider(cloudProvider string, externalCloudVolumePlugin string,
|
||||
}
|
||||
cloud, err = cloudprovider.InitCloudProvider(externalCloudVolumePlugin, cloudConfigFile)
|
||||
} else {
|
||||
cloudprovider.DeprecationWarningForProvider(cloudProvider)
|
||||
|
||||
loopMode = IncludeCloudLoops
|
||||
cloud, err = cloudprovider.InitCloudProvider(cloudProvider, cloudConfigFile)
|
||||
}
|
||||
|
@ -523,6 +523,7 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
|
||||
|
||||
if kubeDeps.Cloud == nil {
|
||||
if !cloudprovider.IsExternal(s.CloudProvider) {
|
||||
cloudprovider.DeprecationWarningForProvider(s.CloudProvider)
|
||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -91,6 +91,22 @@ func IsExternal(name string) bool {
|
||||
return name == externalCloudProvider
|
||||
}
|
||||
|
||||
func DeprecationWarningForProvider(providerName string) {
|
||||
for _, provider := range deprecatedCloudProviders {
|
||||
if provider.name != providerName {
|
||||
continue
|
||||
}
|
||||
|
||||
detail := provider.detail
|
||||
if provider.external {
|
||||
detail = fmt.Sprintf("Please use 'external' cloud provider for %s: %s", providerName, provider.detail)
|
||||
}
|
||||
|
||||
klog.Warningf("WARNING: %s built-in cloud provider is now deprecated. %s", providerName, detail)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// InitCloudProvider creates an instance of the named cloud provider.
|
||||
func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
||||
var cloud Interface
|
||||
@ -105,18 +121,6 @@ func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
for _, provider := range deprecatedCloudProviders {
|
||||
if provider.name == name {
|
||||
detail := provider.detail
|
||||
if provider.external {
|
||||
detail = fmt.Sprintf("Please use 'external' cloud provider for %s: %s", name, provider.detail)
|
||||
}
|
||||
klog.Warningf("WARNING: %s built-in cloud provider is now deprecated. %s", name, detail)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if configFilePath != "" {
|
||||
var config *os.File
|
||||
config, err = os.Open(configFilePath)
|
||||
|
Loading…
Reference in New Issue
Block a user