Miretpl commented on code in PR #71987:
URL: https://github.com/apache/airflow/pull/71987#discussion_r4742837863


##########
chart/docs/customizing-labels.rst:
##########
@@ -24,6 +24,28 @@ Customizing Pod Labels
 The Helm Chart allows you to customize labels for your Airflow objects. You 
can set global labels that apply to all objects and pods defined in the chart,
 as well as component-specific labels for individual Airflow components.
 
+Default Labels
+~~~~~~~~~~~~~~
+
+Resources managed directly by the Airflow chart include the following 
Kubernetes-recommended labels by default:
+
+.. code-block:: yaml
+
+   app.kubernetes.io/part-of: airflow
+   app.kubernetes.io/name: airflow
+   app.kubernetes.io/instance: <Helm release name>
+   app.kubernetes.io/version: <Airflow application version>
+   helm.sh/chart: <chart name>-<chart version>
+   app.kubernetes.io/managed-by: <Helm release service>
+
+Resources with a component label also include ``app.kubernetes.io/component`` 
with the same value. Pod templates include
+``app.kubernetes.io/part-of``, ``app.kubernetes.io/name``, 
``app.kubernetes.io/instance``,
+``app.kubernetes.io/version``, and ``app.kubernetes.io/component``.
+
+The chart's workload, service, policy, and autoscaling selectors use 
``app.kubernetes.io/part-of``,
+``app.kubernetes.io/instance``, and ``app.kubernetes.io/component`` instead of 
the legacy ``tier``, ``release``, and
+``component`` labels removed in chart 2.0.

Review Comment:
   ```suggestion
   The chart's workload, service and policy selectors use 
``app.kubernetes.io/part-of``,
   ``app.kubernetes.io/instance``, and ``app.kubernetes.io/component`` instead 
of the legacy ``tier``, ``release``, and
   ``component`` labels removed in chart 2.0.
   ```
   Autoscaling is not using these labels.



##########
chart/files/pod-template-file.kubernetes-helm-yaml:
##########
@@ -36,9 +36,7 @@ kind: Pod
 metadata:
   name: placeholder-name
   labels:
-    tier: airflow
-    component: worker
-    release: {{ .Release.Name }}
+    {{- include "airflow.standardPodLabels" (dict "root" . "component" 
"worker") | nindent 4 }}
     {{- if or .Values.labels .Values.workers.kubernetes.labels }}
       {{- mustMerge .Values.workers.kubernetes.labels .Values.labels | toYaml 
| nindent 4 }}
     {{- end }}

Review Comment:
   We should verify that the same labels are not defined at the component level.



##########
chart/templates/pgbouncer/pgbouncer-networkpolicy.yaml:
##########
@@ -28,28 +28,24 @@ kind: NetworkPolicy
 metadata:
   name: {{ include "airflow.fullname" . }}-pgbouncer-policy
   labels:
-    tier: airflow
-    component: airflow-pgbouncer-policy
-    release: {{ .Release.Name }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    heritage: {{ .Release.Service }}
+    {{- include "airflow.standardLabels" (dict "root" . "component" 
"airflow-pgbouncer-policy") | nindent 4 }}
     {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
   podSelector:
     matchLabels:
-      tier: airflow
-      component: pgbouncer
-      release: {{ .Release.Name }}
+      app.kubernetes.io/part-of: airflow
+      app.kubernetes.io/component: pgbouncer
+      app.kubernetes.io/instance: {{ .Release.Name }}
   policyTypes:
   - Ingress
   ingress:
   - from:
     - podSelector:
         matchLabels:
-          tier: airflow
-          release: {{ .Release.Name }}
+          app.kubernetes.io/part-of: airflow
+          app.kubernetes.io/instance: {{ .Release.Name }}

Review Comment:
   During the rollover, the old tasks will not find this because it doesn't 
contain the old labels. It is something about which we will need to think 
during preparation of the change in 1.2x line.



##########
chart/templates/scheduler/scheduler-deployment.yaml:
##########
@@ -74,15 +70,13 @@ spec:
   {{- end }}
   selector:
     matchLabels:
-      tier: airflow
-      component: scheduler
-      release: {{ .Release.Name }}
+      app.kubernetes.io/part-of: airflow
+      app.kubernetes.io/component: scheduler
+      app.kubernetes.io/instance: {{ .Release.Name }}

Review Comment:
   As Kubernetes treats Deployment and StatefulSet selectors as immutable, 
upgrading an existing release will fail. We need to think about the upgrade 
path to make this change less painful.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to