DeployConfig is a Kale object which holds information relevant to the configuration of underlying Kubernetes objects.


The object lives in the kale.config module. Import it as follows:

from kale.config import DeployConfig


Name Type Default Description
env List[V1EnvVar] [] Extends the env field of a container
env_from List[V1EnvFromSource] [] Extends the envFrom field of the container
requests Dict[str, str] {} Sets resources.requests for the container
limits Dict[str, str] {} Sets resources.limits for the container
annotations Dict[str, str] {} Sets annotations for the Pod
labels Dict[str, str] {} Sets labels for the Pod
node_selector Dict[str, str] {} Sets the node_selector for the Pod
affinity V1Affinity None Sets the affinity of the Pod
tolerations List[V1Tolerations] [] Sets tolerations for the Pod


In the table above we also mention Kubernetes objects. For details on their structure please refer to the Official Python client library for Kubernetes.


You may initialize a DeployConfig similarly to any other Python object:

deploy_config = DeployConfig(env=[V1EnvVar(name="ENV1", value="VALUE1")],
                             annotations={"special-annotation": "special-value"},
                             labels={"significant-label": "a-value"})

However, you can also initialize a field that expects Kubernetes objects by passing a dictionary, which Kale will then deserialize into the corresponding Kubernetes object. For example:

complex_env = {"name": "MY_POD_IP",
               "valueFrom": {"fieldRef": {"fieldPath": "status.podIP"}}}
deploy_config = DeployConfig(env=[V1EnvVar(name="ENV2", value="VALUE2"),
                             limits={"cpu": "100m", "memory": "1Gi"},
                             node_selector={"node-id": "1234"})