package features
import "k8s.io/client-go/features"
Index ¶
- Constants
- func AddFeaturesToExistingFeatureGates(registry Registry) error
- func AddVersionedFeaturesToExistingFeatureGates(registry VersionedRegistry) error
- func ReplaceFeatureGates(newFeatureGates Gates)
- type Feature
- type FeatureSpec
- type Gates
- type Registry
- type VersionedRegistry
- type VersionedSpecs
Constants ¶
const ( // Values for PreRelease. Alpha = prerelease("ALPHA") Beta = prerelease("BETA") GA = prerelease("") // Deprecated Deprecated = prerelease("DEPRECATED") )
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 AddVersionedFeaturesToExistingFeatureGates ¶
func AddVersionedFeaturesToExistingFeatureGates(registry VersionedRegistry) error
AddFeaturesToExistingFeatureGates adds the default versioned feature gates to the provided registry. Usually this function is combined with ReplaceFeatureGates to take control of the features exposed by this library. Generally only used by k/k.
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: @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: @deads2k // beta: v1.33 // // Refactor informers to deliver watch stream events in order instead of out of order. InOrderInformers Feature = "InOrderInformers" // owner: @yue9944882 // beta: v1.35 // // Allow InOrderInformer to process incoming events in batches to expedite the process rate. InOrderInformersBatchProcess Feature = "InOrderInformersBatchProcess" // owner: @enj, @michaelasp // alpha: v1.30 // GA: v1.35 InformerResourceVersion Feature = "InformerResourceVersion" // owner: @p0lyn0mial // beta: v1.30 // // Allow the client to get a stream of individual items instead of chunking from the server. WatchListClient Feature = "WatchListClient" )
Every feature gate should have an entry here following this template:
// owner: @username // alpha: v1.4 MyFeature featuregate.Feature = "MyFeature"
Feature gates should be listed in alphabetical, case-sensitive (upper before any lower case character) order. This reduces the risk of code conflicts because changes are more likely to be scattered across the file.
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
// Version indicates the earliest version from which this FeatureSpec is valid.
// If multiple FeatureSpecs exist for a Feature, the one with the highest version that is less
// than or equal to the effective version of the component is used.
Version *version.Version
}
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.
type VersionedRegistry ¶
type VersionedRegistry interface {
// AddVersioned adds existing versioned feature gates to the provided registry.
//
// As of today, this method is used by AddVersionedFeaturesToExistingFeatureGates and
// ReplaceFeatureGates to take control of the features exposed by this library.
AddVersioned(in map[Feature]VersionedSpecs) error
}
VersionedRegistry represents an external versioned feature gates registry.
type VersionedSpecs ¶
type VersionedSpecs []FeatureSpec
Source Files ¶
envvar.go features.go known_features.go
Directories ¶
| Path | Synopsis |
|---|---|
| features/testing |
- Version
- v0.35.2
- Published
- Feb 27, 2026
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 1 hour ago –
Tools for package owners.