config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package 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 = "config-domain"

	// ClusterLocalDomain is the domain suffix used for cluster local
	// routes. Currently we do not yet have a way to figure out this
	// information programmatically.
	//
	// TODO(nghia): Extract this to a common network reconciler
	// setting, or find an K8s API to discover this information.
	ClusterLocalDomain = "svc.cluster.local"

	// VisibilityLabelKey is the label to indicate visibility of Route
	// and KServices.  It can be an annotation too but since users are
	// already using labels for domain, it probably best to keep this
	// consistent.
	VisibilityLabelKey = "serving.knative.dev/visibility"
	// VisibilityClusterLocal is the label value for VisibilityLabelKey
	// that will result to the Route/KService getting a cluster local
	// domain suffix.
	VisibilityClusterLocal = "cluster-local"
)

Variables

This section is empty.

Functions

func ToContext

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

Types

type Config

type Config struct {
	Domain *Domain
	GC     *gc.Config
}

+k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

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 based on configmap.UntypedStore and is used to store and watch for updates to configuration related to routes (currently only config-domain).

+k8s:deepcopy-gen=false

func NewStore

func NewStore(logger configmap.Logger, 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

func (*Store) ToContext

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

Jump to

Keyboard shortcuts

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