Skip to main content

ToK8sEnvVar

Converts a slice of KeyValuePair objects into a slice of Kubernetes EnvVar objects.

def ToK8sEnvVar(
env: []*core.KeyValuePair
) - > []v1.EnvVar

Converts a slice of KeyValuePair objects into a slice of Kubernetes EnvVar objects. This function is used to transform a generic key-value pair representation into the specific format required for defining environment variables in Kubernetes pod specifications.

Parameters

NameTypeDescription
env[]*core.KeyValuePairA slice of pointers to KeyValuePair objects, each containing a 'Key' and 'Value' string that represent an environment variable.

Returns

TypeDescription
[]v1.EnvVarA slice of Kubernetes EnvVar objects, where each object contains a 'Name' and 'Value' field corresponding to the input KeyValuePair.