From 991b07e60d460e96bd38b38b76a7211580696f55 Mon Sep 17 00:00:00 2001 From: Jeff Lowdermilk Date: Mon, 22 Aug 2016 15:05:29 -0700 Subject: [PATCH 1/2] Add a feature gate for alpha dynamic volume provisioning Enabled by default to avoid breaking people, since this was turned on in 1.3. --- cmd/kube-controller-manager/app/plugins.go | 3 +++ pkg/util/config/feature_gate.go | 23 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/cmd/kube-controller-manager/app/plugins.go b/cmd/kube-controller-manager/app/plugins.go index 0d0dc539367..f7788c834a2 100644 --- a/cmd/kube-controller-manager/app/plugins.go +++ b/cmd/kube-controller-manager/app/plugins.go @@ -34,6 +34,7 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack" "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" + utilconfig "k8s.io/kubernetes/pkg/util/config" "k8s.io/kubernetes/pkg/util/io" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/aws_ebs" @@ -125,6 +126,8 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen // TODO: remove in Kubernetes 1.5 func NewAlphaVolumeProvisioner(cloud cloudprovider.Interface, config componentconfig.VolumeConfiguration) (volume.ProvisionableVolumePlugin, error) { switch { + case !utilconfig.DefaultFeatureGate.DynamicVolumeProvisioning(): + return nil, nil case cloud == nil && config.EnableHostPathProvisioning: return getProvisionablePluginFromVolumePlugins(host_path.ProbeVolumePlugins( volume.VolumeConfig{ diff --git a/pkg/util/config/feature_gate.go b/pkg/util/config/feature_gate.go index 70f68d35818..a07d1067656 100644 --- a/pkg/util/config/feature_gate.go +++ b/pkg/util/config/feature_gate.go @@ -38,18 +38,20 @@ const ( // specification of gates. Examples: // AllAlpha=false,NewFeature=true will result in newFeature=true // AllAlpha=true,NewFeature=false will result in newFeature=false - allAlphaGate = "AllAlpha" - externalTrafficLocalOnly = "AllowExtTrafficLocalEndpoints" - dynamicKubeletConfig = "DynamicKubeletConfig" + allAlphaGate = "AllAlpha" + externalTrafficLocalOnly = "AllowExtTrafficLocalEndpoints" + dynamicKubeletConfig = "DynamicKubeletConfig" + dynamicVolumeProvisioning = "DynamicVolumeProvisioning" ) var ( // Default values for recorded features. Every new feature gate should be // represented here. knownFeatures = map[string]featureSpec{ - allAlphaGate: {false, alpha}, - externalTrafficLocalOnly: {false, alpha}, - dynamicKubeletConfig: {false, alpha}, + allAlphaGate: {false, alpha}, + externalTrafficLocalOnly: {false, alpha}, + dynamicKubeletConfig: {false, alpha}, + dynamicVolumeProvisioning: {true, alpha}, } // Special handling for a few gates. @@ -93,6 +95,10 @@ type FeatureGate interface { // alpha: v1.4 ExternalTrafficLocalOnly() bool + // owner: @saad-ali + // alpha: v1.3 + DynamicVolumeProvisioning() bool + // TODO: Define accessors for each non-API alpha feature. DynamicKubeletConfig() bool } @@ -173,6 +179,11 @@ func (f *featureGate) DynamicKubeletConfig() bool { return f.lookup(dynamicKubeletConfig) } +// DynamicVolumeProvisioning returns value for dynamicVolumeProvisioning +func (f *featureGate) DynamicVolumeProvisioning() bool { + return f.lookup(dynamicVolumeProvisioning) +} + func (f *featureGate) lookup(key string) bool { defaultValue := f.known[key].enabled if f.enabled != nil { From fe643590ba0e071d786ffb6068df606014584bfd Mon Sep 17 00:00:00 2001 From: Jeff Lowdermilk Date: Tue, 23 Aug 2016 09:46:46 -0700 Subject: [PATCH 2/2] Update/fix feature-gate comments --- pkg/util/config/feature_gate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/util/config/feature_gate.go b/pkg/util/config/feature_gate.go index a07d1067656..71e5e330fe0 100644 --- a/pkg/util/config/feature_gate.go +++ b/pkg/util/config/feature_gate.go @@ -34,14 +34,14 @@ const ( // a featureSpec entry to knownFeatures. // allAlphaGate is a global toggle for alpha features. Per-feature key - // values override the default set by allAlphaGate, if they come later in the - // specification of gates. Examples: + // values override the default set by allAlphaGate. Examples: // AllAlpha=false,NewFeature=true will result in newFeature=true // AllAlpha=true,NewFeature=false will result in newFeature=false allAlphaGate = "AllAlpha" externalTrafficLocalOnly = "AllowExtTrafficLocalEndpoints" dynamicKubeletConfig = "DynamicKubeletConfig" dynamicVolumeProvisioning = "DynamicVolumeProvisioning" + // TODO: Define gate/accessor for AppArmor ) var ( @@ -99,7 +99,8 @@ type FeatureGate interface { // alpha: v1.3 DynamicVolumeProvisioning() bool - // TODO: Define accessors for each non-API alpha feature. + // owner: mtaufen + // alpha: v1.4 DynamicKubeletConfig() bool }