fflag

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

The fflag package implements a basic singleton pattern for the purpose of providing SPIRE with a system-wide feature flagging facility. Feature flags can be easily added here, in a single central location, and be consumed throughout the codebase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSet

func IsSet(f Flag) bool

IsSet can be used to determine whether or not a particular feature flag is set.

func Load

func Load(rc RawConfig) error

Load initializes the fflag package and configures its feature flag state based on the configuration input. Feature flags are designed to be Write-Once-Read-Many, and as such, Load can be called only once (except when Using Unload function for test scenarios, which will reset states enabling Load to be called again). Load will return an error if it is called more than once, if the configuration input cannot be parsed, or if an unrecognized flag is set.

func Unload added in v1.5.0

func Unload() error

Unload resets the feature flags states to its default values. This function is intended to be used for testing purposes only, it is not expected to be called by the normal execution of SPIRE.

Types

type Flag

type Flag string

Flag represents a feature flag and its configuration name

const (
	// FlagForcedRotation controls whether or not the new APIs and
	// extensions related to forced rotation and revocation are
	// enabled or not. See #1934 for more information.
	FlagForcedRotation Flag = "forced_rotation"

	// FlagEventsBasedCache controls whether or not to use events to update the cache
	// with what's changed since the last update.
	FlagEventsBasedCache = "events_based_cache"

	// FlagReattestToRenew controls whether or not the agent will reattest to
	// renew when the SVID expires. Some attestors, such as aws_iid, are not
	// reattestable. In those cases the agent will still renew without reattesting.
	FlagReattestToRenew Flag = "reattest_to_renew"

	// FlagTestFlag is defined purely for testing purposes.
	FlagTestFlag Flag = "i_am_a_test_flag"
)

To add a feature flag, decleare it here along with its config name. Then, add it to the `flags` package-level singleton map below, setting the appropriate default value. Flags should always be opt-in and default to false, with the only exception being flags that are in the process of being deprecated.

type RawConfig

type RawConfig []string

RawConfig is a list of feature flags that should be flipped on, in their string representations. It is loaded directly from the config file.

Jump to

Keyboard shortcuts

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