Env
The hera.workflows.env module provides implementations of environment variable types that can be used with Argo.
Env classes differ from EnvFrom classes as EnvFrom uses a source to retrieve a variable
from, and you can only prefix the name with something. The Env classes can create new independent variables.
Env
A variable implementation that can expose a plain value or value from input as an env variable.
Source code in src/hera/workflows/env.py
name
name: str
the name of the environment variable. This is universally required irrespective of the type of env variable
param_name
param_name: str
Returns the parameter name of the environment variable, conditioned on the use of value_from_input.
value_from_input
an optional str or Parameter representation of the origin of the environment variable value
build
Constructs and returns the Argo environment specification.
Source code in src/hera/workflows/env.py
FieldEnv
FieldEnv is an environment variable whose origin is in a field specification.
The field path specification points to a particular field within the workflow/container YAML specification. For instance, if there’s a YAML that has 3 fields like so
then a reference to the field a must be encoded asspec.a in order for the value of 42 to be extracted and set
as an environment variable.
Source code in src/hera/workflows/env.py
field_path
field_path: str
the path to the field whose value should be extracted into an environment variable
name
name: str
the name of the environment variable. This is universally required irrespective of the type of env variable
build
Constructs and returns the Argo environment specification.
Source code in src/hera/workflows/env.py
ResourceEnv
ResourceEnv exposes a resource field as an environment variable.
Only resources limits and requests such as limits.cpu, limits.memory, limits.ephemeral-storage,
requests.cpu, requests.memory and requests.ephemeral-storage are currently supported.
Source code in src/hera/workflows/env.py
container_name
a pod can contain multiple containers, so this field helps select the right container whose resources should be exposed as an env variable.
divisor
divisor: Optional[Quantity] = None
Specifies the output format of the exposed resources, defaults to 1 on Argo’s side
name
name: str
the name of the environment variable. This is universally required irrespective of the type of env variable
build
Builds the ResourceEnv into a Hera auto-generated environment variable model.
Source code in src/hera/workflows/env.py
SecretEnv
SecretEnv is an environment variable whose value originates from a Kubernetes secret.
Source code in src/hera/workflows/env.py
name
name: str
the name of the environment variable. This is universally required irrespective of the type of env variable
secret_key
secret_key: str
the field key within the secret that points to the value to extract and set as an env variable
secret_name
the name of the Kubernetes secret to extract the value from
build
Constructs and returns the Argo environment specification.