@@ -17,6 +17,7 @@ limitations under the License.
17
17
package v1
18
18
19
19
import (
20
+ "k8s.io/apimachinery/pkg/util/version"
20
21
"k8s.io/component-base/featuregate"
21
22
)
22
23
@@ -31,17 +32,16 @@ const (
31
32
// used by a call chain.
32
33
ContextualLogging featuregate.Feature = "ContextualLogging"
33
34
34
- // contextualLoggingDefault is now true because the feature reached beta
35
- // and performance comparisons showed no relevant degradation when
36
- // enabling it.
37
- contextualLoggingDefault = true
38
-
39
35
// Allow fine-tuning of experimental, alpha-quality logging options.
40
36
//
41
37
// Per https://groups.google.com/g/kubernetes-sig-architecture/c/Nxsc7pfe5rw/m/vF2djJh0BAAJ
42
38
// we want to avoid a proliferation of feature gates. This feature gate:
43
39
// - will guard *a group* of logging options whose quality level is alpha.
44
40
// - will never graduate to beta or stable.
41
+ //
42
+ // IMPORTANT: Unlike typical feature gates, LoggingAlphaOptions is NOT affected by
43
+ // emulation version changes. Its behavior remains constant regardless of the
44
+ // emulation version being used.
45
45
LoggingAlphaOptions featuregate.Feature = "LoggingAlphaOptions"
46
46
47
47
// Allow fine-tuning of experimental, beta-quality logging options.
@@ -51,22 +51,32 @@ const (
51
51
// - will guard *a group* of logging options whose quality level is beta.
52
52
// - is thus *introduced* as beta
53
53
// - will never graduate to stable.
54
+ //
55
+ // IMPORTANT: Unlike typical feature gates, LoggingBetaOptions is NOT affected by
56
+ // emulation version changes. Its behavior remains constant regardless of the
57
+ // emulation version being used.
54
58
LoggingBetaOptions featuregate.Feature = "LoggingBetaOptions"
55
59
56
60
// Stable logging options. Always enabled.
57
61
LoggingStableOptions featuregate.Feature = "LoggingStableOptions"
58
62
)
59
63
60
- func featureGates () map [featuregate.Feature ]featuregate.FeatureSpec {
61
- return map [featuregate.Feature ]featuregate.FeatureSpec {
62
- ContextualLogging : {Default : contextualLoggingDefault , PreRelease : featuregate .Beta },
63
-
64
- LoggingAlphaOptions : {Default : false , PreRelease : featuregate .Alpha },
65
- LoggingBetaOptions : {Default : true , PreRelease : featuregate .Beta },
64
+ func featureGates () map [featuregate.Feature ]featuregate.VersionedSpecs {
65
+ return map [featuregate.Feature ]featuregate.VersionedSpecs {
66
+ ContextualLogging : {
67
+ {Version : version .MustParse ("1.24" ), Default : false , PreRelease : featuregate .Alpha },
68
+ {Version : version .MustParse ("1.30" ), Default : true , PreRelease : featuregate .Beta },
69
+ },
70
+ LoggingAlphaOptions : {
71
+ {Version : version .MustParse ("1.24" ), Default : false , PreRelease : featuregate .Alpha },
72
+ },
73
+ LoggingBetaOptions : {
74
+ {Version : version .MustParse ("1.24" ), Default : true , PreRelease : featuregate .Beta },
75
+ },
66
76
}
67
77
}
68
78
69
79
// AddFeatureGates adds all feature gates used by this package.
70
- func AddFeatureGates (mutableFeatureGate featuregate.MutableFeatureGate ) error {
71
- return mutableFeatureGate .Add (featureGates ()) //nolint:forbidigo // The logging feature gates are by design unversioned (perpetual alpha/beta).
80
+ func AddFeatureGates (mutableFeatureGate featuregate.MutableVersionedFeatureGate ) error {
81
+ return mutableFeatureGate .AddVersioned (featureGates ())
72
82
}
0 commit comments