config

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultTaskrunLevel determines to what level to aggregate metrics
	// when it isn't specified in configmap
	DefaultTaskrunLevel = TaskrunLevelAtTask
	// 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
	// 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 used for Duration of Taskrun
	DurationTaskrunTypeHistogram = "histogram"
	// DurationTaskrunTypeLastValue specify that lastValue or
	// gauge type metrics need to be used 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 used for Duration of Pipelinerun
	DurationPipelinerunTypeHistogram = "histogram"
	// DurationPipelinerunTypeLastValue specify that lastValue or
	// gauge type metrics need to be used for Duration of Pipelinerun
	DurationPipelinerunTypeLastValue = "lastvalue"
)
View Source
const (

	// DefaultRunAt is the default value for RunAt
	DefaultRunAt = "7 7 * * 7"
	// DefaultMaxRetention is the default value for MaxRetention
	DefaultMaxRetention = time.Hour * 24 * 30
)

Variables

This section is empty.

Functions

func GetMetricsConfigName

func GetMetricsConfigName() string

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

func GetRetentionPolicyConfigName added in v0.12.0

func GetRetentionPolicyConfigName() string

GetRetentionPolicyConfigName returns the name of the configmap containing retention policy.

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 {
	Metrics *Metrics
}

Config holds the collection of configurations that we attach to contexts.

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

type Metrics

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

Metrics holds the configurations for the metrics

func NewMetricsFromConfigMap

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

NewMetricsFromConfigMap returns a Config for the given configmap

func (*Metrics) DeepCopy

func (cfg *Metrics) DeepCopy() *Metrics

DeepCopy copying the receiver, creating a new Metrics. deepcopy-gen hasn't been introduced in results repo, so handcraft here for now

func (*Metrics) Equals

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

Equals returns true if two Configs are identical

type RetentionPolicy added in v0.12.0

type RetentionPolicy struct {
	RunAt        string
	MaxRetention time.Duration
}

RetentionPolicy holds the configurations for the Retention Policy of the DB

func NewRetentionPolicyFromConfigMap added in v0.12.0

func NewRetentionPolicyFromConfigMap(config *corev1.ConfigMap) (*RetentionPolicy, error)

NewRetentionPolicyFromConfigMap returns a Config for the given configmap

func (*RetentionPolicy) DeepCopy added in v0.12.0

func (cfg *RetentionPolicy) DeepCopy() *RetentionPolicy

DeepCopy copying the receiver, creating a new RetentionPolicy. deepcopy-gen hasn't been introduced in results repo, so handcraft here for now

func (*RetentionPolicy) Equals added in v0.12.0

func (cfg *RetentionPolicy) Equals(other *RetentionPolicy) 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.

func NewStore

func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value any)) *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