settings

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContextKey = Registration
View Source
var Registration = &config.Registration{
	ConfigMapName: "karpenter-global-settings",
	Constructor:   NewSettingsFromConfigMap,
}

Functions

func AsMetaDuration

func AsMetaDuration(key string, target *metav1.Duration) configmap.ParseFunc

AsMetaDuration parses the value at key as a time.Duration into the target, if it exists.

func ToContext

func ToContext(ctx context.Context, s Settings) context.Context

Types

type Settings

type Settings struct {
	BatchMaxDuration  metav1.Duration
	BatchIdleDuration metav1.Duration
	// This feature flag is temporary and will be removed in the near future.
	DriftEnabled bool
}

func FromContext

func FromContext(ctx context.Context) Settings

func NewSettingsFromConfigMap

func NewSettingsFromConfigMap(cm *v1.ConfigMap) (Settings, error)

NewSettingsFromConfigMap creates a Settings from the supplied ConfigMap

func (Settings) Validate

func (s Settings) Validate() (err error)

Validate leverages struct tags with go-playground/validator so you can define a struct with custom validation on fields i.e.

type ExampleStruct struct {
    Example  metav1.Duration `json:"example" validate:"required,min=10m"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL