mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
remove knownAlphaFeatures, only store input features.
This commit is contained in:
parent
d5904e7a4e
commit
ad026f29d3
@ -30,9 +30,6 @@ const (
|
|||||||
AlphaFeatureNetworkEndpointGroup = "NetworkEndpointGroup"
|
AlphaFeatureNetworkEndpointGroup = "NetworkEndpointGroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
// All known alpha features
|
|
||||||
var knownAlphaFeatures = map[string]bool{}
|
|
||||||
|
|
||||||
type AlphaFeatureGate struct {
|
type AlphaFeatureGate struct {
|
||||||
features map[string]bool
|
features map[string]bool
|
||||||
}
|
}
|
||||||
@ -44,11 +41,7 @@ func (af *AlphaFeatureGate) Enabled(key string) bool {
|
|||||||
func NewAlphaFeatureGate(features []string) *AlphaFeatureGate {
|
func NewAlphaFeatureGate(features []string) *AlphaFeatureGate {
|
||||||
featureMap := make(map[string]bool)
|
featureMap := make(map[string]bool)
|
||||||
for _, name := range features {
|
for _, name := range features {
|
||||||
if _, ok := knownAlphaFeatures[name]; !ok {
|
featureMap[name] = true
|
||||||
featureMap[name] = false
|
|
||||||
} else {
|
|
||||||
featureMap[name] = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return &AlphaFeatureGate{featureMap}
|
return &AlphaFeatureGate{featureMap}
|
||||||
}
|
}
|
||||||
|
@ -531,9 +531,6 @@ func getTestOperation() *computev1.Operation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewAlphaFeatureGate(t *testing.T) {
|
func TestNewAlphaFeatureGate(t *testing.T) {
|
||||||
knownAlphaFeatures["foo"] = true
|
|
||||||
knownAlphaFeatures["bar"] = true
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
alphaFeatures []string
|
alphaFeatures []string
|
||||||
expectEnabled []string
|
expectEnabled []string
|
||||||
@ -555,7 +552,7 @@ func TestNewAlphaFeatureGate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
alphaFeatures: []string{"aaa", "foo"},
|
alphaFeatures: []string{"aaa", "foo"},
|
||||||
expectEnabled: []string{"foo"},
|
expectEnabled: []string{"foo"},
|
||||||
expectDisabled: []string{"aaa"},
|
expectDisabled: []string{},
|
||||||
},
|
},
|
||||||
// enable foo
|
// enable foo
|
||||||
{
|
{
|
||||||
@ -579,8 +576,6 @@ func TestNewAlphaFeatureGate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(knownAlphaFeatures, "foo")
|
|
||||||
delete(knownAlphaFeatures, "bar")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetRegionInURL(t *testing.T) {
|
func TestGetRegionInURL(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user