config

package
v0.13.3-mod Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

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 (
	// ChannelDefaultsConfigName is the name of config map for the default
	// configs that channels should use.
	ChannelDefaultsConfigName = "default-ch-webhook"

	// ChannelDefaulterKey is the key in the ConfigMap to get the name of the default
	// Channel CRD.
	ChannelDefaulterKey = "default-ch-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 ChannelDefaults

type ChannelDefaults struct {
	// NamespaceDefaults are the default Channels CRDs for each namespace. namespace is the
	// key, the value is the default ChannelTemplate to use.
	NamespaceDefaults map[string]*ChannelTemplateSpec `json:"namespaceDefaults,omitempty"`
	// ClusterDefaultChannel is the default Channel CRD for all namespaces that are not in
	// NamespaceDefaultChannels.
	ClusterDefault *ChannelTemplateSpec `json:"clusterDefault,omitempty"`
}

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

func NewChannelDefaultsConfigFromConfigMap

func NewChannelDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*ChannelDefaults, error)

NewChannelDefaultsConfigFromConfigMap creates a ChannelDefaults from the supplied configMap

func NewChannelDefaultsConfigFromMap

func NewChannelDefaultsConfigFromMap(data map[string]string) (*ChannelDefaults, error)

NewDefaultsConfigFromMap creates a Defaults from the supplied Map

func (*ChannelDefaults) DeepCopy

func (in *ChannelDefaults) DeepCopy() *ChannelDefaults

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

func (*ChannelDefaults) DeepCopyInto

func (in *ChannelDefaults) DeepCopyInto(out *ChannelDefaults)

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

func (*ChannelDefaults) GetChannelConfig

func (d *ChannelDefaults) GetChannelConfig(ns string) (*ChannelTemplateSpec, error)

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

type ChannelTemplateSpec

type ChannelTemplateSpec struct {
	metav1.TypeMeta `json:",inline"`

	// Spec defines the Spec to use for each channel created. Passed
	// in verbatim to the Channel CRD as Spec section.
	// +optional
	Spec *runtime.RawExtension `json:"spec,omitempty"`
}

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ChannelTemplateSpec) DeepCopy

func (in *ChannelTemplateSpec) DeepCopy() *ChannelTemplateSpec

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

func (*ChannelTemplateSpec) DeepCopyInto

func (in *ChannelTemplateSpec) DeepCopyInto(out *ChannelTemplateSpec)

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

func (*ChannelTemplateSpec) DeepCopyObject

func (in *ChannelTemplateSpec) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type Config

type Config struct {
	ChannelDefaults *ChannelDefaults
}

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