settings

package
v0.0.0-...-5affba4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContextKey = settingsKeyType{}

Functions

func AsStringMap

func AsStringMap(key string, target *map[string]string) configmap.ParseFunc

AsStringMap parses a value as a JSON map of map[string]string.

func AsTypedString

func AsTypedString[T ~string](key string, target *T) configmap.ParseFunc

AsTypedString passes the value at key through into the target, if it exists.

func ToContext

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

Types

type NodeNameConvention

type NodeNameConvention string
const (
	IPName       NodeNameConvention = "ip-name"
	ResourceName NodeNameConvention = "resource-name"
)

type Settings

type Settings struct {
	ClusterName                string `validate:"required"`
	ClusterEndpoint            string
	DefaultInstanceProfile     string
	EnablePodENI               bool
	EnableENILimitedPodDensity bool
	IsolatedVPC                bool
	NodeNameConvention         NodeNameConvention `validate:"required"`
	VMMemoryOverheadPercent    float64            `validate:"min=0"`
	InterruptionQueueName      string
	Tags                       map[string]string
}

+k8s:deepcopy-gen=true

func FromContext

func FromContext(ctx context.Context) *Settings

func (*Settings) ConfigMap

func (*Settings) ConfigMap() string

func (*Settings) DeepCopy

func (in *Settings) DeepCopy() *Settings

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Settings.

func (*Settings) DeepCopyInto

func (in *Settings) DeepCopyInto(out *Settings)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Settings) Inject

func (*Settings) Inject(ctx context.Context, cm *v1.ConfigMap) (context.Context, error)

Inject creates a Settings from the supplied ConfigMap

func (Settings) Validate

func (s Settings) Validate() 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