parameters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAndMergeParameters

func GetAndMergeParameters(
	params Parameters,
	paramsByKey map[string]*Parameter,
	c client.Client,
	obj interfaces.Object) error

TODO SPLIT IN GETPARAMETERSFROMSOURCES AND MERGEPARAMETERSBYKEYS

func InitParametersFromResources

func InitParametersFromResources()

func KeyPairValues

func KeyPairValues(p *Parameters) map[string]string

Transform parameters to key:value

func ParametersByKey

func ParametersByKey(p *Parameters) map[string]*Parameter

Sort parameters by keys

Types

type Generate

type Generate string
const (
	// Random value
	GenerateRand Generate = "rand"
	// Random value of size 12
	GenerateRand12 Generate = "rand12"
	// Random value of size 24
	GenerateRand24 Generate = "rand24"
	// Value is generated from a template
	// Value container the template and will be replaced
	GenerateTemplate Generate = "template"
)

type MountPath

type MountPath struct {
	Path    string `json:"path,omitempty"`
	SubPath string `json:"subPath,omitempty"`
}

type MountType

type MountType string
const (
	// Parameter is mounted as key/value in the container envVar specs
	MountLiteral MountType = "literal"
	// Parameter is mounted as as  EnvVarSource in the container envVar specs
	// no data is transformed in a new resource
	MountFrom MountType = "from"
	// Parameter is mouned as file in the container path
	MountFile MountType = "file"
	// Parameter is mounted as EnvFromSource in the container specs
	// Data can be retrieved from the crds or external resources specified in the parameter envFrom
	// and transformed in a new secret or configmap
	MountEnvFile MountType = "envFile"
)

type Parameter

type Parameter struct {
	// Key of the parameter, can be mounted as as an environment variable, used in template
	// or as in the data fied of configmap/secret
	//
	// Key must be unique
	Key string `json:"key,omitempty"`
	// Value of the paramater, should not contain secret values
	// If it is a template, ParameterType should be template
	Value string `json:"value,omitempty"`
	// ValueFrom when specified indicates the source of the parameter.
	// Cannot be used if value is not empty.
	ValueFrom `json:",inline"`
	// MountPath specifies where the parameter will be mounted as a file
	MountPath MountPath `json:"mountFrom,omitempty"`
	// Generate if specified defines how the parameter value will be generated
	Generate Generate `json:"generate,omitempty"`
	// Type specifies specifies the parameter type
	Type ParameterType `json:"type,omitempty"`
	// MountType defined how the parameter will be mounted in the pod
	// Defaults to EnvFile
	MountType MountType `json:"mountType,omitempty"`
}

+kubebuilder:object:generate=true

func (*Parameter) DeepCopy

func (in *Parameter) DeepCopy() *Parameter

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

func (*Parameter) DeepCopyInto

func (in *Parameter) DeepCopyInto(out *Parameter)

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

func (*Parameter) GetEnvVar

func (p *Parameter) GetEnvVar() (envVar corev1.EnvVar, err error)

GetEnvVar gets an environment variables to set in the container.

func (*Parameter) GetPodVolume

func (p *Parameter) GetPodVolume() *corev1.Volume

func (*Parameter) GetVolumeMount

func (p *Parameter) GetVolumeMount() *corev1.VolumeMount

type ParameterType

type ParameterType string
const (
	ConfigParameter      ParameterType = "configmap"
	SecretParameter      ParameterType = "secret"
	ObjectFieldParameter ParameterType = "field"
	TemplateValue        ParameterType = "templateValue"
)

type Parameters

type Parameters []*Parameter

+kubebuilder:object:generate=true

func Marshal

func Marshal(i interface{}) (Parameters, error)

func (Parameters) DeepCopy

func (in Parameters) DeepCopy() Parameters

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

func (Parameters) DeepCopyInto

func (in Parameters) DeepCopyInto(out *Parameters)

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

func (*Parameters) GetData

func (p *Parameters) GetData() map[string]string

GetData get the data for the secret or configmap as a key:values This function only returns data which should be either in a secret or a configmap It implements the configmap and secret interfaces

func (*Parameters) GetEnvVar

func (p *Parameters) GetEnvVar() []corev1.EnvVar

GetEnvVar gets a list of environment variables to set in the container.

func (*Parameters) InitRandValues

func (p *Parameters) InitRandValues()

InitRandValues initialies the parameters random values

func (*Parameters) InitTemplateValues

func (p *Parameters) InitTemplateValues(values map[string]string) error

InitTemplateValues initialies the parameters values from a template and a key pair value set The template shoud be in the parameter value when GenerateTemplate is specified and the values will be replaced from the result of the template processing.

func (*Parameters) InitValues

func (p *Parameters) InitValues()

type ValueFrom

type ValueFrom struct {
	// Key to select from the source
	FromKey string `json:"fromKey,omitempty"`
	// Name of the referent.
	Ref string `json:"ref,omitempty"`
	// Type of the parameter's source
	// Defaults to the parameter type if not specified
	RefType ParameterType `json:"refType,omitempty"`
}

Jump to

Keyboard shortcuts

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