diff --git a/chart/values.schema.json b/chart/values.schema.json index 9636d3a07e566..2795a342a93c3 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -5454,11 +5454,47 @@ }, "value": { "type": "string" + }, + "valueFrom": { + "type": "object", + "properties": { + "configMapKeyRef": { + "$ref": "#/definitions/io.k8s.api.core.v1.ConfigMapKeySelector", + "description": "Selects a key of a ConfigMap." + }, + "secretKeyRef": { + "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector", + "description": "Selects a key of a secret in the pod's namespace" + } + }, + "anyOf": [ + { + "required": [ + "configMapKeyRef" + ] + }, + { + "required": [ + "secretKeyRef" + ] + } + ] } }, "required": [ - "name", - "value" + "name" + ], + "anyOf": [ + { + "required": [ + "value" + ] + }, + { + "required": [ + "valueFrom" + ] + } ], "additionalProperties": false } diff --git a/helm-tests/tests/helm_tests/airflow_core/test_api_server.py b/helm-tests/tests/helm_tests/airflow_core/test_api_server.py index 97b3b64690e23..77bf475b6b739 100644 --- a/helm-tests/tests/helm_tests/airflow_core/test_api_server.py +++ b/helm-tests/tests/helm_tests/airflow_core/test_api_server.py @@ -94,15 +94,32 @@ def test_should_add_extraEnvs(self): docs = render_chart( values={ "apiServer": { - "env": [{"name": "TEST_ENV_1", "value": "test_env_1"}], + "env": [ + {"name": "TEST_ENV_1", "value": "test_env_1"}, + { + "name": "TEST_ENV_2", + "valueFrom": {"configMapKeyRef": {"name": "test-config", "key": "test-key"}}, + }, + { + "name": "TEST_ENV_3", + "valueFrom": {"secretKeyRef": {"name": "test-secret", "key": "test-key"}}, + }, + ], }, }, show_only=["templates/api-server/api-server-deployment.yaml"], ) - assert {"name": "TEST_ENV_1", "value": "test_env_1"} in jmespath.search( - "spec.template.spec.containers[0].env", docs[0] - ) + env_result = jmespath.search("spec.template.spec.containers[0].env", docs[0]) + assert {"name": "TEST_ENV_1", "value": "test_env_1"} in env_result + assert { + "name": "TEST_ENV_2", + "valueFrom": {"configMapKeyRef": {"name": "test-config", "key": "test-key"}}, + } in env_result + assert { + "name": "TEST_ENV_3", + "valueFrom": {"secretKeyRef": {"name": "test-secret", "key": "test-key"}}, + } in env_result def test_should_add_extra_volume_and_extra_volume_mount(self): docs = render_chart(