config

package
v0.41.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 5 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 (
	// KafkaDefaultsConfigName is the name of config map for the default
	// configs that KafkaSource should use.
	KafkaDefaultsConfigName = "config-kafka-source-defaults"

	// DefaultAutoscalingClassKey is the name of autoscaler class annotation
	DefaultAutoscalingClassKey = "autoscalingClass"

	// DefaultMinScaleKey is the name of the key corresponding to the KEDA minScale annotation
	DefaultMinScaleKey = "minScale"

	// DefaultMaxScaleKey is the name of the KEDA maxScale annotation
	DefaultMaxScaleKey = "maxScale"

	// DefaultPollingIntervalKey is the name of the KEDA pollingInterval annotation
	DefaultPollingIntervalKey = "pollingInterval"

	// DefaultCooldownPeriodKey is the name of the KEDA cooldownPeriod annotation
	DefaultCooldownPeriodKey = "cooldownPeriod"

	// DefaultKafkaLagThresholdKey is the name of the KEDA kafkaLagThreshold annotation
	DefaultKafkaLagThresholdKey = "kafkaLagThreshold"

	// KedaAutoscalingClass is the class name for KEDA
	KedaAutoscalingClass = "keda.autoscaling.knative.dev"

	// DefaultMinScaleValue is the default value for DefaultMinScaleKey
	DefaultMinScaleValue = int64(1)

	// DefaultMaxScaleValue is  the default value for DefaultMaxScaleKey
	DefaultMaxScaleValue = int64(1)

	// DefaultPollingIntervalValue is the default value for DefaultPollingIntervalKey
	DefaultPollingIntervalValue = int64(30)

	// DefaultCooldownPeriodValue is the default value for DefaultCooldownPeriodKey
	DefaultCooldownPeriodValue = int64(300)

	// DefaultKafkaLagThresholdValue is the default value for DefaultKafkaLagThresholdKey
	DefaultKafkaLagThresholdValue = int64(10)
)

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 Config

type Config struct {
	KafkaSourceDefaults *KafkaSourceDefaults
}

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 KafkaSourceDefaults

type KafkaSourceDefaults struct {
	AutoscalingClass  string `json:"autoscalingClass,omitempty"`
	MinScale          int64  `json:"minScale,omitempty"`
	MaxScale          int64  `json:"maxScale,omitempty"`
	PollingInterval   int64  `json:"pollingInterval,omitempty"`
	CooldownPeriod    int64  `json:"cooldownPeriod,omitempty"`
	KafkaLagThreshold int64  `json:"kafkaLagThreshold,omitempty"`
}

func NewKafkaDefaultsConfigFromConfigMap

func NewKafkaDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*KafkaSourceDefaults, error)

NewKafkaDefaultsConfigFromConfigMap creates a KafkaSourceDefaults from the supplied configMap

func NewKafkaDefaultsConfigFromMap

func NewKafkaDefaultsConfigFromMap(data map[string]string) (*KafkaSourceDefaults, error)

NewKafkaDefaultsConfigFromMap creates a KafkaSourceDefaults from the supplied Map

func (*KafkaSourceDefaults) DeepCopy

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