Add DisableCloudProviders FG

FeatureGate acts as a secondary switch to disable cloud-controller loops
in KCM, Kubelet and KAPI.

Provide comprehensive logging information to users, so they will be
guided in adoption of out-of-tree cloud provider implementation.
This commit is contained in:
Danil-Grigorev
2021-03-11 13:39:25 +01:00
parent 7705b300e2
commit 5d57b3794c
5 changed files with 62 additions and 4 deletions

View File

@@ -19,7 +19,9 @@ package app
import (
"fmt"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/features"
"k8s.io/client-go/informers"
cloudprovider "k8s.io/cloud-provider"
@@ -32,6 +34,14 @@ func createCloudProvider(cloudProvider string, externalCloudVolumePlugin string,
var cloud cloudprovider.Interface
var loopMode ControllerLoopMode
var err error
if utilfeature.DefaultFeatureGate.Enabled(features.DisableCloudProviders) && cloudprovider.IsDeprecatedInternal(cloudProvider) {
cloudprovider.DisableWarningForProvider(cloudProvider)
return nil, ExternalLoops, fmt.Errorf(
"cloud provider %q was specified, but built-in cloud providers are disabled. Please set --cloud-provider=external and migrate to an external cloud provider",
cloudProvider)
}
if cloudprovider.IsExternal(cloudProvider) {
loopMode = ExternalLoops
if externalCloudVolumePlugin == "" {