Documentation
¶
Overview ¶
Package feature provides feature flags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllDefault ¶
AllDefault returns all features from the Default set for this version of Zarf.
Types ¶
type Description ¶
type Description string
Description is an explanation of the feature, what to expect when it's enabled or disabled, the associated proposal, and any commentary or context appropriate for its stage. Descriptions are mutable, and are intended to be updated throughout the feature's development lifecycle.
type Enabled ¶
type Enabled bool
Enabled describes the state of the feature. In cases where the Default feature state and User feature states do not match, User feature state takes precedence.
type Feature ¶
type Feature struct {
// Name stores the name of the feature flag.
Name `json:"name,omitempty"`
// Description describes how the flag is used.
Description `json:"description,omitempty"`
// Enabled describes whether a feature is explicitly enabled or disabled. A feature that does not exist in any set
// is considered disabled.
Enabled `json:"enabled,omitempty"`
// Since is the version a feature is first introduced in alpha stage.
Since `json:"since,omitempty"`
// Until is the version when a deprecated feature is fully removed. Historical versions included.
Until `json:"until,omitempty"`
Stage `json:"stage,omitempty"`
}
Feature models a Default or User-configured feature flag and its metadata.
func Get ¶
Get takes a flag Name and returns the Feature struct. If the doesn't exist then it will error. It will check both the default set and the user set, and if a flag exists in both it will return the user data for it.
func GetDefault ¶
GetDefault takes a flag Name and returns the Feature struct from the default set.
type Mode ¶
type Mode string
Mode describes the two different ways that Features can be set. These are used as keys for All()'s return map.
var Default Mode = "default"
Default identifies features from Zarf's system defaults.
var User Mode = "user"
User identifies user-specified features.
type Name ¶
type Name string
Name describes the canonical identifier for the feature. It must be globally unique across all features for the full lifespan of the Zarf project. Once created, names are considered immutable and may not be removed or redacted. Should a feature evolve enough to require renaming, then a new feature can be created and the original marked as Deprecated. The Deprecated feature's Description should provide context (like the ZEP or ADR) and point users to the new feature.
type Since ¶
type Since string
Since marks the Zarf version that a feature is first released in Alpha. By convention Since is semver starting with "v": "v1.0.0".
type Stage ¶
type Stage string
Stage describes the lifecycle of a feature, as well as its production-readiness.
var ( // Alpha features are experimental and are highly subject to change. Alpha Stage = "alpha" // Beta features have solidified into a release candidate and are ready for both user feedback and realistic // workloads. Beta features are open to change before release but should be considered nearly complete. Beta Stage = "beta" // GA features have been fully released and are available for production usage. GA Stage = "ga" // Deprecated features wrap functionality that is intended to be removed in a future version. They will start as // enabled by default with a warning, and eventually be disabled by default with the Until field documenting when // the feature is expected to be fully removed. Even after the feature is, Deprecated feature structs should be // kept for documentation purposes. Deprecated Stage = "deprecated" )