config

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// PingDefaultsConfigName is the name of config map for the default
	// configs that pings should use.
	PingDefaultsConfigName = "config-ping-defaults"

	DataMaxSizeKey = "data-max-size"

	// Legacy configuration item should be removed when a migration
	// update script is released.
	LegacyDataMaxSizeKey = "dataMaxSize"

	DefaultDataMaxSize = -1
)

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

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 PingDefaults

type PingDefaults struct {
	DataMaxSize int64 `json:"data-max-size"`
}

PingDefaults includes the default values to be populated by the webhook.

func NewPingDefaultsConfigFromConfigMap

func NewPingDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*PingDefaults, error)

NewPingDefaultsConfigFromConfigMap creates a PingDefaults from the supplied configMap

func NewPingDefaultsConfigFromMap

func NewPingDefaultsConfigFromMap(data map[string]string) (*PingDefaults, error)

NewPingDefaultsConfigFromMap creates a Defaults from the supplied Map

func (*PingDefaults) DeepCopy

func (d *PingDefaults) DeepCopy() *PingDefaults

func (*PingDefaults) GetPingConfig

func (d *PingDefaults) GetPingConfig() *PingDefaults

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