features

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SupportedFeatureList is the global and constant supported feature list.
	SupportedFeatureList = []Feature{
		{
			Name:          EnableOpenKruiseFeature,
			Description:   "This feature enables open kruise as an optional provider",
			DefaultEnable: false,
			Stage:         Beta,
		},
		{
			Name:          EnableForceUpdate,
			Description:   "This feature enables force resolve version conflict due to operator update",
			DefaultEnable: false,
			Stage:         Beta,
		},
	}
)

Functions

This section is empty.

Types

type Feature

type Feature struct {
	Name          FeatureName
	Description   string
	Enabled       bool
	DefaultEnable bool
	Stage         FeatureStage
}

Feature defines a feature and its status.

func (*Feature) DeepCopy

func (f *Feature) DeepCopy() *Feature

DeepCopy returns a pointer to a deep copy of a feature struct.

type FeatureManager

type FeatureManager struct {
	// contains filtered or unexported fields
}

FeatureManager is the manager of operator features.

func GetFeatureManager

func GetFeatureManager() *FeatureManager

GetFeatureManager returns the Feature Manager Struct. Should not be modified after initialization.

func InitFeatureManager

func InitFeatureManager(supportedFeatureList []Feature, featureGateString string) *FeatureManager

InitFeatureManager initializes the FeatureManager with the current supported Features and also parses the feature gate string.

func InitFeatureManagerWithSupportedFeatures

func InitFeatureManagerWithSupportedFeatures(supportedFeatureList []Feature) *FeatureManager

InitFeatureManagerWithSupportedFeatures initializes the FeatureManager with the current supported Features.

func NewRisingWaveFeatureManager

func NewRisingWaveFeatureManager() *FeatureManager

NewRisingWaveFeatureManager is a helper function that returns a pointer to an instance of the FeatureManager.

func (*FeatureManager) DisableFeature

func (m *FeatureManager) DisableFeature(name FeatureName) error

DisableFeature takes in a feature name and disables it if it exists, if it does not it returns an error.

func (*FeatureManager) EnableFeature

func (m *FeatureManager) EnableFeature(name FeatureName) error

EnableFeature takes in a feature name and enables it if it exists, if it does not it returns an error.

func (*FeatureManager) GetFeature

func (m *FeatureManager) GetFeature(name FeatureName) (Feature, error)

GetFeature takes in a feature name and return a copy of the feature struct with all its meta information.

func (*FeatureManager) GetNumOfFeatures

func (m *FeatureManager) GetNumOfFeatures() int

GetNumOfFeatures returns the number of features in the featureManager.

func (*FeatureManager) IsFeatureEnabled

func (m *FeatureManager) IsFeatureEnabled(name FeatureName) bool

IsFeatureEnabled takes in a feature name and checks if it is enabled, returns a bool, nil if it exists, and a false,error if it does not exist in the featureManager.

func (*FeatureManager) IsFeatureExist

func (m *FeatureManager) IsFeatureExist(featureName FeatureName) bool

IsFeatureExist returns true if the feature exists in the featureManager, else returns false.

func (*FeatureManager) ListDisabledFeatures

func (m *FeatureManager) ListDisabledFeatures() []Feature

ListDisabledFeatures lists all disabled features, returns a copy of list of feature structs.

func (*FeatureManager) ListEnabledFeatures

func (m *FeatureManager) ListEnabledFeatures() []Feature

ListEnabledFeatures lists all enabled features, returns a copy of the list of feature structs.

func (*FeatureManager) ListFeatures

func (m *FeatureManager) ListFeatures() []Feature

ListFeatures lists all features, returns a copy of the list of feature structs.

func (*FeatureManager) ParseFromFeatureGateString

func (m *FeatureManager) ParseFromFeatureGateString(featureGateString string) error

ParseFromFeatureGateString takes in a feature gate string that is given as a CLI argument, parses the features and updates the featureManager. e.g if command line argument is --feature-gates=enableOpenKruise=true,otherOption=false, it will set the feature enableOpenKruise as true if and only if it exists. if a feature is not supported, it is simply ignored.

type FeatureName

type FeatureName string

FeatureName is an alias of the string.

const (
	EnableOpenKruiseFeature FeatureName = "EnableOpenKruise"
	EnableForceUpdate       FeatureName = "EnableForceUpdate"
)

Valid feature names.

type FeatureStage

type FeatureStage string

FeatureStage is the stage of features, e.g., alpha, beta, GA. See Valid feature stages below.

const (
	Alpha FeatureStage = "Alpha"
	Beta  FeatureStage = "Beta"
)

Valid feature stages.

Jump to

Keyboard shortcuts

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