Implement Alpha Dynamic Kubelet Configuration

See Issue #27980 and Proposal PR #29459
This commit is contained in:
Michael Taufen
2016-07-21 11:49:59 -07:00
parent 5d25bffffe
commit 35a63d956b
2 changed files with 168 additions and 11 deletions

View File

@@ -38,14 +38,16 @@ 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"
allAlphaGate = "AllAlpha"
dynamicKubeletConfig = "DynamicKubeletConfig"
)
var (
// Default values for recorded features. Every new feature gate should be
// represented here.
knownFeatures = map[string]featureSpec{
allAlphaGate: {false, alpha},
allAlphaGate: {false, alpha},
dynamicKubeletConfig: {false, alpha},
}
// Special handling for a few gates.
@@ -86,6 +88,7 @@ type FeatureGate interface {
// MyFeature() bool
// TODO: Define accessors for each non-API alpha feature.
DynamicKubeletConfig() bool
}
// featureGate implements FeatureGate as well as pflag.Value for flag parsing.
@@ -154,6 +157,11 @@ func (f *featureGate) Type() string {
return "mapStringBool"
}
// DynamicKubeletConfig returns value for dynamicKubeletConfig
func (f *featureGate) DynamicKubeletConfig() bool {
return f.lookup(dynamicKubeletConfig)
}
func (f *featureGate) lookup(key string) bool {
defaultValue := f.known[key].enabled
if f.enabled != nil {