feature

package
v0.40.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Index

Constants

View Source
const (
	KReferenceGroup     = "kreference-group"
	DeliveryRetryAfter  = "delivery-retryafter"
	DeliveryTimeout     = "delivery-timeout"
	KReferenceMapping   = "kreference-mapping"
	NewTriggerFilters   = "new-trigger-filters"
	TransportEncryption = "transport-encryption"
	EvenTypeAutoCreate  = "eventtype-auto-create"
	OIDCAuthentication  = "authentication-oidc"
)
View Source
const (
	// FlagsConfigName is the name of config map containing the experimental features flags
	FlagsConfigName = "config-features"
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, c Flags) context.Context

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"
	// Strict is only applicable to the TransportEncryption feature.
	// The following applies:
	// - Addressables must not accept events to non-HTTPS endpoints
	// - Addressables must only advertise HTTPS endpoints
	Strict Flag = "Strict"
	// Permissive is only applicable to the TransportEncryption feature.
	// The following applies:
	// - Addressables should accept events at both HTTP and HTTPS endpoints
	// - Addressables should advertise both HTTP and HTTPS endpoints
	// - Producers should prefer to send events to HTTPS endpoints, if available
	Permissive Flag = "Permissive"
)

type Flags

type Flags map[string]Flag

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

func FromContext(ctx context.Context) Flags

FromContext extracts a Config from the provided context.

func FromContextOrDefaults

func FromContextOrDefaults(ctx context.Context) Flags

FromContextOrDefaults is like FromContext, but when no Flags is attached it returns an empty Flags.

func NewFlagsConfigFromConfigMap

func NewFlagsConfigFromConfigMap(config *corev1.ConfigMap) (Flags, error)

NewFlagsConfigFromConfigMap creates a Flags from the supplied configMap

func NewFlagsConfigFromMap

func NewFlagsConfigFromMap(data map[string]string) (Flags, error)

NewFlagsConfigFromMap creates a Flags from the supplied Map

func (Flags) IsAllowed

func (e Flags) IsAllowed(featureName string) bool

IsAllowed returns true if the feature is enabled or allowed

func (Flags) IsDisabled added in v0.37.5

func (e Flags) IsDisabled(featureName string) bool

IsDisabled returns true if the feature is disabled

func (Flags) IsDisabledTransportEncryption added in v0.38.0

func (e Flags) IsDisabledTransportEncryption() bool

IsDisabledTransportEncryption returns true if the TransportEncryption feature is in Disabled mode.

func (Flags) IsEnabled

func (e Flags) IsEnabled(featureName string) bool

IsEnabled returns true if the feature is enabled

func (Flags) IsOIDCAuthentication added in v0.39.0

func (e Flags) IsOIDCAuthentication() bool

func (Flags) IsPermissiveTransportEncryption added in v0.37.0

func (e Flags) IsPermissiveTransportEncryption() bool

IsPermissiveTransportEncryption returns true if the TransportEncryption feature is in Permissive mode.

func (Flags) IsStrictTransportEncryption added in v0.37.0

func (e Flags) IsStrictTransportEncryption() bool

IsStrictTransportEncryption returns true if the TransportEncryption feature is in Strict mode.

func (Flags) String added in v0.38.0

func (e Flags) String() string

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

func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store

NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.

func (*Store) IsAllowed

func (s *Store) IsAllowed(featureName string) bool

IsAllowed is a shortcut for Load().IsAllowed(featureName)

func (*Store) IsEnabled

func (s *Store) IsEnabled(featureName string) bool

IsEnabled is a shortcut for Load().IsEnabled(featureName)

func (*Store) Load

func (s *Store) Load() Flags

Load creates a Config from the current config state of the Store.

func (*Store) ToContext

func (s *Store) ToContext(ctx context.Context) context.Context

ToContext attaches the current Config state to the provided context.

Jump to

Keyboard shortcuts

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