Merge pull request #51312 from andrewsykim/50986
Automatic merge from submit-queue (batch tested with PRs 50932, 49610, 51312, 51415, 50705) Deprecation warnings for auto detecting cloud providers **What this PR does / why we need it**: Adds deprecation warnings for auto detecting cloud providers. As part of the initiative for out-of-tree cloud providers, this feature is conflicting since we're shifting the dependency of kubernetes core into cAdvisor. In the future kubelets should be using `--cloud-provider=external` or no cloud provider at all. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #50986 **Special notes for your reviewer**: NOTE: I still have to coordinate with sig-node and kubernetes-dev to get approval for this deprecation, I'm only opening this PR since we're close to code freeze and it's something presentable. **Release note**: ```release-note Deprecate auto detecting cloud providers in kubelet. Auto detecting cloud providers go against the initiative for out-of-tree cloud providers as we'll now depend on cAdvisor integrations with cloud providers instead of the core repo. In the near future, `--cloud-provider` for kubelet will either be an empty string or `external`. ```
This commit is contained in:
		| @@ -121,8 +121,12 @@ func NewKubeletFlags() *KubeletFlags { | ||||
| 		KubeConfig:              flag.NewStringFlag("/var/lib/kubelet/kubeconfig"), | ||||
| 		ContainerRuntimeOptions: *NewContainerRuntimeOptions(), | ||||
| 		CertDirectory:           "/var/run/kubernetes", | ||||
| 		CloudProvider:           v1alpha1.AutoDetectCloudProvider, | ||||
| 		RootDirectory:           v1alpha1.DefaultRootDir, | ||||
| 		// DEPRECATED: auto detecting cloud providers goes against the initiative | ||||
| 		// for out-of-tree cloud providers as we'll now depend on cAdvisor integrations | ||||
| 		// with cloud providers instead of in the core repo. | ||||
| 		// More details here: https://github.com/kubernetes/kubernetes/issues/50986 | ||||
| 		CloudProvider: v1alpha1.AutoDetectCloudProvider, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -220,7 +224,7 @@ func (f *KubeletFlags) AddFlags(fs *pflag.FlagSet) { | ||||
| 	fs.StringVar(&f.CertDirectory, "cert-dir", f.CertDirectory, "The directory where the TLS certs are located. "+ | ||||
| 		"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.") | ||||
|  | ||||
| 	fs.StringVar(&f.CloudProvider, "cloud-provider", f.CloudProvider, "The provider for cloud services. By default, kubelet will attempt to auto-detect the cloud provider. Specify empty string for running with no cloud provider.") | ||||
| 	fs.StringVar(&f.CloudProvider, "cloud-provider", f.CloudProvider, "The provider for cloud services. By default, kubelet will attempt to auto-detect the cloud provider (deprecated). Specify empty string for running with no cloud provider, this will be the default in upcoming releases.") | ||||
| 	fs.StringVar(&f.CloudConfigFile, "cloud-config", f.CloudConfigFile, "The path to the cloud provider configuration file.  Empty string for no configuration file.") | ||||
|  | ||||
| 	fs.StringVar(&f.RootDirectory, "root-dir", f.RootDirectory, "Directory path for managing kubelet files (volume mounts,etc).") | ||||
|   | ||||
| @@ -283,6 +283,10 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies) (err error) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if s.CloudProvider == kubeletconfigv1alpha1.AutoDetectCloudProvider { | ||||
| 		glog.Warning("--cloud-provider=auto-detect is deprecated. The desired cloud provider should be set explicitly") | ||||
| 	} | ||||
|  | ||||
| 	if kubeDeps.Cloud == nil { | ||||
| 		if !cloudprovider.IsExternal(s.CloudProvider) && s.CloudProvider != kubeletconfigv1alpha1.AutoDetectCloudProvider { | ||||
| 			cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile) | ||||
|   | ||||
| @@ -32,6 +32,10 @@ import ( | ||||
| const ( | ||||
| 	DefaultRootDir = "/var/lib/kubelet" | ||||
|  | ||||
| 	// DEPRECATED: auto detecting cloud providers goes against the initiative | ||||
| 	// for out-of-tree cloud providers as we'll now depend on cAdvisor integrations | ||||
| 	// with cloud providers instead of in the core repo. | ||||
| 	// More details here: https://github.com/kubernetes/kubernetes/issues/50986 | ||||
| 	AutoDetectCloudProvider = "auto-detect" | ||||
|  | ||||
| 	defaultIPTablesMasqueradeBit = 14 | ||||
|   | ||||
| @@ -965,7 +965,11 @@ type Kubelet struct { | ||||
| 	volumeManager volumemanager.VolumeManager | ||||
|  | ||||
| 	// Cloud provider interface. | ||||
| 	cloud                   cloudprovider.Interface | ||||
| 	cloud cloudprovider.Interface | ||||
| 	// DEPRECATED: auto detecting cloud providers goes against the initiative | ||||
| 	// for out-of-tree cloud providers as we'll now depend on cAdvisor integrations | ||||
| 	// with cloud providers instead of in the core repo. | ||||
| 	// More details here: https://github.com/kubernetes/kubernetes/issues/50986 | ||||
| 	autoDetectCloudProvider bool | ||||
| 	// Indicates that the node initialization happens in an external cloud controller | ||||
| 	externalCloudProvider bool | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue