| 1 |
/* |
| 2 |
Copyright 2017 The Kubernetes Authors. |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
you may not use this file except in compliance with the License. |
| 6 |
You may obtain a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
See the License for the specific language governing permissions and |
| 14 |
limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package features |
| 18 |
|
| 19 |
import ( |
| 20 |
"k8s.io/apimachinery/pkg/util/runtime" |
| 21 |
"k8s.io/apimachinery/pkg/util/version" |
| 22 |
utilfeature "k8s.io/apiserver/pkg/util/feature" |
| 23 |
"k8s.io/component-base/featuregate" |
| 24 |
) |
| 25 |
|
| 26 |
const ( |
| 27 |
// Every feature gate should add method here following this template: |
| 28 |
// |
| 29 |
// // owner: @username |
| 30 |
// MyFeature featuregate.Feature = "MyFeature" |
| 31 |
// |
| 32 |
// Feature gates should be listed in alphabetical, case-sensitive |
| 33 |
// (upper before any lower case character) order. This reduces the risk |
| 34 |
// of code conflicts because changes are more likely to be scattered |
| 35 |
// across the file. |
| 36 |
|
| 37 |
// owner: @jefftree |
| 38 |
// |
| 39 |
// Remove the v2beta1 apidiscovery.k8s.io/v2beta1 group version. Aggregated |
| 40 |
// discovery implements its own handlers and follows a different lifecycle than |
| 41 |
// traditional k8s resources. |
| 42 |
AggregatedDiscoveryRemoveBetaType featuregate.Feature = "AggregatedDiscoveryRemoveBetaType" |
| 43 |
|
| 44 |
// owner: @modulitos |
| 45 |
// |
| 46 |
// Allow user.DefaultInfo.UID to be set from x509 cert during cert auth. |
| 47 |
AllowParsingUserUIDFromCertAuth featuregate.Feature = "AllowParsingUserUIDFromCertAuth" |
| 48 |
|
| 49 |
// owner: @vinayakankugoyal |
| 50 |
// kep: https://kep.k8s.io/4633 |
| 51 |
// |
| 52 |
// Allows us to enable anonymous auth for only certain apiserver endpoints. |
| 53 |
AnonymousAuthConfigurableEndpoints featuregate.Feature = "AnonymousAuthConfigurableEndpoints" |
| 54 |
|
| 55 |
// owner: @stlaz @tkashem @dgrisonnet |
| 56 |
// kep: https://kep.k8s.io/3926 |
| 57 |
// |
| 58 |
// Enables the cluster admin to identify resources that fail to |
| 59 |
// decrypt or fail to be decoded into an object, and introduces |
| 60 |
// a new delete option to allow deletion of such corrupt |
| 61 |
// resources using the Kubernetes API only. |
| 62 |
AllowUnsafeMalformedObjectDeletion featuregate.Feature = "AllowUnsafeMalformedObjectDeletion" |
| 63 |
|
| 64 |
// owner: @ilackams |
| 65 |
// |
| 66 |
// Enables compression of REST responses (GET and LIST only) |
| 67 |
APIResponseCompression featuregate.Feature = "APIResponseCompression" |
| 68 |
|
| 69 |
// owner: @roycaihw |
| 70 |
// |
| 71 |
// Assigns each kube-apiserver an ID in a cluster. |
| 72 |
APIServerIdentity featuregate.Feature = "APIServerIdentity" |
| 73 |
|
| 74 |
// owner: @dashpole |
| 75 |
// |
| 76 |
// Add support for distributed tracing in the API Server |
| 77 |
APIServerTracing featuregate.Feature = "APIServerTracing" |
| 78 |
|
| 79 |
// owner: @linxiulei |
| 80 |
// |
| 81 |
// Enables serving watch requests in separate goroutines. |
| 82 |
APIServingWithRoutine featuregate.Feature = "APIServingWithRoutine" |
| 83 |
|
| 84 |
// owner: @deads2k |
| 85 |
// kep: https://kep.k8s.io/4601 |
| 86 |
// |
| 87 |
// Allows authorization to use field and label selectors. |
| 88 |
AuthorizeWithSelectors featuregate.Feature = "AuthorizeWithSelectors" |
| 89 |
|
| 90 |
// owner: @benluddy |
| 91 |
// kep: https://kep.k8s.io/4222 |
| 92 |
// |
| 93 |
// Enables CBOR as a supported encoding for requests and responses, and as the |
| 94 |
// preferred storage encoding for custom resources. |
| 95 |
CBORServingAndStorage featuregate.Feature = "CBORServingAndStorage" |
| 96 |
|
| 97 |
// owner: @serathius |
| 98 |
// |
| 99 |
// Replaces watch cache hashmap implementation with a btree based one, bringing performance improvements. |
| 100 |
BtreeWatchCache featuregate.Feature = "BtreeWatchCache" |
| 101 |
|
| 102 |
// owner: @serathius |
| 103 |
// Enables concurrent watch object decoding to avoid starving watch cache when conversion webhook is installed. |
| 104 |
ConcurrentWatchObjectDecode featuregate.Feature = "ConcurrentWatchObjectDecode" |
| 105 |
|
| 106 |
// owner: @jefftree |
| 107 |
// kep: https://kep.k8s.io/4355 |
| 108 |
// |
| 109 |
// Enables coordinated leader election in the API server |
| 110 |
CoordinatedLeaderElection featuregate.Feature = "CoordinatedLeaderElection" |
| 111 |
|
| 112 |
// owner: @aramase |
| 113 |
// kep: https://kep.k8s.io/3299 |
| 114 |
// deprecated: v1.28 |
| 115 |
// |
| 116 |
// Enables KMS v1 API for encryption at rest. |
| 117 |
KMSv1 featuregate.Feature = "KMSv1" |
| 118 |
|
| 119 |
// owner: @serathius |
| 120 |
// kep: https://kep.k8s.io/4988 |
| 121 |
// |
| 122 |
// Enables generating snapshots of watch cache store and using them to serve LIST requests. |
| 123 |
ListFromCacheSnapshot featuregate.Feature = "ListFromCacheSnapshot" |
| 124 |
|
| 125 |
// owner: @alexzielenski, @cici37, @jiahuif, @jpbetz |
| 126 |
// kep: https://kep.k8s.io/3962 |
| 127 |
// |
| 128 |
// Enables the MutatingAdmissionPolicy in Admission Chain |
| 129 |
MutatingAdmissionPolicy featuregate.Feature = "MutatingAdmissionPolicy" |
| 130 |
|
| 131 |
// owner: @jiahuif |
| 132 |
// kep: https://kep.k8s.io/2887 |
| 133 |
// |
| 134 |
// Enables populating "enum" field of OpenAPI schemas |
| 135 |
// in the spec returned from kube-apiserver. |
| 136 |
OpenAPIEnums featuregate.Feature = "OpenAPIEnums" |
| 137 |
|
| 138 |
// owner: @stlaz |
| 139 |
// |
| 140 |
// Enable kube-apiserver to accept UIDs via request header authentication. |
| 141 |
// This will also make the kube-apiserver's API aggregator add UIDs via standard |
| 142 |
// headers when forwarding requests to the servers serving the aggregated API. |
| 143 |
RemoteRequestHeaderUID featuregate.Feature = "RemoteRequestHeaderUID" |
| 144 |
|
| 145 |
// owner: @wojtek-t |
| 146 |
// |
| 147 |
// Enables resilient watchcache initialization to avoid controlplane |
| 148 |
// overload. |
| 149 |
ResilientWatchCacheInitialization featuregate.Feature = "ResilientWatchCacheInitialization" |
| 150 |
|
| 151 |
// owner: @serathius |
| 152 |
// |
| 153 |
// Allow watch cache to create a watch on a dedicated RPC. |
| 154 |
// This prevents watch cache from being starved by other watches. |
| 155 |
SeparateCacheWatchRPC featuregate.Feature = "SeparateCacheWatchRPC" |
| 156 |
|
| 157 |
// owner: @enj |
| 158 |
// |
| 159 |
// Enables http2 DOS mitigations for unauthenticated clients. |
| 160 |
// |
| 161 |
// Some known reasons to disable these mitigations: |
| 162 |
// |
| 163 |
// An API server that is fronted by an L7 load balancer that is set up |
| 164 |
// to mitigate http2 attacks may opt to disable this protection to prevent |
| 165 |
// unauthenticated clients from disabling connection reuse between the load |
| 166 |
// balancer and the API server (many incoming connections could share the |
| 167 |
// same backend connection). |
| 168 |
// |
| 169 |
// An API server that is on a private network may opt to disable this |
| 170 |
// protection to prevent performance regressions for unauthenticated |
| 171 |
// clients. |
| 172 |
UnauthenticatedHTTP2DOSMitigation featuregate.Feature = "UnauthenticatedHTTP2DOSMitigation" |
| 173 |
|
| 174 |
// owner: @jpbetz |
| 175 |
// Resource create requests using generateName are retried automatically by the apiserver |
| 176 |
// if the generated name conflicts with an existing resource name, up to a maximum number of 7 retries. |
| 177 |
RetryGenerateName featuregate.Feature = "RetryGenerateName" |
| 178 |
|
| 179 |
// owner: @cici37 |
| 180 |
// |
| 181 |
// StrictCostEnforcementForVAP is used to apply strict CEL cost validation for ValidatingAdmissionPolicy. |
| 182 |
// It will be set to off by default for certain time of period to prevent the impact on the existing users. |
| 183 |
// It is strongly recommended to enable this feature gate as early as possible. |
| 184 |
// The strict cost is specific for the extended libraries whose cost defined under k8s/apiserver/pkg/cel/library. |
| 185 |
StrictCostEnforcementForVAP featuregate.Feature = "StrictCostEnforcementForVAP" |
| 186 |
|
| 187 |
// owner: @cici37 |
| 188 |
// |
| 189 |
// StrictCostEnforcementForWebhooks is used to apply strict CEL cost validation for matchConditions in Webhooks. |
| 190 |
// It will be set to off by default for certain time of period to prevent the impact on the existing users. |
| 191 |
// It is strongly recommended to enable this feature gate as early as possible. |
| 192 |
// The strict cost is specific for the extended libraries whose cost defined under k8s/apiserver/pkg/cel/library. |
| 193 |
StrictCostEnforcementForWebhooks featuregate.Feature = "StrictCostEnforcementForWebhooks" |
| 194 |
|
| 195 |
// owner: @caesarxuchao @roycaihw |
| 196 |
// |
| 197 |
// Enable the storage version API. |
| 198 |
StorageVersionAPI featuregate.Feature = "StorageVersionAPI" |
| 199 |
|
| 200 |
// owner: @caesarxuchao |
| 201 |
// |
| 202 |
// Allow apiservers to expose the storage version hash in the discovery |
| 203 |
// document. |
| 204 |
StorageVersionHash featuregate.Feature = "StorageVersionHash" |
| 205 |
|
| 206 |
// owner: @serathius |
| 207 |
// Allow API server JSON encoder to encode collections item by item, instead of all at once. |
| 208 |
StreamingCollectionEncodingToJSON featuregate.Feature = "StreamingCollectionEncodingToJSON" |
| 209 |
|
| 210 |
// owner: @serathius |
| 211 |
// Allow API server Protobuf encoder to encode collections item by item, instead of all at once. |
| 212 |
StreamingCollectionEncodingToProtobuf featuregate.Feature = "StreamingCollectionEncodingToProtobuf" |
| 213 |
|
| 214 |
// owner: @aramase, @enj, @nabokihms |
| 215 |
// kep: https://kep.k8s.io/3331 |
| 216 |
// |
| 217 |
// Enables Structured Authentication Configuration |
| 218 |
StructuredAuthenticationConfiguration featuregate.Feature = "StructuredAuthenticationConfiguration" |
| 219 |
|
| 220 |
// owner: @palnabarun |
| 221 |
// kep: https://kep.k8s.io/3221 |
| 222 |
// |
| 223 |
// Enables Structured Authorization Configuration |
| 224 |
StructuredAuthorizationConfiguration featuregate.Feature = "StructuredAuthorizationConfiguration" |
| 225 |
|
| 226 |
// owner: @wojtek-t |
| 227 |
// |
| 228 |
// Enables post-start-hook for storage readiness |
| 229 |
WatchCacheInitializationPostStartHook featuregate.Feature = "WatchCacheInitializationPostStartHook" |
| 230 |
|
| 231 |
// owner: @serathius |
| 232 |
// Enables watches without resourceVersion to be served from storage. |
| 233 |
// Used to prevent https://github.com/kubernetes/kubernetes/issues/123072 until etcd fixes the issue. |
| 234 |
WatchFromStorageWithoutResourceVersion featuregate.Feature = "WatchFromStorageWithoutResourceVersion" |
| 235 |
|
| 236 |
// owner: @p0lyn0mial |
| 237 |
// |
| 238 |
// Allow the API server to stream individual items instead of chunking |
| 239 |
WatchList featuregate.Feature = "WatchList" |
| 240 |
|
| 241 |
// owner: @serathius |
| 242 |
// kep: http://kep.k8s.io/2340 |
| 243 |
// |
| 244 |
// Allow the API server to serve consistent lists from cache |
| 245 |
ConsistentListFromCache featuregate.Feature = "ConsistentListFromCache" |
| 246 |
) |
| 247 |
|
| 248 |
func init() { |
| 249 |
runtime.Must(utilfeature.DefaultMutableFeatureGate.AddVersioned(defaultVersionedKubernetesFeatureGates)) |
| 250 |
} |
| 251 |
|
| 252 |
// defaultVersionedKubernetesFeatureGates consists of all known Kubernetes-specific feature keys with VersionedSpecs. |
| 253 |
// To add a new feature, define a key for it above and add it here. The features will be |
| 254 |
// available throughout Kubernetes binaries. |
| 255 |
// |
| 256 |
// Entries are alphabetized and separated from each other with blank lines to avoid sweeping gofmt changes |
| 257 |
// when adding or removing one entry. |
| 258 |
var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{ |
| 259 |
AggregatedDiscoveryRemoveBetaType: { |
| 260 |
{Version: version.MustParse("1.0"), Default: false, PreRelease: featuregate.GA}, |
| 261 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Deprecated}, |
| 262 |
}, |
| 263 |
|
| 264 |
AllowParsingUserUIDFromCertAuth: { |
| 265 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, |
| 266 |
}, |
| 267 |
|
| 268 |
AllowUnsafeMalformedObjectDeletion: { |
| 269 |
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, |
| 270 |
}, |
| 271 |
|
| 272 |
AnonymousAuthConfigurableEndpoints: { |
| 273 |
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, |
| 274 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, |
| 275 |
}, |
| 276 |
|
| 277 |
APIResponseCompression: { |
| 278 |
{Version: version.MustParse("1.8"), Default: false, PreRelease: featuregate.Alpha}, |
| 279 |
{Version: version.MustParse("1.16"), Default: true, PreRelease: featuregate.Beta}, |
| 280 |
}, |
| 281 |
|
| 282 |
APIServerIdentity: { |
| 283 |
{Version: version.MustParse("1.20"), Default: false, PreRelease: featuregate.Alpha}, |
| 284 |
{Version: version.MustParse("1.26"), Default: true, PreRelease: featuregate.Beta}, |
| 285 |
}, |
| 286 |
|
| 287 |
APIServerTracing: { |
| 288 |
{Version: version.MustParse("1.22"), Default: false, PreRelease: featuregate.Alpha}, |
| 289 |
{Version: version.MustParse("1.27"), Default: true, PreRelease: featuregate.Beta}, |
| 290 |
}, |
| 291 |
|
| 292 |
APIServingWithRoutine: { |
| 293 |
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha}, |
| 294 |
}, |
| 295 |
|
| 296 |
BtreeWatchCache: { |
| 297 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, |
| 298 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, |
| 299 |
}, |
| 300 |
|
| 301 |
AuthorizeWithSelectors: { |
| 302 |
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, |
| 303 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, |
| 304 |
}, |
| 305 |
|
| 306 |
CBORServingAndStorage: { |
| 307 |
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, |
| 308 |
}, |
| 309 |
|
| 310 |
ConcurrentWatchObjectDecode: { |
| 311 |
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, |
| 312 |
}, |
| 313 |
|
| 314 |
ConsistentListFromCache: { |
| 315 |
{Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, |
| 316 |
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, |
| 317 |
}, |
| 318 |
|
| 319 |
CoordinatedLeaderElection: { |
| 320 |
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, |
| 321 |
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, |
| 322 |
}, |
| 323 |
|
| 324 |
KMSv1: { |
| 325 |
{Version: version.MustParse("1.0"), Default: true, PreRelease: featuregate.GA}, |
| 326 |
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Deprecated}, |
| 327 |
{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Deprecated}, |
| 328 |
}, |
| 329 |
|
| 330 |
ListFromCacheSnapshot: { |
| 331 |
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, |
| 332 |
}, |
| 333 |
|
| 334 |
MutatingAdmissionPolicy: { |
| 335 |
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, |
| 336 |
}, |
| 337 |
|
| 338 |
OpenAPIEnums: { |
| 339 |
{Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, |
| 340 |
{Version: version.MustParse("1.24"), Default: true, PreRelease: featuregate.Beta}, |
| 341 |
}, |
| 342 |
|
| 343 |
RemoteRequestHeaderUID: { |
| 344 |
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, |
| 345 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, |
| 346 |
}, |
| 347 |
|
| 348 |
ResilientWatchCacheInitialization: { |
| 349 |
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, |
| 350 |
}, |
| 351 |
|
| 352 |
RetryGenerateName: { |
| 353 |
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha}, |
| 354 |
{Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, |
| 355 |
{Version: version.MustParse("1.32"), Default: true, LockToDefault: true, PreRelease: featuregate.GA}, |
| 356 |
}, |
| 357 |
|
| 358 |
SeparateCacheWatchRPC: { |
| 359 |
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, |
| 360 |
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, |
| 361 |
}, |
| 362 |
|
| 363 |
StorageVersionAPI: { |
| 364 |
{Version: version.MustParse("1.20"), Default: false, PreRelease: featuregate.Alpha}, |
| 365 |
}, |
| 366 |
|
| 367 |
StorageVersionHash: { |
| 368 |
{Version: version.MustParse("1.14"), Default: false, PreRelease: featuregate.Alpha}, |
| 369 |
{Version: version.MustParse("1.15"), Default: true, PreRelease: featuregate.Beta}, |
| 370 |
}, |
| 371 |
|
| 372 |
StreamingCollectionEncodingToJSON: { |
| 373 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, |
| 374 |
}, |
| 375 |
|
| 376 |
StreamingCollectionEncodingToProtobuf: { |
| 377 |
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, |
| 378 |
}, |
| 379 |
|
| 380 |
StrictCostEnforcementForVAP: { |
| 381 |
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta}, |
| 382 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, |
| 383 |
}, |
| 384 |
|
| 385 |
StrictCostEnforcementForWebhooks: { |
| 386 |
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta}, |
| 387 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, |
| 388 |
}, |
| 389 |
|
| 390 |
StructuredAuthenticationConfiguration: { |
| 391 |
{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, |
| 392 |
{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, |
| 393 |
}, |
| 394 |
|
| 395 |
StructuredAuthorizationConfiguration: { |
| 396 |
{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, |
| 397 |
{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, |
| 398 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, |
| 399 |
}, |
| 400 |
|
| 401 |
UnauthenticatedHTTP2DOSMitigation: { |
| 402 |
{Version: version.MustParse("1.25"), Default: false, PreRelease: featuregate.Beta}, |
| 403 |
{Version: version.MustParse("1.29"), Default: true, PreRelease: featuregate.Beta}, |
| 404 |
}, |
| 405 |
|
| 406 |
WatchCacheInitializationPostStartHook: { |
| 407 |
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, |
| 408 |
}, |
| 409 |
|
| 410 |
WatchFromStorageWithoutResourceVersion: { |
| 411 |
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Beta}, |
| 412 |
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, |
| 413 |
}, |
| 414 |
|
| 415 |
WatchList: { |
| 416 |
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha}, |
| 417 |
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta}, |
| 418 |
// switch this back to false because the json and proto streaming encoders appear to work better. |
| 419 |
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, |
| 420 |
}, |
| 421 |
} |