config

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Overview

Package config holds the typed objects that define the schemas for ConfigMap objects that pertain to our API objects.

Index

Constants

View Source
const (
	// DefaultsConfigName is the name of config map for the default
	// configs that brokers should use
	DefaultsConfigName = "config-br-defaults"

	// BrokerDefaultsKey is the name of the key that's used for finding
	// defaults for broker configs.
	BrokerDefaultsKey = "default-br-config"
)

Variables

This section is empty.

Functions

func ToContext

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

ToContext attaches the provided Config to the provided context, returning the new context with the Config attached.

Types

type BrokerConfig added in v0.19.0

type BrokerConfig struct {
	*duckv1.KReference `json:",inline"`
	Delivery           *eventingduckv1.DeliverySpec `json:"delivery,omitempty"`
}

BrokerConfig contains configuration for a given namespace for broker. Allows configuring the reference to the config it should use and it's delivery.

func (*BrokerConfig) DeepCopy added in v0.19.0

func (in *BrokerConfig) DeepCopy() *BrokerConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BrokerConfig.

func (*BrokerConfig) DeepCopyInto added in v0.19.0

func (in *BrokerConfig) DeepCopyInto(out *BrokerConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClassAndBrokerConfig added in v0.19.0

type ClassAndBrokerConfig struct {
	BrokerClass   string `json:"brokerClass,omitempty"`
	*BrokerConfig `json:",inline"`
}

ClassAndBrokerConfig contains configuration for a given namespace for broker. Allows configuring the Class of the Broker, the reference to the config it should use and it's delivery.

func (*ClassAndBrokerConfig) DeepCopy added in v0.19.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassAndBrokerConfig.

func (*ClassAndBrokerConfig) DeepCopyInto added in v0.19.0

func (in *ClassAndBrokerConfig) DeepCopyInto(out *ClassAndBrokerConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Config

type Config struct {
	Defaults *Defaults
}

Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

func FromContextOrDefaults

func FromContextOrDefaults(ctx context.Context) *Config

FromContextOrDefaults is like FromContext, but when no Config is attached it returns a Config populated with the defaults for each of the Config fields.

type Defaults

type Defaults struct {
	// NamespaceDefaultsConfig are the default Broker Configs for each namespace.
	// Namespace is the key, the value is the KReference to the config.
	NamespaceDefaultsConfig map[string]*ClassAndBrokerConfig `json:"namespaceDefaults,omitempty"`

	// ClusterDefaultBrokerConfig is the default broker config for all the namespaces that
	// are not in NamespaceDefaultBrokerConfigs.
	ClusterDefault *ClassAndBrokerConfig `json:"clusterDefault,omitempty"`
}

Defaults includes the default values to be populated by the webhook.

func NewDefaultsConfigFromConfigMap

func NewDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*Defaults, error)

NewDefaultsConfigFromConfigMap creates a Defaults from the supplied configMap

func NewDefaultsConfigFromMap

func NewDefaultsConfigFromMap(data map[string]string) (*Defaults, error)

NewDefaultsConfigFromMap creates a Defaults from the supplied Map

func (*Defaults) DeepCopy

func (in *Defaults) DeepCopy() *Defaults

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Defaults.

func (*Defaults) DeepCopyInto

func (in *Defaults) DeepCopyInto(out *Defaults)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Defaults) GetBrokerClass added in v0.14.0

func (d *Defaults) GetBrokerClass(ns string) (string, error)

GetBrokerClass returns a namespace specific Broker Class, and if that doesn't exist, return a Cluster Default and if that doesn't exist return an error.

func (*Defaults) GetBrokerConfig

func (d *Defaults) GetBrokerConfig(ns string) (*BrokerConfig, error)

GetBrokerConfig returns a namespace specific Broker Configuration, and if that doesn't exist, return a Cluster Default and if that doesn't exist return an error.

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