mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Merge pull request #28258 from vishh/28231
Automatic merge from submit-queue [kubelet] Allow opting out of automatic cloud provider detection in kubelet. By default kubelet will auto-detect cloud providers fixes #28231
This commit is contained in:
@@ -339,12 +339,16 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) {
|
||||
glog.Warningf("No API client: %v", err)
|
||||
}
|
||||
|
||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
if s.CloudProvider == options.AutoDetectCloudProvider {
|
||||
kcfg.AutoDetectCloudProvider = true
|
||||
} else {
|
||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
||||
kcfg.Cloud = cloud
|
||||
}
|
||||
glog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
||||
kcfg.Cloud = cloud
|
||||
}
|
||||
|
||||
if kcfg.CAdvisorInterface == nil {
|
||||
@@ -773,6 +777,7 @@ type KubeletConfig struct {
|
||||
Address net.IP
|
||||
AllowPrivileged bool
|
||||
Auth server.AuthInterface
|
||||
AutoDetectCloudProvider bool
|
||||
Builder KubeletBuilder
|
||||
CAdvisorInterface cadvisor.Interface
|
||||
VolumeStatsAggPeriod time.Duration
|
||||
@@ -920,6 +925,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
|
||||
kc.ImageGCPolicy,
|
||||
kc.DiskSpacePolicy,
|
||||
kc.Cloud,
|
||||
kc.AutoDetectCloudProvider,
|
||||
kc.NodeLabels,
|
||||
kc.NodeStatusUpdateFrequency,
|
||||
kc.OSInterface,
|
||||
|
||||
Reference in New Issue
Block a user