config

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 58

Documentation

Overview

Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Route controller depends.

Index

Constants

View Source
const (
	// DomainConfigName is the config map name for the domain configuration.
	DomainConfigName = "config-domain"
	// DefaultDomain holds the domain that Route's live under by default
	// when no label selector-based options apply.
	DefaultDomain = "example.com"
)

Variables

This section is empty.

Functions

func ToContext

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

ToContext stores the configuration Config in the passed context.

Types

type Config

type Config struct {
	Domain   *Domain
	GC       *gc.Config
	Network  *network.Config
	Features *cfgmap.Features
}

Config is the configuration for the route reconciler. +k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

FromContext obtains a Config injected into the passed context.

func FromContextOrDefaults added in v0.18.0

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 Domain

type Domain struct {
	// Domains map from domain to label selector.  If a route has
	// labels matching a particular selector, it will use the
	// corresponding domain.  If multiple selectors match, we choose
	// the most specific selector.
	Domains map[string]*LabelSelector
}

Domain maps domains to routes by matching the domain's label selectors to the route's labels.

func NewDomainFromConfigMap

func NewDomainFromConfigMap(configMap *corev1.ConfigMap) (*Domain, error)

NewDomainFromConfigMap creates a Domain from the supplied ConfigMap

func (*Domain) DeepCopy

func (in *Domain) DeepCopy() *Domain

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

func (*Domain) DeepCopyInto

func (in *Domain) DeepCopyInto(out *Domain)

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

func (*Domain) LookupDomainForLabels

func (c *Domain) LookupDomainForLabels(labels map[string]string) string

LookupDomainForLabels returns a domain given a set of labels. Since we reject configuration without a default domain, this should always return a value.

type LabelSelector

type LabelSelector struct {
	Selector map[string]string `json:"selector,omitempty"`
}

LabelSelector represents map of {key,value} pairs. A single {key,value} in the map is equivalent to a requirement key == value. The requirements are ANDed.

func (*LabelSelector) DeepCopy

func (in *LabelSelector) DeepCopy() *LabelSelector

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

func (*LabelSelector) DeepCopyInto

func (in *LabelSelector) DeepCopyInto(out *LabelSelector)

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

func (*LabelSelector) Matches

func (s *LabelSelector) Matches(labels map[string]string) bool

Matches returns whether the given labels meet the requirement of the selector.

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(ctx context.Context, onAfterStore ...func(name string, value interface{})) *Store

NewStore creates a configmap.UntypedStore based config store.

logger must be non-nil implementation of configmap.Logger (commonly used loggers conform)

onAfterStore is a variadic list of callbacks to run after the ConfigMap has been processed and stored.

See also: configmap.NewUntypedStore().

func (*Store) Load

func (s *Store) Load() *Config

Load creates a Config for this store.

func (*Store) ToContext

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

ToContext stores the configuration Store in the passed context.

Jump to

Keyboard shortcuts

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