Documentation
¶
Overview ¶
Package featuregate provides a simple mechanism for managing feature gates in ACK controllers. It allows for default gates to be defined and optionally overridden.
Index ¶
Constants ¶
const ( // ResourceAdoption is a feature gate for enabling forced adoption of resources // by annotation ResourceAdoption = "ResourceAdoption" // ReadOnlyResources is a feature gate for enabling ReadOnly resources annotation. ReadOnlyResources = "ReadOnlyResources" // TeamLevelCARM is a feature gate for enabling CARM for team-level resources. TeamLevelCARM = "TeamLevelCARM" // ServiceLevelCARM is a feature gate for enabling CARM for service-level resources. ServiceLevelCARM = "ServiceLevelCARM" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feature ¶
type Feature struct { // Stage indicates the current development stage of the feature. Stage FeatureStage // Enabled determines if the feature is enabled. Enabled bool }
Feature represents a single feature gate with its properties.
type FeatureGates ¶
FeatureGates is a map representing a set of feature gates.
func GetDefaultFeatureGates ¶
func GetDefaultFeatureGates() FeatureGates
GetDefaultFeatureGates returns a new FeatureGates instance initialized with the default feature set. This function should be used when no overrides are needed.
func GetFeatureGatesWithOverrides ¶
func GetFeatureGatesWithOverrides(featureGateOverrides map[string]bool) (FeatureGates, error)
GetFeatureGatesWithOverrides returns a new FeatureGates instance with the default features, but with the provided overrides applied. This allows for runtime configuration of feature gates.
func (FeatureGates) GetFeature ¶
func (fg FeatureGates) GetFeature(name string) (Feature, bool)
GetFeature retrieves a feature by its name. It returns the Feature struct and a boolean indicating whether the feature was found.
func (FeatureGates) GetFeatureNames ¶
func (fg FeatureGates) GetFeatureNames() []string
GetFeatureNames returns a slice of feature names in the FeatureGates instance.
func (FeatureGates) IsEnabled ¶
func (fg FeatureGates) IsEnabled(name string) bool
IsEnabled checks if a feature with the given name is enabled. It returns true if the feature exists and is enabled, false otherwise.
type FeatureStage ¶
type FeatureStage string
FeatureStage represents the development stage of a feature.
const ( // Alpha represents a feature in early testing, potentially unstable. // Alpha features may be removed or changed at any time and are disabled // by default. Alpha FeatureStage = "alpha" // Beta represents a feature in advanced testing, more stable than alpha. // Beta features are enabled by default. Beta FeatureStage = "beta" // GA represents a feature that is generally available and stable. GA FeatureStage = "ga" )