config

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 88

Documentation

Index

Constants

View Source
const (
	DefaultTimeoutMinutes = 60
	NoTimeoutDuration     = 0 * time.Minute

	DefaultManagedByLabelValue = "tekton-pipelines"

	DefaultCloudEventSinkValue = ""
)
View Source
const (
	DefaultDisableHomeEnvOverwrite          = false
	DefaultDisableWorkingDirOverwrite       = false
	DefaultDisableAffinityAssistant         = false
	DefaultRunningInEnvWithInjectedSidecars = true
)

Variables

This section is empty.

Functions

func GetDefaultsConfigName added in v0.12.0

func GetDefaultsConfigName() string

GetBucketConfigName returns the name of the configmap containing all customizations for the storage bucket.

func GetFeatureFlagsConfigName added in v0.14.0

func GetFeatureFlagsConfigName() string

GetFeatureFlagsConfigName returns the name of the configmap containing all feature flags.

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 Config

type Config struct {
	Defaults     *Defaults
	FeatureFlags *FeatureFlags
}

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 {
	DefaultTimeoutMinutes      int
	DefaultServiceAccount      string
	DefaultManagedByLabelValue string
	DefaultPodTemplate         *pod.Template
	DefaultCloudEventsSink     string
}

Defaults holds the default configurations +k8s:deepcopy-gen=true

func NewDefaultsFromConfigMap

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

NewDefaultsFromConfigMap returns a Config for the given configmap

func NewDefaultsFromMap

func NewDefaultsFromMap(cfgMap map[string]string) (*Defaults, error)

NewDefaultsFromMap returns a Config given a map corresponding to a ConfigMap

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

func (cfg *Defaults) Equals(other *Defaults) bool

Equals returns true if two Configs are identical

type FeatureFlags added in v0.14.0

type FeatureFlags struct {
	DisableHomeEnvOverwrite          bool
	DisableWorkingDirOverwrite       bool
	DisableAffinityAssistant         bool
	RunningInEnvWithInjectedSidecars bool
}

FeatureFlags holds the features configurations +k8s:deepcopy-gen=true

func NewFeatureFlagsFromConfigMap added in v0.14.0

func NewFeatureFlagsFromConfigMap(config *corev1.ConfigMap) (*FeatureFlags, error)

NewFeatureFlagsFromConfigMap returns a Config for the given configmap

func NewFeatureFlagsFromMap added in v0.14.0

func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error)

NewFeatureFlagsFromMap returns a Config given a map corresponding to a ConfigMap

func (*FeatureFlags) DeepCopy added in v0.14.0

func (in *FeatureFlags) DeepCopy() *FeatureFlags

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

func (*FeatureFlags) DeepCopyInto added in v0.14.0

func (in *FeatureFlags) DeepCopyInto(out *FeatureFlags)

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

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