You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "mihirduvedi (via GitHub)" <gi...@apache.org> on 2026/08/23 01:36:16 UTC
[PR] Add Kubernetes-recommended labels to Helm chart [airflow]
mihirduvedi opened a new pull request, #71987:
URL: https://github.com/apache/airflow/pull/71987
Add the five Kubernetes-recommended labels from #34048 to chart-managed resources and pod templates. Keep the legacy labels and selectors unchanged so existing workloads, policies, and user queries remain compatible.
Centralize label generation and Kubernetes label-value normalization, preserve user-label precedence, and cover rendered resources, job templates, the KubernetesExecutor pod template, selector preservation, long chart versions, and override behavior.
closes: #34048
Testing:
- `breeze testing helm-tests --use-xdist --kubernetes-version 1.30.13` (2,127 passed)
- `prek run --from-ref upstream/main --stage pre-commit`
- `prek run --from-ref upstream/main --stage manual`
- Helm lint, kubeconform, schema checks, mypy, and Kustomize overlay build/smoke checks
- `breeze build-docs helm-chart --one-pass-only` (docs and spellcheck)
- `breeze ci selective-check --commit-ref HEAD`
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Codex (GPT-5)
Generated-by: Codex (GPT-5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
Drafted-by: Codex (GPT-5) (no human review before posting)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Kubernetes-recommended labels to Helm chart [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #71987:
URL: https://github.com/apache/airflow/pull/71987#issuecomment-6405502150
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Kubernetes-recommended labels to Helm chart [airflow]
Posted by "mihirduvedi (via GitHub)" <gi...@apache.org>.
mihirduvedi commented on code in PR #71987:
URL: https://github.com/apache/airflow/pull/71987#discussion_r4381961636
##########
chart/tests/helm_tests/airflow_aux/test_recommended_labels.py:
##########
@@ -0,0 +1,286 @@
+# Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
Removed the separate label test module and kept the assertions in the existing Helm tests. The expected application version now comes from `Chart.yaml` through a shared fixture.
---
Drafted-by: Codex (GPT-6) (no human review before posting)
##########
chart/tests/helm_tests/airflow_aux/test_basic_helm_chart.py:
##########
@@ -292,6 +292,7 @@ def test_labels_are_valid(self, executor, flower_routing_values, flower_routing_
(f"{release_name}-airflow-worker", "ServiceAccount", "worker"),
Review Comment:
Reverted the unrelated resource-list changes. The changes in this test now cover the label migration and the chart-version assertion.
---
Drafted-by: Codex (GPT-6) (no human review before posting)
##########
chart/templates/_helpers.yaml:
##########
@@ -37,6 +37,43 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}
+{{/*
+Sanitize a value for use as a Kubernetes label value.
+*/}}
+{{- define "airflow.labelValue" -}}
+ {{- . | toString | replace "+" "_" | trunc 63 | trimAll "-_." -}}
+{{- end }}
+
+{{/*
+Kubernetes recommended labels for chart resources.
+*/}}
+{{- define "airflow.standardLabels" -}}
+ {{- $root := .root -}}
+ {{- $labels := dict
+ "app.kubernetes.io/instance" (include "airflow.labelValue" $root.Release.Name)
+ "app.kubernetes.io/managed-by" (include "airflow.labelValue" $root.Release.Service)
+ "app.kubernetes.io/part-of" "airflow"
Review Comment:
Added `app.kubernetes.io/name` and `app.kubernetes.io/version` to the resource and pod label helpers; `app.kubernetes.io/instance` uses the Helm release name. The corresponding legacy labels and selectors have been migrated.
---
Drafted-by: Codex (GPT-6) (no human review before posting)
##########
chart/newsfragments/71987.feature.rst:
##########
@@ -0,0 +1 @@
+Add Kubernetes-recommended labels to chart-managed resources and pods
Review Comment:
Removed the news fragment.
---
Drafted-by: Codex (GPT-6) (no human review before posting)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Kubernetes-recommended labels to Helm chart [airflow]
Posted by "Miretpl (via GitHub)" <gi...@apache.org>.
Miretpl commented on code in PR #71987:
URL: https://github.com/apache/airflow/pull/71987#discussion_r3972262220
##########
chart/tests/helm_tests/airflow_aux/test_recommended_labels.py:
##########
@@ -0,0 +1,286 @@
+# Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
This file is totally not aligned with how tests are written in the Helm Chart area. Could you adjust it?
##########
chart/tests/helm_tests/airflow_aux/test_basic_helm_chart.py:
##########
@@ -292,6 +292,7 @@ def test_labels_are_valid(self, executor, flower_routing_values, flower_routing_
(f"{release_name}-airflow-worker", "ServiceAccount", "worker"),
Review Comment:
Most of the changes in this file seem unrelated.
##########
chart/templates/_helpers.yaml:
##########
@@ -37,6 +37,43 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}
+{{/*
+Sanitize a value for use as a Kubernetes label value.
+*/}}
+{{- define "airflow.labelValue" -}}
+ {{- . | toString | replace "+" "_" | trunc 63 | trimAll "-_." -}}
+{{- end }}
+
+{{/*
+Kubernetes recommended labels for chart resources.
+*/}}
+{{- define "airflow.standardLabels" -}}
+ {{- $root := .root -}}
+ {{- $labels := dict
+ "app.kubernetes.io/instance" (include "airflow.labelValue" $root.Release.Name)
+ "app.kubernetes.io/managed-by" (include "airflow.labelValue" $root.Release.Service)
+ "app.kubernetes.io/part-of" "airflow"
Review Comment:
Kubernetes has a couple more recommended labels like `app.kubernetes.io/version`, `app.kubernetes.io/instance` and `app.kubernetes.io/name` which we could use too.
##########
chart/newsfragments/71987.feature.rst:
##########
@@ -0,0 +1 @@
+Add Kubernetes-recommended labels to chart-managed resources and pods
Review Comment:
It is rather unnecessary. We could delete it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Kubernetes-recommended labels to Helm chart [airflow]
Posted by "mihirduvedi (via GitHub)" <gi...@apache.org>.
mihirduvedi commented on PR #71987:
URL: https://github.com/apache/airflow/pull/71987#issuecomment-6427387112
Refreshed this PR against current `main` and addressed the four review threads: removed the separate label test module and news fragment, reverted the unrelated test changes, and included the recommended name, instance, and version labels. The version assertions now read `Chart.yaml` rather than hardcoding the application version.
The [fork CI run](https://github.com/mihirduvedi/airflow/actions/runs/40392890113) passed all 2,280 Helm tests across nine groups with Kubernetes 1.31.12, Helm release checks, static checks, the Helm documentation build, and the normal and special core test matrices.
The overall fork run is still red because of integration setup failures: [Kubernetes tests](https://github.com/mihirduvedi/airflow/actions/runs/40392890113/job/121836493285) cannot find the expected base PROD image before exercising the chart, and [PROD e2e tests](https://github.com/mihirduvedi/airflow/actions/runs/40392890113/job/121836493757) fail during image-pull setup. These are not reported as passing integration tests.
This is ready for another review. Could a maintainer approve the upstream [Tests (AMD)](https://github.com/apache/airflow/actions/runs/40392811537) and [CodeQL](https://github.com/apache/airflow/actions/runs/40392810292) runs so project CI can complete validation?
---
Drafted-by: Codex (GPT-6) (no human review before posting)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org