Documentation ¶
Index ¶
- func ByKey(p *Parameters) map[string]*Parameter
- func GetDataFromResource(c client.Client, obj, owner interfaces.Object) (data map[string]string, err error)
- func KeyPairValues(p *Parameters) map[string]string
- func OrderByResourceRef(ps *Parameters) map[ParameterType]map[string]*Parameters
- type Generate
- type MountPath
- type MountType
- type Parameter
- func (in *Parameter) DeepCopy() *Parameter
- func (in *Parameter) DeepCopyInto(out *Parameter)
- func (p *Parameter) GetEnvVar() (envVar corev1.EnvVar, err error)
- func (p *Parameter) GetPodVolume() corev1.Volume
- func (p *Parameter) GetVolumeMount() corev1.VolumeMount
- func (p *Parameter) IsMount() bool
- func (p *Parameter) IsRand() bool
- type ParameterType
- type Parameters
- func (in Parameters) DeepCopy() Parameters
- func (in Parameters) DeepCopyInto(out *Parameters)
- func (p *Parameters) GetConfigData() map[string]string
- func (p *Parameters) GetData() map[string]string
- func (p *Parameters) GetEnvVar() []corev1.EnvVar
- func (p *Parameters) GetPodVolumes() []corev1.Volume
- func (p *Parameters) GetSecretData() map[string][]byte
- func (p *Parameters) GetVolumeMounts() []corev1.VolumeMount
- func (p *Parameters) InitRandValues()
- func (p *Parameters) InitTemplateValues(values map[string]interface{}) error
- func (ps *Parameters) InitValueFrom(c client.Client, owner interfaces.Object) error
- func (ps *Parameters) Merge(in *Parameters) error
- func (ps *Parameters) MergeData(data map[string]string) error
- type ValueFrom
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByKey ¶
func ByKey(p *Parameters) map[string]*Parameter
ByKey returns the parameters sorted by keys
func GetDataFromResource ¶
func GetDataFromResource(c client.Client, obj, owner interfaces.Object) (data map[string]string, err error)
GetDataFromResource return the data as key:value pairs from external resources. If resources are owned by the owner object, only generated resources are returned. Only secrets and configmaps are supported.
func KeyPairValues ¶
func KeyPairValues(p *Parameters) map[string]string
KeyPairValues returns the parameters as key:value pairs
func OrderByResourceRef ¶
func OrderByResourceRef(ps *Parameters) map[ParameterType]map[string]*Parameters
OrderByResourceRef returns a list of parameters ordered reference type and reference name
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 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 the key in the key:value data fied in the configmap or 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 ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.
func (*Parameter) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Parameter) GetPodVolume ¶
GetPodVolume return the Volume to set in the pod.
func (*Parameter) GetVolumeMount ¶
func (p *Parameter) GetVolumeMount() corev1.VolumeMount
GetVolumeMount returns the VolumeMount to set in the container.
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) GetConfigData ¶
func (p *Parameters) GetConfigData() map[string]string
GetConfigData returns the parameters of type ConfigParameter as key:value pairs It implements the configmap interface
func (*Parameters) GetData ¶
func (p *Parameters) GetData() map[string]string
GetData returns the data for the secret or configmap as a key:value pairs This function only returns data which should be either in a secret or a configmap
func (*Parameters) GetEnvVar ¶
func (p *Parameters) GetEnvVar() []corev1.EnvVar
GetEnvVar return a list of EnvVar to set in the container.
func (*Parameters) GetPodVolumes ¶
func (p *Parameters) GetPodVolumes() []corev1.Volume
GetPodVolumes returns a list of Volume to set in the pod.
func (*Parameters) GetSecretData ¶
func (p *Parameters) GetSecretData() map[string][]byte
GetSecretData returns the parameters of type ConfigParameter as key:value pairs It implements the secret interface
func (*Parameters) GetVolumeMounts ¶
func (p *Parameters) GetVolumeMounts() []corev1.VolumeMount
GetVolumeMounts returns a list of VolumeMount 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]interface{}) 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. The values will be replaced from the result of the template processing.
func (*Parameters) InitValueFrom ¶
func (ps *Parameters) InitValueFrom(c client.Client, owner interfaces.Object) error
InitValueFrom intialise the parameters value from external resources Only secrets and configmaps are supported
func (*Parameters) Merge ¶
func (ps *Parameters) Merge(in *Parameters) error
Merge mergers parameters with new parameters. The new parameters provided takes over the parameters and are appended to the parameters if not set.
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"` }