config

package
v0.0.0-...-b563e91 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BucketLocationKey is the name of the configmap entry that specifies
	// loction of the bucket.
	BucketLocationKey = "location"

	// BucketServiceAccountSecretNameKey is the name of the configmap entry that specifies
	// the name of the secret that will provide the servie account with bucket access.
	// This secret must  have a key called serviceaccount that will have a value with
	// the service account with access to the bucket
	BucketServiceAccountSecretNameKey = "bucket.service.account.secret.name"

	// BucketServiceAccountSecretKeyKey is the name of the configmap entry that specifies
	// the secret key that will have a value with the service account json with access
	// to the bucket
	BucketServiceAccountSecretKeyKey = "bucket.service.account.secret.key"

	// DefaultBucketServiceFieldName defaults to a gcs bucket
	DefaultBucketServiceFieldName = "GOOGLE_APPLICATION_CREDENTIALS"

	// BucketServiceAccountFieldNameKey is the name of the configmap entry that specifies
	// the field name that should be used for the service account.
	// Valid values: GOOGLE_APPLICATION_CREDENTIALS, BOTO_CONFIG.
	BucketServiceAccountFieldNameKey = "bucket.service.account.field.name"
)
View Source
const (
	// DefaultPVCSize is the default size of the PVC to create
	DefaultPVCSize = "5Gi"

	// PVCSizeKey is the name of the configmap entry that specifies the size of the PVC to create
	PVCSizeKey = "size"

	// PVCStorageClassNameKey is the name of the configmap entry that specifies the storage class of the PVC to create
	PVCStorageClassNameKey = "storageClassName"
)
View Source
const (
	DefaultTimeoutMinutes = 60
	NoTimeoutDuration     = 0 * time.Minute

	DefaultServiceAccountValue = "default"

	DefaultManagedByLabelValue = "tekton-pipelines"

	DefaultCloudEventSinkValue = ""
)
View Source
const (
	StableAPIFields = "stable"
	AlphaAPIFields  = "alpha"

	DefaultDisableHomeEnvOverwrite          = true
	DefaultDisableWorkingDirOverwrite       = true
	DefaultDisableAffinityAssistant         = false
	DefaultDisableCredsInit                 = false
	DefaultRunningInEnvWithInjectedSidecars = true
	DefaultRequireGitSSHSecretKnownHosts    = false
	DefaultEnableTektonOciBundles           = false
	DefaultEnableCustomTasks                = false
	DefaultScopeWhenExpressionsToTask       = false
	DefaultEnableAPIFields                  = StableAPIFields
)
View Source
const (

	// DefaultTaskrunLevel determines to what level to aggregate metrics
	// when it isn't specified in configmap
	// TBD: Change to task in next
	// relase and taskrun level will be deprecated
	DefaultTaskrunLevel = "taskrun"
	// TaskrunLevelAtTaskrun specify that aggregation will be done at
	// taskrun level
	TaskrunLevelAtTaskrun = "taskrun"
	// TaskrunLevelAtTask specify that aggregation will be done at task level
	TaskrunLevelAtTask = "task"
	// TaskrunLevelAtNS specify that aggregation will be done at namespace level
	TaskrunLevelAtNS = "namespace"
	// DefaultPipelinerunLevel determines to what level to aggregate metrics
	// when it isn't specified in configmap
	// TBD: Change to pipeline in next
	// relase and pipelinerun level will be deprecated
	DefaultPipelinerunLevel = "pipelinerun"
	// PipelinerunLevelAtPipelinerun specify that aggregation will be done at
	// pipelienrun level
	PipelinerunLevelAtPipelinerun = "pipelinerun"
	// PipelinerunLevelAtPipeline specify that aggregation will be done at
	// pipeline level
	PipelinerunLevelAtPipeline = "pipeline"
	// PipelinerunLevelAtNS specify that aggregation will be done at
	// namespace level
	PipelinerunLevelAtNS = "namespace"

	// DefaultDurationTaskrunType determines what type
	// of metrics to use when we don't specify one in
	// configmap
	DefaultDurationTaskrunType = "histogram"
	// DurationTaskrunTypeHistogram specify that histogram
	// type metrics need to be use for Duration of Taskrun
	DurationTaskrunTypeHistogram = "histogram"
	// DurationTaskrunTypeLastValue specify that lastValue or
	// gauge type metrics need to be use for Duration of Taskrun
	DurationTaskrunTypeLastValue = "lastvalue"

	// DefaultDurationPipelinerunType determines what type
	// of metrics to use when we don't specify one in
	// configmap
	DefaultDurationPipelinerunType = "histogram"
	// DurationPipelinerunTypeHistogram specify that histogram
	// type metrics need to be use for Duration of Pipelinerun
	DurationPipelinerunTypeHistogram = "histogram"
	// DurationPipelinerunTypeLastValue specify that lastValue or
	// gauge type metrics need to be use for Duration of Pipelinerun
	DurationPipelinerunTypeLastValue = "lastvalue"
)

Variables

This section is empty.

Functions

func GetArtifactBucketConfigName

func GetArtifactBucketConfigName() string

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

func GetArtifactPVCConfigName

func GetArtifactPVCConfigName() string

GetArtifactPVCConfigName returns the name of the configmap containing all customizations for the storage PVC.

func GetDefaultsConfigName

func GetDefaultsConfigName() string

GetDefaultsConfigName returns the name of the configmap containing all defined defaults.

func GetFeatureFlagsConfigName

func GetFeatureFlagsConfigName() string

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

func GetMetricsConfigName

func GetMetricsConfigName() string

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

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 ArtifactBucket

type ArtifactBucket struct {
	Location                 string
	ServiceAccountSecretName string
	ServiceAccountSecretKey  string
	ServiceAccountFieldName  string
}

ArtifactBucket holds the configurations for the artifacts PVC +k8s:deepcopy-gen=true

func NewArtifactBucketFromConfigMap

func NewArtifactBucketFromConfigMap(config *corev1.ConfigMap) (*ArtifactBucket, error)

NewArtifactBucketFromConfigMap returns a Config for the given configmap

func NewArtifactBucketFromMap

func NewArtifactBucketFromMap(cfgMap map[string]string) (*ArtifactBucket, error)

NewArtifactBucketFromMap returns a Config given a map corresponding to a ConfigMap

func (*ArtifactBucket) DeepCopy

func (in *ArtifactBucket) DeepCopy() *ArtifactBucket

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

func (*ArtifactBucket) DeepCopyInto

func (in *ArtifactBucket) DeepCopyInto(out *ArtifactBucket)

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

func (*ArtifactBucket) Equals

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

Equals returns true if two Configs are identical

type ArtifactPVC

type ArtifactPVC struct {
	Size             string
	StorageClassName string
}

ArtifactPVC holds the configurations for the artifacts PVC +k8s:deepcopy-gen=true

func NewArtifactPVCFromConfigMap

func NewArtifactPVCFromConfigMap(config *corev1.ConfigMap) (*ArtifactPVC, error)

NewArtifactPVCFromConfigMap returns a Config for the given configmap

func NewArtifactPVCFromMap

func NewArtifactPVCFromMap(cfgMap map[string]string) (*ArtifactPVC, error)

NewArtifactPVCFromMap returns a Config given a map corresponding to a ConfigMap

func (*ArtifactPVC) DeepCopy

func (in *ArtifactPVC) DeepCopy() *ArtifactPVC

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

func (*ArtifactPVC) DeepCopyInto

func (in *ArtifactPVC) DeepCopyInto(out *ArtifactPVC)

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

func (*ArtifactPVC) Equals

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

Equals returns true if two Configs are identical

type Config

type Config struct {
	Defaults       *Defaults
	FeatureFlags   *FeatureFlags
	ArtifactBucket *ArtifactBucket
	ArtifactPVC    *ArtifactPVC
	Metrics        *Metrics
}

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

type FeatureFlags struct {
	DisableHomeEnvOverwrite          bool
	DisableWorkingDirOverwrite       bool
	DisableAffinityAssistant         bool
	DisableCredsInit                 bool
	RunningInEnvWithInjectedSidecars bool
	RequireGitSSHSecretKnownHosts    bool
	EnableTektonOCIBundles           bool
	EnableCustomTasks                bool
	ScopeWhenExpressionsToTask       bool
	EnableAPIFields                  string
}

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

func NewFeatureFlagsFromConfigMap

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

NewFeatureFlagsFromConfigMap returns a Config for the given configmap

func NewFeatureFlagsFromMap

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

NewFeatureFlagsFromMap returns a Config given a map corresponding to a ConfigMap

func (*FeatureFlags) DeepCopy

func (in *FeatureFlags) DeepCopy() *FeatureFlags

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

func (*FeatureFlags) DeepCopyInto

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

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

type Metrics

type Metrics struct {
	TaskrunLevel            string
	PipelinerunLevel        string
	DurationTaskrunType     string
	DurationPipelinerunType string
}

Metrics holds the configurations for the metrics +k8s:deepcopy-gen=true

func NewMetricsFromConfigMap

func NewMetricsFromConfigMap(config *corev1.ConfigMap) (*Metrics, error)

NewMetricsFromConfigMap returns a Config for the given configmap

func (*Metrics) DeepCopy

func (in *Metrics) DeepCopy() *Metrics

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

func (*Metrics) DeepCopyInto

func (in *Metrics) DeepCopyInto(out *Metrics)

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

func (*Metrics) Equals

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

Equals returns true if two Configs are identical

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