features

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Values for PreRelease.
	Alpha = prerelease("ALPHA")
	Beta  = prerelease("BETA")
	GA    = prerelease("")

	// Deprecated
	Deprecated = prerelease("DEPRECATED")
)

Variables

This section is empty.

Functions

func AddFeaturesToExistingFeatureGates

func AddFeaturesToExistingFeatureGates(registry Registry) error

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"
)

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

type Gates interface {
	// Enabled returns true if the key is enabled.
	Enabled(key Feature) bool
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL