Skip to content

Commit

Permalink
add deprecation warnings for auto detecting cloud providers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsykim committed Aug 25, 2017
1 parent a235ba4 commit fd86022
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cmd/kubelet/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down Expand Up @@ -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).")
Expand Down
4 changes: 4 additions & 0 deletions cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions pkg/kubelet/apis/kubeletconfig/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,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
Expand Down

0 comments on commit fd86022

Please sign in to comment.