package features
import "k8s.io/client-go/features"
Index ¶
- Constants
- Variables
- func AddFeaturesToExistingFeatureGates(registry Registry) error
- func ReplaceFeatureGates(newFeatureGates Gates)
- type Feature
- type FeatureSpec
- type Gates
- type Registry
Constants ¶
const ( // Values for PreRelease. Alpha = prerelease("ALPHA") Beta = prerelease("BETA") GA = prerelease("") // Deprecated Deprecated = prerelease("DEPRECATED") )
Variables ¶
var TestOnlyFeatureGates = &testOnlyFeatureGates{ features: map[Feature]bool{ TestOnlyClientAllowsCBOR: false, TestOnlyClientPrefersCBOR: false, }, }
TestOnlyFeatureGates is a distinct registry of pre-alpha client features that must not be included in runtime wiring to command-line flags or environment variables. It exists as a risk mitigation to allow only programmatic enablement of CBOR serialization for integration testing purposes.
TODO: Once all required integration test coverage is complete, this will be deleted and the test-only feature gates will be replaced by normal feature gates.
Functions ¶
func AddFeaturesToExistingFeatureGates ¶
AddFeaturesToExistingFeatureGates adds the default feature gates to the provided registry. Usually this function is combined with ReplaceFeatureGates to take control of the features exposed by this library.
func ReplaceFeatureGates ¶
func ReplaceFeatureGates(newFeatureGates Gates)
ReplaceFeatureGates overwrites the default implementation of the feature gates used by this library.
Useful for binaries that would like to have full control of the features exposed by this library, such as allowing consumers of a binary to interact with the features via a command line flag.
For example:
// first, register client-go's features to your registry. clientgofeaturegate.AddFeaturesToExistingFeatureGates(utilfeature.DefaultMutableFeatureGate) // then replace client-go's feature gates implementation with your implementation clientgofeaturegate.ReplaceFeatureGates(utilfeature.DefaultMutableFeatureGate)
Types ¶
type Feature ¶
type Feature string
const ( // owner: @p0lyn0mial // beta: v1.30 // // Allow the client to get a stream of individual items instead of chunking from the server. // // NOTE: // 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" )
type FeatureSpec ¶
type FeatureSpec struct { // Default is the default enablement state for the feature Default bool // LockToDefault indicates that the feature is locked to its default and cannot be changed LockToDefault bool // PreRelease indicates the maturity level of the feature PreRelease prerelease }
type Gates ¶
Gates indicates whether a given feature is enabled or not.
func FeatureGates ¶
func FeatureGates() Gates
FeatureGates returns the feature gates exposed by this library.
By default, only the default features gates will be returned. The default implementation allows controlling the features via environmental variables. For example, if you have a feature named "MyFeature" setting an environmental variable "KUBE_FEATURE_MyFeature" will allow you to configure the state of that feature.
Please note that the actual set of the feature gates might be overwritten by calling ReplaceFeatureGates method.
type Registry ¶
type Registry interface { // Add adds existing feature gates to the provided registry. // // As of today, this method is used by AddFeaturesToExistingFeatureGates and // ReplaceFeatureGates to take control of the features exposed by this library. Add(map[Feature]FeatureSpec) error }
Registry represents an external feature gates registry.
Source Files ¶
envvar.go features.go known_features.go
Directories ¶
Path | Synopsis |
---|---|
features/testing |
- Version
- v0.32.0-alpha.3
- Published
- Oct 29, 2024
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 17 minutes ago –
Tools for package owners.