mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
only log cloud provider deprecation warning for in-tree components
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
This commit is contained in:
parent
56ad0cefbd
commit
ed3feac74d
@ -228,6 +228,8 @@ func CreateNodeDialer(s completedServerRunOptions) (tunneler.Tunneler, *http.Tra
|
|||||||
if len(s.SSHUser) > 0 {
|
if len(s.SSHUser) > 0 {
|
||||||
// Get ssh key distribution func, if supported
|
// Get ssh key distribution func, if supported
|
||||||
var installSSHKey tunneler.InstallSSHKey
|
var installSSHKey tunneler.InstallSSHKey
|
||||||
|
|
||||||
|
cloudprovider.DeprecationWarningForProvider(s.CloudProvider.CloudProvider)
|
||||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider.CloudProvider, s.CloudProvider.CloudConfigFile)
|
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider.CloudProvider, s.CloudProvider.CloudConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("cloud provider could not be initialized: %v", err)
|
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)
|
cloud, err = cloudprovider.InitCloudProvider(externalCloudVolumePlugin, cloudConfigFile)
|
||||||
} else {
|
} else {
|
||||||
|
cloudprovider.DeprecationWarningForProvider(cloudProvider)
|
||||||
|
|
||||||
loopMode = IncludeCloudLoops
|
loopMode = IncludeCloudLoops
|
||||||
cloud, err = cloudprovider.InitCloudProvider(cloudProvider, cloudConfigFile)
|
cloud, err = cloudprovider.InitCloudProvider(cloudProvider, cloudConfigFile)
|
||||||
}
|
}
|
||||||
|
@ -520,6 +520,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, featureGate f
|
|||||||
|
|
||||||
if kubeDeps.Cloud == nil {
|
if kubeDeps.Cloud == nil {
|
||||||
if !cloudprovider.IsExternal(s.CloudProvider) {
|
if !cloudprovider.IsExternal(s.CloudProvider) {
|
||||||
|
cloudprovider.DeprecationWarningForProvider(s.CloudProvider)
|
||||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -91,6 +91,22 @@ func IsExternal(name string) bool {
|
|||||||
return name == externalCloudProvider
|
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.
|
// InitCloudProvider creates an instance of the named cloud provider.
|
||||||
func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
||||||
var cloud Interface
|
var cloud Interface
|
||||||
@ -106,18 +122,6 @@ func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
|||||||
return nil, nil
|
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 != "" {
|
if configFilePath != "" {
|
||||||
var config *os.File
|
var config *os.File
|
||||||
config, err = os.Open(configFilePath)
|
config, err = os.Open(configFilePath)
|
||||||
|
Loading…
Reference in New Issue
Block a user