mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #31171 from jlowdermilk/dynamic-volume-gate
Automatic merge from submit-queue Dynamic volume gate Rebased on #31140, only review last commit. Adds a feature-gate flag for dynamic volume provisioning alpha, defaulting to enabled to avoid breaking people. Key should be removed when support for the alpha version of this is removed.
This commit is contained in:
commit
1f4020f8d8
@ -34,6 +34,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
|
||||||
|
utilconfig "k8s.io/kubernetes/pkg/util/config"
|
||||||
"k8s.io/kubernetes/pkg/util/io"
|
"k8s.io/kubernetes/pkg/util/io"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
"k8s.io/kubernetes/pkg/volume/aws_ebs"
|
"k8s.io/kubernetes/pkg/volume/aws_ebs"
|
||||||
@ -125,6 +126,8 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
|
|||||||
// TODO: remove in Kubernetes 1.5
|
// TODO: remove in Kubernetes 1.5
|
||||||
func NewAlphaVolumeProvisioner(cloud cloudprovider.Interface, config componentconfig.VolumeConfiguration) (volume.ProvisionableVolumePlugin, error) {
|
func NewAlphaVolumeProvisioner(cloud cloudprovider.Interface, config componentconfig.VolumeConfiguration) (volume.ProvisionableVolumePlugin, error) {
|
||||||
switch {
|
switch {
|
||||||
|
case !utilconfig.DefaultFeatureGate.DynamicVolumeProvisioning():
|
||||||
|
return nil, nil
|
||||||
case cloud == nil && config.EnableHostPathProvisioning:
|
case cloud == nil && config.EnableHostPathProvisioning:
|
||||||
return getProvisionablePluginFromVolumePlugins(host_path.ProbeVolumePlugins(
|
return getProvisionablePluginFromVolumePlugins(host_path.ProbeVolumePlugins(
|
||||||
volume.VolumeConfig{
|
volume.VolumeConfig{
|
||||||
|
@ -34,13 +34,14 @@ const (
|
|||||||
// a featureSpec entry to knownFeatures.
|
// a featureSpec entry to knownFeatures.
|
||||||
|
|
||||||
// allAlphaGate is a global toggle for alpha features. Per-feature key
|
// allAlphaGate is a global toggle for alpha features. Per-feature key
|
||||||
// values override the default set by allAlphaGate, if they come later in the
|
// values override the default set by allAlphaGate. Examples:
|
||||||
// specification of gates. Examples:
|
|
||||||
// AllAlpha=false,NewFeature=true will result in newFeature=true
|
// AllAlpha=false,NewFeature=true will result in newFeature=true
|
||||||
// AllAlpha=true,NewFeature=false will result in newFeature=false
|
// AllAlpha=true,NewFeature=false will result in newFeature=false
|
||||||
allAlphaGate = "AllAlpha"
|
allAlphaGate = "AllAlpha"
|
||||||
externalTrafficLocalOnly = "AllowExtTrafficLocalEndpoints"
|
externalTrafficLocalOnly = "AllowExtTrafficLocalEndpoints"
|
||||||
dynamicKubeletConfig = "DynamicKubeletConfig"
|
dynamicKubeletConfig = "DynamicKubeletConfig"
|
||||||
|
dynamicVolumeProvisioning = "DynamicVolumeProvisioning"
|
||||||
|
// TODO: Define gate/accessor for AppArmor
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -50,6 +51,7 @@ var (
|
|||||||
allAlphaGate: {false, alpha},
|
allAlphaGate: {false, alpha},
|
||||||
externalTrafficLocalOnly: {false, alpha},
|
externalTrafficLocalOnly: {false, alpha},
|
||||||
dynamicKubeletConfig: {false, alpha},
|
dynamicKubeletConfig: {false, alpha},
|
||||||
|
dynamicVolumeProvisioning: {true, alpha},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special handling for a few gates.
|
// Special handling for a few gates.
|
||||||
@ -93,7 +95,12 @@ type FeatureGate interface {
|
|||||||
// alpha: v1.4
|
// alpha: v1.4
|
||||||
ExternalTrafficLocalOnly() bool
|
ExternalTrafficLocalOnly() bool
|
||||||
|
|
||||||
// TODO: Define accessors for each non-API alpha feature.
|
// owner: @saad-ali
|
||||||
|
// alpha: v1.3
|
||||||
|
DynamicVolumeProvisioning() bool
|
||||||
|
|
||||||
|
// owner: mtaufen
|
||||||
|
// alpha: v1.4
|
||||||
DynamicKubeletConfig() bool
|
DynamicKubeletConfig() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +180,11 @@ func (f *featureGate) DynamicKubeletConfig() bool {
|
|||||||
return f.lookup(dynamicKubeletConfig)
|
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 {
|
func (f *featureGate) lookup(key string) bool {
|
||||||
defaultValue := f.known[key].enabled
|
defaultValue := f.known[key].enabled
|
||||||
if f.enabled != nil {
|
if f.enabled != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user