This is an automated email from the ASF dual-hosted git repository.

Miretpl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 14cf70ed176 Helm: Allow hostAliases and log groomer lifecycle hooks on 
the Dag processor (#73159)
14cf70ed176 is described below

commit 14cf70ed176aafce79f1289366b16c16498af780
Author: Pranay Yelugam <[email protected]>
AuthorDate: Thu Sep 24 14:06:28 2026 -0700

    Helm: Allow hostAliases and log groomer lifecycle hooks on the Dag 
processor (#73159)
    
    The Dag processor was missing two knobs that every sibling component
    already exposes: hostAliases on the pod, and container lifecycle hooks on
    its log groomer sidecar. Both are now configurable with tests covering the
    rendered output.
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 .../dag-processor/dag-processor-deployment.yaml    |  7 +++++++
 .../airflow_aux/test_container_lifecycle.py        | 19 +++++++++++++++++++
 .../helm_tests/airflow_core/test_dag_processor.py  | 12 ++++++++++++
 chart/values.schema.json                           | 22 ++++++++++++++++++++++
 chart/values.yaml                                  |  4 ++++
 5 files changed, 64 insertions(+)

diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml 
b/chart/templates/dag-processor/dag-processor-deployment.yaml
index e8172e662c1..ca8453c2bfe 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -31,6 +31,7 @@
 {{- $containerSecurityContextLogGroomerSidecar := include 
"containerSecurityContext" (list .Values.dagProcessor.logGroomerSidecar 
.Values) }}
 {{- $containerSecurityContextWaitForMigrations := include 
"containerSecurityContext" (list .Values.dagProcessor.waitForMigrations 
.Values) }}
 {{- $containerLifecycleHooks := or 
.Values.dagProcessor.containerLifecycleHooks .Values.containerLifecycleHooks }}
+{{- $containerLifecycleHooksLogGroomerSidecar := or 
.Values.dagProcessor.logGroomerSidecar.containerLifecycleHooks 
.Values.containerLifecycleHooks }}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
@@ -115,6 +116,9 @@ spec:
       securityContext: {{ $securityContext | nindent 8 }}
       {{- end }}
       imagePullSecrets: {{ include "image_pull_secrets" . | nindent 8 }}
+      {{- if .Values.dagProcessor.hostAliases }}
+      hostAliases: {{- toYaml .Values.dagProcessor.hostAliases | nindent 8 }}
+      {{- end }}
       initContainers:
         {{- if .Values.dagProcessor.waitForMigrations.enabled }}
         - name: wait-for-airflow-migrations
@@ -208,6 +212,9 @@ spec:
           {{- if $containerSecurityContextLogGroomerSidecar }}
           securityContext: {{ $containerSecurityContextLogGroomerSidecar | 
nindent 12 }}
           {{- end }}
+          {{- if $containerLifecycleHooksLogGroomerSidecar }}
+          lifecycle: {{- tpl (toYaml 
$containerLifecycleHooksLogGroomerSidecar) . | nindent 12 }}
+          {{- end }}
           {{- if .Values.dagProcessor.logGroomerSidecar.command }}
           command: {{ tpl (toYaml 
.Values.dagProcessor.logGroomerSidecar.command) . | nindent 12 }}
           {{- end }}
diff --git a/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py 
b/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py
index a1c2c63f613..36ab47f602b 100644
--- a/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py
+++ b/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py
@@ -226,3 +226,22 @@ class TestContainerLifecycleHooks:
         assert jmespath.search("spec.template.spec.containers[1].lifecycle", 
docs[0]) == {
             hook_type: LIFECYCLE_PARSED
         }
+
+    @pytest.mark.parametrize("hook_type", ["preStop", "postStart"])
+    def test_log_groomer_sidecar_container_setting_dag_processor(self, 
hook_type):
+        docs = render_chart(
+            name=RELEASE_NAME,
+            values={
+                "dagProcessor": {
+                    "logGroomerSidecar": {"containerLifecycleHooks": 
{hook_type: LIFECYCLE_TEMPLATE}}
+                },
+            },
+            show_only=[
+                "templates/dag-processor/dag-processor-deployment.yaml",
+            ],
+        )
+
+        assert (
+            
jmespath.search(f"spec.template.spec.containers[1].lifecycle.{hook_type}", 
docs[0])
+            == LIFECYCLE_PARSED
+        )
diff --git a/chart/tests/helm_tests/airflow_core/test_dag_processor.py 
b/chart/tests/helm_tests/airflow_core/test_dag_processor.py
index 9bc1f6ebb2e..ec6dcaab475 100644
--- a/chart/tests/helm_tests/airflow_core/test_dag_processor.py
+++ b/chart/tests/helm_tests/airflow_core/test_dag_processor.py
@@ -652,6 +652,18 @@ class TestDagProcessor:
         assert "annotations" in jmespath.search("metadata", docs[0])
         assert jmespath.search("metadata.annotations", 
docs[0])["test_annotation"] == "test_annotation_value"
 
+    def test_dag_processor_pod_hostaliases(self):
+        docs = render_chart(
+            values={
+                "dagProcessor": {
+                    "hostAliases": [{"ip": "127.0.0.1", "hostnames": 
["foo.local"]}],
+                },
+            },
+            
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
+        )
+        assert jmespath.search("spec.template.spec.hostAliases[0].ip", 
docs[0]) == "127.0.0.1"
+        assert 
jmespath.search("spec.template.spec.hostAliases[0].hostnames[0]", docs[0]) == 
"foo.local"
+
     def test_validate_if_ssh_params_are_added_with_git_ssh_key(self):
         docs = render_chart(
             values={
diff --git a/chart/values.schema.json b/chart/values.schema.json
index a0fb7d8379c..49251ffa3d2 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -4782,6 +4782,28 @@
                     "type": "boolean",
                     "default": true
                 },
+                "hostAliases": {
+                    "description": "HostAliases for the dag processor pod.",
+                    "items": {
+                        "$ref": "#/definitions/io.k8s.api.core.v1.HostAlias"
+                    },
+                    "type": "array",
+                    "default": [],
+                    "examples": [
+                        {
+                            "ip": "127.0.0.1",
+                            "hostnames": [
+                                "foo.local"
+                            ]
+                        },
+                        {
+                            "ip": "10.1.2.3",
+                            "hostnames": [
+                                "foo.remote"
+                            ]
+                        }
+                    ]
+                },
                 "extraContainers": {
                     "description": "Launch additional containers into dag 
processor (templated).",
                     "type": "array",
diff --git a/chart/values.yaml b/chart/values.yaml
index ca788cc61d5..2fb01cc083f 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2259,6 +2259,8 @@ dagProcessor:
   # when it wants to scale a node down.
   safeToEvict: true
 
+  hostAliases: []
+
   # Launch additional containers into dag processor (templated).
   extraContainers: []
 
@@ -2344,6 +2346,8 @@ dagProcessor:
     securityContexts:
       container: {}
 
+    containerLifecycleHooks: {}
+
     env: []
 
   waitForMigrations:

Reply via email to