vendor: bump to Kube 1.9/master
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
7076c73172
commit
7a675ccd92
202 changed files with 8543 additions and 7270 deletions
3
vendor/k8s.io/apiserver/pkg/features/kube_features.go
generated
vendored
3
vendor/k8s.io/apiserver/pkg/features/kube_features.go
generated
vendored
|
@ -58,6 +58,7 @@ const (
|
|||
|
||||
// owner: @smarterclayton
|
||||
// alpha: v1.8
|
||||
// beta: v1.9
|
||||
//
|
||||
// Allow API clients to retrieve resource lists in chunks rather than
|
||||
// all at once.
|
||||
|
@ -76,5 +77,5 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
|||
AdvancedAuditing: {Default: true, PreRelease: utilfeature.Beta},
|
||||
APIResponseCompression: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
Initializers: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
APIListChunking: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
APIListChunking: {Default: true, PreRelease: utilfeature.Beta},
|
||||
}
|
||||
|
|
141
vendor/k8s.io/apiserver/pkg/util/feature/feature_gate.go
generated
vendored
141
vendor/k8s.io/apiserver/pkg/util/feature/feature_gate.go
generated
vendored
|
@ -22,6 +22,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/pflag"
|
||||
|
@ -46,7 +47,7 @@ var (
|
|||
}
|
||||
|
||||
// Special handling for a few gates.
|
||||
specialFeatures = map[Feature]func(f *featureGate, val bool){
|
||||
specialFeatures = map[Feature]func(known map[Feature]FeatureSpec, enabled map[Feature]bool, val bool){
|
||||
allAlphaGate: setUnsetAlphaGates,
|
||||
}
|
||||
|
||||
|
@ -76,6 +77,8 @@ type FeatureGate interface {
|
|||
// Set parses and stores flag gates for known features
|
||||
// from a string like feature1=true,feature2=false,...
|
||||
Set(value string) error
|
||||
// SetFromMap stores flag gates for known features from a map[string]bool or returns an error
|
||||
SetFromMap(m map[string]bool) error
|
||||
// Enabled returns true if the key is enabled.
|
||||
Enabled(key Feature) bool
|
||||
// Add adds features to the featureGate.
|
||||
|
@ -86,21 +89,23 @@ type FeatureGate interface {
|
|||
|
||||
// featureGate implements FeatureGate as well as pflag.Value for flag parsing.
|
||||
type featureGate struct {
|
||||
lock sync.RWMutex
|
||||
special map[Feature]func(map[Feature]FeatureSpec, map[Feature]bool, bool)
|
||||
|
||||
known map[Feature]FeatureSpec
|
||||
special map[Feature]func(*featureGate, bool)
|
||||
enabled map[Feature]bool
|
||||
|
||||
// is set to true when AddFlag is called. Note: initialization is not go-routine safe, lookup is
|
||||
// lock guards writes to known, enabled, and reads/writes of closed
|
||||
lock sync.Mutex
|
||||
// known holds a map[Feature]FeatureSpec
|
||||
known *atomic.Value
|
||||
// enabled holds a map[Feature]bool
|
||||
enabled *atomic.Value
|
||||
// closed is set to true when AddFlag is called, and prevents subsequent calls to Add
|
||||
closed bool
|
||||
}
|
||||
|
||||
func setUnsetAlphaGates(f *featureGate, val bool) {
|
||||
for k, v := range f.known {
|
||||
func setUnsetAlphaGates(known map[Feature]FeatureSpec, enabled map[Feature]bool, val bool) {
|
||||
for k, v := range known {
|
||||
if v.PreRelease == Alpha {
|
||||
if _, found := f.enabled[k]; !found {
|
||||
f.enabled[k] = val
|
||||
if _, found := enabled[k]; !found {
|
||||
enabled[k] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,30 +115,49 @@ func setUnsetAlphaGates(f *featureGate, val bool) {
|
|||
var _ pflag.Value = &featureGate{}
|
||||
|
||||
func NewFeatureGate() *featureGate {
|
||||
f := &featureGate{
|
||||
known: map[Feature]FeatureSpec{},
|
||||
special: specialFeatures,
|
||||
enabled: map[Feature]bool{},
|
||||
}
|
||||
known := map[Feature]FeatureSpec{}
|
||||
for k, v := range defaultFeatures {
|
||||
f.known[k] = v
|
||||
known[k] = v
|
||||
}
|
||||
|
||||
knownValue := &atomic.Value{}
|
||||
knownValue.Store(known)
|
||||
|
||||
enabled := map[Feature]bool{}
|
||||
enabledValue := &atomic.Value{}
|
||||
enabledValue.Store(enabled)
|
||||
|
||||
f := &featureGate{
|
||||
known: knownValue,
|
||||
special: specialFeatures,
|
||||
enabled: enabledValue,
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// Set Parses a string of the form "key1=value1,key2=value2,..." into a
|
||||
// Set parses a string of the form "key1=value1,key2=value2,..." into a
|
||||
// map[string]bool of known keys or returns an error.
|
||||
func (f *featureGate) Set(value string) error {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
// Copy existing state
|
||||
known := map[Feature]FeatureSpec{}
|
||||
for k, v := range f.known.Load().(map[Feature]FeatureSpec) {
|
||||
known[k] = v
|
||||
}
|
||||
enabled := map[Feature]bool{}
|
||||
for k, v := range f.enabled.Load().(map[Feature]bool) {
|
||||
enabled[k] = v
|
||||
}
|
||||
|
||||
for _, s := range strings.Split(value, ",") {
|
||||
if len(s) == 0 {
|
||||
continue
|
||||
}
|
||||
arr := strings.SplitN(s, "=", 2)
|
||||
k := Feature(strings.TrimSpace(arr[0]))
|
||||
_, ok := f.known[Feature(k)]
|
||||
_, ok := known[k]
|
||||
if !ok {
|
||||
return fmt.Errorf("unrecognized key: %s", k)
|
||||
}
|
||||
|
@ -145,25 +169,62 @@ func (f *featureGate) Set(value string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("invalid value of %s: %s, err: %v", k, v, err)
|
||||
}
|
||||
f.enabled[k] = boolValue
|
||||
enabled[k] = boolValue
|
||||
|
||||
// Handle "special" features like "all alpha gates"
|
||||
if fn, found := f.special[k]; found {
|
||||
fn(f, boolValue)
|
||||
fn(known, enabled, boolValue)
|
||||
}
|
||||
}
|
||||
|
||||
// Persist changes
|
||||
f.known.Store(known)
|
||||
f.enabled.Store(enabled)
|
||||
|
||||
glog.Infof("feature gates: %v", enabled)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFromMap stores flag gates for known features from a map[string]bool or returns an error
|
||||
func (f *featureGate) SetFromMap(m map[string]bool) error {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
// Copy existing state
|
||||
known := map[Feature]FeatureSpec{}
|
||||
for k, v := range f.known.Load().(map[Feature]FeatureSpec) {
|
||||
known[k] = v
|
||||
}
|
||||
enabled := map[Feature]bool{}
|
||||
for k, v := range f.enabled.Load().(map[Feature]bool) {
|
||||
enabled[k] = v
|
||||
}
|
||||
|
||||
for k, v := range m {
|
||||
k := Feature(k)
|
||||
_, ok := known[k]
|
||||
if !ok {
|
||||
return fmt.Errorf("unrecognized key: %s", k)
|
||||
}
|
||||
enabled[k] = v
|
||||
// Handle "special" features like "all alpha gates"
|
||||
if fn, found := f.special[k]; found {
|
||||
fn(known, enabled, v)
|
||||
}
|
||||
}
|
||||
|
||||
// Persist changes
|
||||
f.known.Store(known)
|
||||
f.enabled.Store(enabled)
|
||||
|
||||
glog.Infof("feature gates: %v", f.enabled)
|
||||
return nil
|
||||
}
|
||||
|
||||
// String returns a string containing all enabled feature gates, formatted as "key1=value1,key2=value2,...".
|
||||
func (f *featureGate) String() string {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
|
||||
pairs := []string{}
|
||||
for k, v := range f.enabled {
|
||||
for k, v := range f.enabled.Load().(map[Feature]bool) {
|
||||
pairs = append(pairs, fmt.Sprintf("%s=%t", k, v))
|
||||
}
|
||||
sort.Strings(pairs)
|
||||
|
@ -183,31 +244,35 @@ func (f *featureGate) Add(features map[Feature]FeatureSpec) error {
|
|||
return fmt.Errorf("cannot add a feature gate after adding it to the flag set")
|
||||
}
|
||||
|
||||
// Copy existing state
|
||||
known := map[Feature]FeatureSpec{}
|
||||
for k, v := range f.known.Load().(map[Feature]FeatureSpec) {
|
||||
known[k] = v
|
||||
}
|
||||
|
||||
for name, spec := range features {
|
||||
if existingSpec, found := f.known[name]; found {
|
||||
if existingSpec, found := known[name]; found {
|
||||
if existingSpec == spec {
|
||||
continue
|
||||
}
|
||||
return fmt.Errorf("feature gate %q with different spec already exists: %v", name, existingSpec)
|
||||
}
|
||||
|
||||
f.known[name] = spec
|
||||
known[name] = spec
|
||||
}
|
||||
|
||||
// Persist updated state
|
||||
f.known.Store(known)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Enabled returns true if the key is enabled.
|
||||
func (f *featureGate) Enabled(key Feature) bool {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
|
||||
defaultValue := f.known[key].Default
|
||||
if f.enabled != nil {
|
||||
if v, ok := f.enabled[key]; ok {
|
||||
return v
|
||||
}
|
||||
if v, ok := f.enabled.Load().(map[Feature]bool)[key]; ok {
|
||||
return v
|
||||
}
|
||||
return defaultValue
|
||||
return f.known.Load().(map[Feature]FeatureSpec)[key].Default
|
||||
}
|
||||
|
||||
// AddFlag adds a flag for setting global feature gates to the specified FlagSet.
|
||||
|
@ -224,10 +289,8 @@ func (f *featureGate) AddFlag(fs *pflag.FlagSet) {
|
|||
|
||||
// KnownFeatures returns a slice of strings describing the FeatureGate's known features.
|
||||
func (f *featureGate) KnownFeatures() []string {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
var known []string
|
||||
for k, v := range f.known {
|
||||
for k, v := range f.known.Load().(map[Feature]FeatureSpec) {
|
||||
pre := ""
|
||||
if v.PreRelease != GA {
|
||||
pre = fmt.Sprintf("%s - ", v.PreRelease)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue