Version: v0.28.0 Latest Latest

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 1




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

	DataMaxSizeKey = "dataMaxSize"

	DefaultDataMaxSize = -1


This section is empty.


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.


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:"dataMaxSize"`

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 {

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