sugar

package
v0.40.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// NamespaceSelectorKey is the name of the configuration
	// entry that specifies a LabelSelector to control which namespaces
	// the Sugar Controller operates on.
	NamespaceSelectorKey = "namespace-selector"

	// TriggerSelectorKey is the name of the configuration
	// entry that specifies a LabelSelector to control which triggers
	// the Sugar Controller operates on.
	TriggerSelectorKey = "trigger-selector"
)
View Source
const ConfigName = "config-sugar"

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, c *Config) context.Context

ToContext adds config to given context.

Types

type Config

type Config struct {
	// NamespaceSelector specifies a LabelSelector which
	// determines which namespaces the Sugar Controller should operate upon
	NamespaceSelector *metav1.LabelSelector

	// TriggerSelector specifies a LabelSelector which
	// determines which triggers the Sugar Controller should operate upon
	TriggerSelector *metav1.LabelSelector
}

Config holds the collection of configurations that we attach to contexts.

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

func NewConfigFromConfigMap

func NewConfigFromConfigMap(configMap *corev1.ConfigMap) (*Config, error)

NewConfigFromConfigMap creates a Config from the supplied ConfigMap

func NewConfigFromMap

func NewConfigFromMap(data map[string]string) (*Config, error)

NewConfigFromMap creates a Config from the supplied data.

func (*Config) DeepCopy

func (c *Config) DeepCopy() *Config

type Store

type Store struct {
	*configmap.UntypedStore
}

Store is a typed wrapper around configmap.Untyped store to handle our configmaps.

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) Load

func (s *Store) Load() *Config

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