Documentation ¶
Index ¶
- Constants
- func ToContext(ctx context.Context, c Flags) context.Context
- func ValidateAPIFields(ctx context.Context, featureName string, object interface{}, ...) (errs *apis.FieldError)
- func ValidateAnnotations(ctx context.Context, featureName string, object metav1.Object, ...) (errs *apis.FieldError)
- type Flag
- type Flags
- type Store
Constants ¶
const ( KReferenceGroup = "kreference-group" DeliveryTimeout = "delivery-timeout" KReferenceMapping = "kreference-mapping" )
const (
// FlagsConfigName is the name of config map containing the experimental features flags
FlagsConfigName = "config-features"
)
Variables ¶
This section is empty.
Functions ¶
func ToContext ¶
ToContext attaches the provided Flags to the provided context, returning the new context with the Flags attached.
func ValidateAPIFields ¶
func ValidateAPIFields(ctx context.Context, featureName string, object interface{}, experimentalFields ...string) (errs *apis.FieldError)
ValidateAPIFields checks that the experimental features fields are disabled if the experimental flag is disabled. experimentalFields can contain a string with dots, to identify sub-structs, like "Destination.Ref.APIVersion"
func ValidateAnnotations ¶
func ValidateAnnotations(ctx context.Context, featureName string, object metav1.Object, experimentalAnnotations ...string) (errs *apis.FieldError)
ValidateAnnotations checks that the experimental features annotations are disabled if the experimental flag is disabled
Types ¶
type Flag ¶
type Flag string
Flag is a string value which can be either Enabled, Disabled, or Allowed.
const ( // Enabled turns on an optional behavior. Enabled Flag = "Enabled" // Disabled turns off an optional behavior. Disabled Flag = "Disabled" // Allowed neither explicitly disables or enables a behavior. // eg. allow a client to control behavior with an annotation or allow a new value through validation. Allowed Flag = "Allowed" )
type Flags ¶
Flags is a map containing all the enabled/disabled flags for the experimental features. Missing entry in the map means feature is equal to feature not enabled.
func FromContext ¶
FromContext extracts a Config from the provided context.
func FromContextOrDefaults ¶
FromContextOrDefaults is like FromContext, but when no Flags is attached it returns an empty Flags.
func NewFlagsConfigFromConfigMap ¶
NewFlagsConfigFromConfigMap creates a Flags from the supplied configMap
func NewFlagsConfigFromMap ¶
NewFlagsConfigFromMap creates a Flags from the supplied Map
type Store ¶
type Store struct {
*configmap.UntypedStore
}
Store is a typed wrapper around configmap.Untyped store to handle our configmaps. +k8s:deepcopy-gen=false
func NewStore ¶
NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.