Documentation ¶
Index ¶
- Constants
- Variables
- func GetDefaultsConfigName() string
- func GetEventsConfigName() string
- func GetFeatureFlagsConfigName() string
- func GetMetricsConfigName() string
- func GetSpireConfigName() string
- func GetTracingConfigName() string
- func GetVerificationNoMatchPolicy(ctx context.Context) string
- func IsSpireEnabled(ctx context.Context) bool
- func NewSpireConfigFromConfigMap(configMap *corev1.ConfigMap) (*sc.SpireConfig, error)
- func NewSpireConfigFromMap(data map[string]string) (*sc.SpireConfig, error)
- func ToContext(ctx context.Context, c *Config) context.Context
- func ValidateEnabledAPIFields(ctx context.Context, featureName string, wantVersion string) *apis.FieldError
- type Config
- type Defaults
- type EventFormat
- type EventFormats
- type Events
- type FeatureFlags
- type Metrics
- type PerFeatureFlag
- type Store
- type Tracing
Constants ¶
const ( // DefaultTimeoutMinutes is used when no timeout is specified. DefaultTimeoutMinutes = 60 // NoTimeoutDuration is used when a pipeline or task should never time out. NoTimeoutDuration = 0 * time.Minute // DefaultServiceAccountValue is the SA used when one is not specified. DefaultServiceAccountValue = "default" // DefaultManagedByLabelValue is the value for the managed-by label that is used by default. DefaultManagedByLabelValue = "tekton-pipelines" // DefaultCloudEventSinkValue is the default value for cloud event sinks. DefaultCloudEventSinkValue = "" // DefaultMaxMatrixCombinationsCount is used when no max matrix combinations count is specified. DefaultMaxMatrixCombinationsCount = 256 // DefaultResolverTypeValue is used when no default resolver type is specified DefaultResolverTypeValue = "" // default resource requirements, will be applied to all the containers, which has empty resource requirements ResourceRequirementDefaultContainerKey = "default" DefaultImagePullBackOffTimeout = 0 * time.Minute )
const ( // StableAPIFields is the value used for API-driven features of stable stability level. StableAPIFields = "stable" // AlphaAPIFields is the value used for API-driven features of alpha stability level. AlphaAPIFields = "alpha" // BetaAPIFields is the value used for API-driven features of beta stability level. BetaAPIFields = "beta" // Features of "alpha" stability level are disabled by default DefaultAlphaFeatureEnabled = false // Features of "beta" stability level are disabled by default DefaultBetaFeatureEnabled = false // Features of "stable" stability level are enabled by default DefaultStableFeatureEnabled = true // FailNoMatchPolicy is the value used for "trusted-resources-verification-no-match-policy" to fail TaskRun or PipelineRun // when no matching policies are found FailNoMatchPolicy = "fail" // WarnNoMatchPolicy is the value used for "trusted-resources-verification-no-match-policy" to log warning and skip verification // when no matching policies are found WarnNoMatchPolicy = "warn" // IgnoreNoMatchPolicy is the value used for "trusted-resources-verification-no-match-policy" to skip verification // when no matching policies are found IgnoreNoMatchPolicy = "ignore" // CoscheduleWorkspaces is the value used for "coschedule" to coschedule PipelineRun Pods sharing the same PVC workspaces to the same node CoscheduleWorkspaces = "workspaces" // CoschedulePipelineRuns is the value used for "coschedule" to coschedule all PipelineRun Pods to the same node CoschedulePipelineRuns = "pipelineruns" // CoscheduleIsolatePipelineRun is the value used for "coschedule" to coschedule all PipelineRun Pods to the same node, and only allows one PipelineRun to run on a node at a time CoscheduleIsolatePipelineRun = "isolate-pipelinerun" // CoscheduleDisabled is the value used for "coschedule" to disabled PipelineRun Pods coschedule CoscheduleDisabled = "disabled" // ResultExtractionMethodTerminationMessage is the value used for "results-from" as a way to extract results from tasks using kubernetes termination message. ResultExtractionMethodTerminationMessage = "termination-message" // ResultExtractionMethodSidecarLogs is the value used for "results-from" as a way to extract results from tasks using sidecar logs. ResultExtractionMethodSidecarLogs = "sidecar-logs" // DefaultDisableAffinityAssistant is the default value for "disable-affinity-assistant". DefaultDisableAffinityAssistant = false // DefaultDisableCredsInit is the default value for "disable-creds-init". DefaultDisableCredsInit = false // DefaultRunningInEnvWithInjectedSidecars is the default value for "running-in-environment-with-injected-sidecars". DefaultRunningInEnvWithInjectedSidecars = true // DefaultAwaitSidecarReadiness is the default value for "await-sidecar-readiness". DefaultAwaitSidecarReadiness = true // DefaultDisableInlineSpec is the default value of "disable-inline-spec" DefaultDisableInlineSpec = "" // DefaultRequireGitSSHSecretKnownHosts is the default value for "require-git-ssh-secret-known-hosts". DefaultRequireGitSSHSecretKnownHosts = false // DefaultEnableTektonOciBundles is the default value for "enable-tekton-oci-bundles". DefaultEnableTektonOciBundles = false // DefaultEnableAPIFields is the default value for "enable-api-fields". DefaultEnableAPIFields = BetaAPIFields // DefaultSendCloudEventsForRuns is the default value for "send-cloudevents-for-runs". DefaultSendCloudEventsForRuns = false // EnforceNonfalsifiabilityWithSpire is the value used for "enable-nonfalsifiability" when SPIRE is used to enable non-falsifiability. EnforceNonfalsifiabilityWithSpire = "spire" // EnforceNonfalsifiabilityNone is the value used for "enable-nonfalsifiability" when non-falsifiability is not enabled. EnforceNonfalsifiabilityNone = "none" // DefaultEnforceNonfalsifiability is the default value for "enforce-nonfalsifiability". DefaultEnforceNonfalsifiability = EnforceNonfalsifiabilityNone // DefaultNoMatchPolicyConfig is the default value for "trusted-resources-verification-no-match-policy". DefaultNoMatchPolicyConfig = IgnoreNoMatchPolicy // DefaultEnableProvenanceInStatus is the default value for "enable-provenance-status". DefaultEnableProvenanceInStatus = true // DefaultResultExtractionMethod is the default value for ResultExtractionMethod DefaultResultExtractionMethod = ResultExtractionMethodTerminationMessage // DefaultMaxResultSize is the default value in bytes for the size of a result DefaultMaxResultSize = 4096 // DefaultSetSecurityContext is the default value for "set-security-context" DefaultSetSecurityContext = false // DefaultCoschedule is the default value for coschedule DefaultCoschedule = CoscheduleWorkspaces // KeepPodOnCancel is the flag used to enable cancelling a pod using the entrypoint, and keep pod on cancel KeepPodOnCancel = "keep-pod-on-cancel" // EnableCELInWhenExpression is the flag to enabled CEL in WhenExpression EnableCELInWhenExpression = "enable-cel-in-whenexpression" // EnableStepActions is the flag to enable the use of StepActions in Steps EnableStepActions = "enable-step-actions" // EnableArtifacts is the flag to enable the use of Artifacts in Steps EnableArtifacts = "enable-artifacts" // EnableParamEnum is the flag to enabled enum in params EnableParamEnum = "enable-param-enum" // EnableConciseResolverSyntax is the flag to enable concise resolver syntax EnableConciseResolverSyntax = "enable-concise-resolver-syntax" // EnableKubernetesSidecar is the flag to enable kubernetes sidecar support EnableKubernetesSidecar = "enable-kubernetes-sidecar" // DefaultEnableKubernetesSidecar is the default value for EnableKubernetesSidecar DefaultEnableKubernetesSidecar = false // DisableInlineSpec is the flag to disable embedded spec // in Taskrun or Pipelinerun DisableInlineSpec = "disable-inline-spec" )
const ( // DefaultTaskrunLevel determines to what level to aggregate metrics // when it isn't specified in configmap DefaultTaskrunLevel = TaskrunLevelAtTask // 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 DefaultPipelinerunLevel = PipelinerunLevelAtPipeline // DefaultRunningPipelinerunLevel determines to what level to aggregate metrics // when it isn't specified in configmap DefaultRunningPipelinerunLevel = "" // PipelinerunLevelAtPipelinerun specify that aggregation will be done at // pipelinerun 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" )
const ( // SpireConfigMapName is the name of the trusted resources configmap SpireConfigMapName = "config-spire" // SpireTrustDomain is the key to extract out the SPIRE trust domain to use SpireTrustDomain = "spire-trust-domain" // SpireSocketPath is the key to extract out the SPIRE agent socket for SPIFFE workload API SpireSocketPath = "spire-socket-path" // SpireServerAddr is the key to extract out the SPIRE server address for workload/node registration SpireServerAddr = "spire-server-addr" // SpireNodeAliasPrefix is the key to extract out the SPIRE node alias prefix to use SpireNodeAliasPrefix = "spire-node-alias-prefix" // SpireTrustDomainDefault is the default value for the SpireTrustDomain SpireTrustDomainDefault = "example.org" // SpireSocketPathDefault is the default value for the SpireSocketPath SpireSocketPathDefault = "unix:///spiffe-workload-api/spire-agent.sock" // SpireServerAddrDefault is the default value for the SpireServerAddr SpireServerAddrDefault = "spire-server.spire.svc.cluster.local:8081" // SpireNodeAliasPrefixDefault is the default value for the SpireNodeAliasPrefix SpireNodeAliasPrefixDefault = "/tekton-node/" )
const (
// DefaultEndpoint is the default destination for sending traces
DefaultEndpoint = "http://jaeger-collector.jaeger.svc.cluster.local:14268/api/traces"
)
Variables ¶
var ( // DefaultFormat is the default value for "formats" DefaultFormats = EventFormats{FormatTektonV1: struct{}{}} // DefaultConfig holds all the default configurations for the config. DefaultEvents, _ = NewEventsFromMap(map[string]string{}) )
var (
DefaultFeatureFlags, _ = NewFeatureFlagsFromMap(map[string]string{})
// DefaultEnableKeepPodOnCancel is the default PerFeatureFlag value for "keep-pod-on-cancel"
DefaultEnableKeepPodOnCancel = PerFeatureFlag{
Name: KeepPodOnCancel,
Stability: AlphaAPIFields,
Enabled: DefaultAlphaFeatureEnabled,
}
// DefaultEnableCELInWhenExpression is the default PerFeatureFlag value for EnableCELInWhenExpression
DefaultEnableCELInWhenExpression = PerFeatureFlag{
Name: EnableCELInWhenExpression,
Stability: AlphaAPIFields,
Enabled: DefaultAlphaFeatureEnabled,
}
// DefaultEnableStepActions is the default PerFeatureFlag value for EnableStepActions
DefaultEnableStepActions = PerFeatureFlag{
Name: EnableStepActions,
Stability: BetaAPIFields,
Enabled: DefaultBetaFeatureEnabled,
}
// DefaultEnableArtifacts is the default PerFeatureFlag value for EnableArtifacts
DefaultEnableArtifacts = PerFeatureFlag{
Name: EnableArtifacts,
Stability: AlphaAPIFields,
Enabled: DefaultAlphaFeatureEnabled,
}
// DefaultEnableParamEnum is the default PerFeatureFlag value for EnableParamEnum
DefaultEnableParamEnum = PerFeatureFlag{
Name: EnableParamEnum,
Stability: AlphaAPIFields,
Enabled: DefaultAlphaFeatureEnabled,
}
// DefaultEnableConciseResolverSyntax is the default PerFeatureFlag value for EnableConciseResolverSyntax
DefaultEnableConciseResolverSyntax = PerFeatureFlag{
Name: EnableConciseResolverSyntax,
Stability: AlphaAPIFields,
Enabled: DefaultAlphaFeatureEnabled,
}
)
DefaultFeatureFlags holds all the default configurations for the feature flags configmap.
var DefaultConfig, _ = NewDefaultsFromMap(map[string]string{})
DefaultConfig holds all the default configurations for the config.
var DefaultMetrics, _ = newMetricsFromMap(map[string]string{})
DefaultMetrics holds all the default configurations for the metrics.
var DefaultSpire, _ = NewSpireConfigFromMap(map[string]string{})
DefaultSpire hols all the default configurations for the spire.
var DefaultTracing, _ = newTracingFromMap(map[string]string{})
DefaultTracing holds all the default configurations for tracing
Functions ¶
func GetDefaultsConfigName ¶ added in v0.12.0
func GetDefaultsConfigName() string
GetDefaultsConfigName returns the name of the configmap containing all defined defaults.
func GetEventsConfigName ¶ added in v0.50.0
func GetEventsConfigName() string
GetEventsConfigName returns the name of the configmap containing all feature flags.
func GetFeatureFlagsConfigName ¶ added in v0.14.0
func GetFeatureFlagsConfigName() string
GetFeatureFlagsConfigName returns the name of the configmap containing all feature flags.
func GetMetricsConfigName ¶ added in v0.28.0
func GetMetricsConfigName() string
GetMetricsConfigName returns the name of the configmap containing all customizations for the storage bucket.
func GetSpireConfigName ¶ added in v0.45.0
func GetSpireConfigName() string
GetSpireConfigName returns the name of Spire ConfigMap
func GetTracingConfigName ¶ added in v0.52.0
func GetTracingConfigName() string
GetTracingConfigName returns the name of the configmap containing all customizations for tracing
func GetVerificationNoMatchPolicy ¶ added in v0.47.0
GetVerificationNoMatchPolicy returns the "trusted-resources-verification-no-match-policy" value
func IsSpireEnabled ¶ added in v0.47.0
IsSpireEnabled checks if non-falsifiable provenance is enforced through SPIRE
func NewSpireConfigFromConfigMap ¶ added in v0.45.0
func NewSpireConfigFromConfigMap(configMap *corev1.ConfigMap) (*sc.SpireConfig, error)
NewSpireConfigFromConfigMap creates a Config from the supplied ConfigMap
func NewSpireConfigFromMap ¶ added in v0.45.0
func NewSpireConfigFromMap(data map[string]string) (*sc.SpireConfig, error)
NewSpireConfigFromMap creates a Config from the supplied map
func ToContext ¶
ToContext attaches the provided Config to the provided context, returning the new context with the Config attached.
func ValidateEnabledAPIFields ¶ added in v0.53.0
func ValidateEnabledAPIFields(ctx context.Context, featureName string, wantVersion string) *apis.FieldError
ValidateEnabledAPIFields checks that the enable-api-fields feature gate is set to a version at most as stable as wantVersion, if not, returns an error stating which feature is dependent on the version and what the current version actually is.
Types ¶
type Config ¶
type Config struct { Defaults *Defaults FeatureFlags *FeatureFlags Metrics *Metrics SpireConfig *sc.SpireConfig Events *Events Tracing *Tracing }
Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false
func FromContext ¶
FromContext extracts a Config from the provided context.
func FromContextOrDefaults ¶
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 DefaultAAPodTemplate *pod.AffinityAssistantTemplate DefaultCloudEventsSink string // Deprecated. Use the events package instead DefaultTaskRunWorkspaceBinding string DefaultMaxMatrixCombinationsCount int DefaultForbiddenEnv []string DefaultResolverType string DefaultContainerResourceRequirements map[string]corev1.ResourceRequirements DefaultImagePullBackOffTimeout time.Duration }
Defaults holds the default configurations +k8s:deepcopy-gen=true
func NewDefaultsFromConfigMap ¶
NewDefaultsFromConfigMap returns a Config for the given configmap
func NewDefaultsFromMap ¶
NewDefaultsFromMap returns a Config given a map corresponding to a ConfigMap
func (*Defaults) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Defaults.
func (*Defaults) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type EventFormat ¶ added in v0.50.0
type EventFormat string
EventFormat is a single event format
const ( // FormatTektonV1 represents the "v1" events in Tekton custom format FormatTektonV1 EventFormat = "tektonv1" // DefaultSink is the default value for "sink" DefaultSink = "" )
func (EventFormat) IsValid ¶ added in v0.50.0
func (ef EventFormat) IsValid() bool
IsValid returns true is the EventFormat one of the valid ones
func (EventFormat) String ¶ added in v0.50.0
func (ef EventFormat) String() string
String is a string representation of an EventFormat
type EventFormats ¶ added in v0.50.0
type EventFormats map[EventFormat]struct{}
EventFormats is a set of event formats
func ParseEventFormats ¶ added in v0.50.0
func ParseEventFormats(formats string) (EventFormats, error)
ParseEventFormats converts a comma separated list into a EventFormats set
func (EventFormats) Equals ¶ added in v0.50.0
func (efs EventFormats) Equals(other EventFormats) bool
Equals defines identity between EventFormats
func (EventFormats) String ¶ added in v0.50.0
func (efs EventFormats) String() string
String is a string representation of an EventFormats
type Events ¶ added in v0.50.0
type Events struct { Sink string Formats EventFormats }
Events holds the events configurations +k8s:deepcopy-gen=true
func NewEventsFromConfigMap ¶ added in v0.50.0
NewEventsFromConfigMap returns a Config for the given configmap
func NewEventsFromMap ¶ added in v0.50.0
NewEventsFromMap returns a Config given a map corresponding to a ConfigMap
func (*Events) DeepCopy ¶ added in v0.50.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Events.
func (*Events) DeepCopyInto ¶ added in v0.50.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FeatureFlags ¶ added in v0.14.0
type FeatureFlags struct { DisableAffinityAssistant bool DisableCredsInit bool RunningInEnvWithInjectedSidecars bool RequireGitSSHSecretKnownHosts bool // EnableTektonOCIBundles bool // Deprecated: this is now ignored // ScopeWhenExpressionsToTask bool // Deprecated: this is now ignored EnableAPIFields string SendCloudEventsForRuns bool AwaitSidecarReadiness bool EnforceNonfalsifiability string EnableKeepPodOnCancel bool // VerificationNoMatchPolicy is the feature flag for "trusted-resources-verification-no-match-policy" // VerificationNoMatchPolicy can be set to "ignore", "warn" and "fail" values. // ignore: skip trusted resources verification when no matching verification policies found // warn: skip trusted resources verification when no matching verification policies found and log a warning // fail: fail the taskrun or pipelines run if no matching verification policies found VerificationNoMatchPolicy string EnableProvenanceInStatus bool ResultExtractionMethod string MaxResultSize int SetSecurityContext bool Coschedule string EnableCELInWhenExpression bool EnableStepActions bool EnableParamEnum bool EnableArtifacts bool DisableInlineSpec string EnableConciseResolverSyntax bool EnableKubernetesSidecar 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 Metrics ¶ added in v0.28.0
type Metrics struct { TaskrunLevel string PipelinerunLevel string RunningPipelinerunLevel string DurationTaskrunType string DurationPipelinerunType string CountWithReason bool ThrottleWithNamespace bool }
Metrics holds the configurations for the metrics +k8s:deepcopy-gen=true
func NewMetricsFromConfigMap ¶ added in v0.28.0
NewMetricsFromConfigMap returns a Config for the given configmap
func (*Metrics) DeepCopy ¶ added in v0.28.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metrics.
func (*Metrics) DeepCopyInto ¶ added in v0.28.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PerFeatureFlag ¶ added in v0.53.0
type PerFeatureFlag struct { // Name of the feature flag Name string // Stability level of the feature, one of StableAPIFields, BetaAPIFields or AlphaAPIFields Stability string // Enabled is whether the feature is turned on Enabled bool // Deprecated indicates whether the feature is deprecated // +optional //nolint:gocritic Deprecated bool }
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 ¶
NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.
type Tracing ¶ added in v0.52.0
Tracing holds the configurations for tracing +k8s:deepcopy-gen=true
func NewTracingFromConfigMap ¶ added in v0.52.0
NewTracingFromConfigMap returns a Config given a ConfigMap
func (*Tracing) DeepCopy ¶ added in v0.52.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tracing.
func (*Tracing) DeepCopyInto ¶ added in v0.52.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.