Add CBOR feature gates.

For alpha, there is one apiserver feature gate and two client-go feature gates controlling
CBOR. They were initially wired to separate test-only feature gate instances in order to prevent
them from being configurable at runtime via command-line flags or environment variables (for
client-go feature gates outside of Kubernetes components). All of the integration tests required by
the KEP as alpha criteria have been implemented. This adds the feature gates to the usual feature
gate instances and removes the temporary code to support separate test-only feature gate instances.

Kubernetes-commit: 072dfcb416fd4e1ddab0a89ac4faf519e268bc96
This commit is contained in:
Ben Luddy
2024-11-04 10:40:19 -05:00
committed by Kubernetes Publisher
parent c1010ffd7d
commit 8cb21671f4
8 changed files with 37 additions and 77 deletions

View File

@@ -28,6 +28,31 @@ const (
// of code conflicts because changes are more likely to be scattered
// across the file.
// owner: @benluddy
// kep: https://kep.k8s.io/4222
// alpha: 1.32
//
// If disabled, clients configured to accept "application/cbor" will instead accept
// "application/json" with the same relative preference, and clients configured to write
// "application/cbor" or "application/apply-patch+cbor" will instead write
// "application/json" or "application/apply-patch+yaml", respectively.
ClientsAllowCBOR Feature = "ClientsAllowCBOR"
// owner: @benluddy
// kep: https://kep.k8s.io/4222
// alpha: 1.32
//
// If enabled, and only if ClientsAllowCBOR is also enabled, the default request content
// type (if not explicitly configured) and the dynamic client's request content type both
// become "application/cbor" instead of "application/json". The default content type for
// apply patch requests becomes "application/apply-patch+cbor" instead of
// "application/apply-patch+yaml".
ClientsPreferCBOR Feature = "ClientsPreferCBOR"
// owner: @nilekhc
// alpha: v1.30
InformerResourceVersion Feature = "InformerResourceVersion"
// owner: @p0lyn0mial
// beta: v1.30
//
@@ -37,31 +62,6 @@ const (
// The feature is disabled in Beta by default because
// it will only be turned on for selected control plane component(s).
WatchListClient Feature = "WatchListClient"
// owner: @nilekhc
// alpha: v1.30
InformerResourceVersion Feature = "InformerResourceVersion"
// owner: @benluddy
// kep: https://kep.k8s.io/4222
//
// If disabled, clients configured to accept "application/cbor" will instead accept
// "application/json" with the same relative preference, and clients configured to write
// "application/cbor" or "application/apply-patch+cbor" will instead write
// "application/json" or "application/apply-patch+yaml", respectively.
//
// This feature is currently PRE-ALPHA and MUST NOT be enabled outside of integration tests.
TestOnlyClientAllowsCBOR Feature = "TestOnlyClientAllowsCBOR"
// owner: @benluddy
// kep: https://kep.k8s.io/4222
//
// If enabled AND TestOnlyClientAllowsCBOR is also enabled, the default request content type
// (if not explicitly configured) and the dynamic client's request content type both become
// "application/cbor".
//
// This feature is currently PRE-ALPHA and MUST NOT be enabled outside of integration tests.
TestOnlyClientPrefersCBOR Feature = "TestOnlyClientPrefersCBOR"
)
// defaultKubernetesFeatureGates consists of all known Kubernetes-specific feature keys.
@@ -70,6 +70,8 @@ const (
// After registering with the binary, the features are, by default, controllable using environment variables.
// For more details, please see envVarFeatureGates implementation.
var defaultKubernetesFeatureGates = map[Feature]FeatureSpec{
WatchListClient: {Default: false, PreRelease: Beta},
ClientsAllowCBOR: {Default: false, PreRelease: Alpha},
ClientsPreferCBOR: {Default: false, PreRelease: Alpha},
InformerResourceVersion: {Default: false, PreRelease: Alpha},
WatchListClient: {Default: false, PreRelease: Beta},
}