Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
PodSecurity: test GA-only cases and alpha/beta fields separately
Browse files Browse the repository at this point in the history
Kubernetes-commit: ba6b4c5a18c455867f11036a7208962e84012a86
  • Loading branch information
liggitt authored and k8s-publishing-bot committed Jun 30, 2021
1 parent 2b6184b commit 56fde14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions featuregate/feature_gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ type MutableFeatureGate interface {
SetFromMap(m map[string]bool) error
// Add adds features to the featureGate.
Add(features map[Feature]FeatureSpec) error
// GetAll returns a copy of the map of known feature names to feature specs.
GetAll() map[Feature]FeatureSpec
}

// featureGate implements FeatureGate as well as pflag.Value for flag parsing.
Expand Down Expand Up @@ -290,6 +292,15 @@ func (f *featureGate) Add(features map[Feature]FeatureSpec) error {
return nil
}

// GetAll returns a copy of the map of known feature names to feature specs.
func (f *featureGate) GetAll() map[Feature]FeatureSpec {
retval := map[Feature]FeatureSpec{}
for k, v := range f.known.Load().(map[Feature]FeatureSpec) {
retval[k] = v
}
return retval
}

// Enabled returns true if the key is enabled. If the key is not known, this call will panic.
func (f *featureGate) Enabled(key Feature) bool {
if v, ok := f.enabled.Load().(map[Feature]bool)[key]; ok {
Expand Down

0 comments on commit 56fde14

Please sign in to comment.