featuregate

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFeatureGates = NewFeatureGate()

Default feature gates instance

View Source
var (
	VirtualNet = Feature("VirtualNet")
)

Define all available features here

Functions

func Enabled

func Enabled(name Feature) bool

Enabled checks if a feature is enabled in the default feature gates

func SetFromMap

func SetFromMap(featureMap map[string]bool) error

SetFromMap sets feature gate values from a map in the default feature gates

Types

type Feature

type Feature string

Feature represents a feature gate name

type FeatureGate

type FeatureGate interface {
	// Enabled returns true if the key is enabled
	Enabled(key Feature) bool
	// KnownFeatures returns a slice of strings describing the known features
	KnownFeatures() []string
}

FeatureGate indicates whether a given feature is enabled or not

type FeatureSpec

type FeatureSpec struct {
	// Default is the default enablement state for the feature
	Default bool
	// LockToDefault indicates the feature cannot be changed from its default
	LockToDefault bool
	// Stage indicates the maturity level of the feature
	Stage FeatureStage
}

FeatureSpec describes a feature and its properties

type FeatureStage

type FeatureStage string

FeatureStage represents the maturity level of a feature

const (
	// Alpha means the feature is experimental and disabled by default
	Alpha FeatureStage = "ALPHA"
	// Beta means the feature is more stable but still might change and is disabled by default
	Beta FeatureStage = "BETA"
	// GA means the feature is generally available and enabled by default
	GA FeatureStage = ""
)

type MutableFeatureGate

type MutableFeatureGate interface {
	FeatureGate

	// SetFromMap sets feature gate values from a map[string]bool
	SetFromMap(m map[string]bool) error
	// Add adds features to the feature gate
	Add(features map[Feature]FeatureSpec) error
	// String returns a string representing the feature gate configuration
	String() string
}

MutableFeatureGate allows for dynamic feature gate configuration

func NewFeatureGate

func NewFeatureGate() MutableFeatureGate

NewFeatureGate creates a new feature gate with the default features

Jump to

Keyboard shortcuts

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