HsiuChuanHsu commented on code in PR #56589:
URL: https://github.com/apache/airflow/pull/56589#discussion_r2448733928


##########
chart/templates/workers/worker-deployment.yaml:
##########
@@ -126,358 +179,371 @@ spec:
               labelSelector:
                 matchLabels:
                   component: worker
+                  {{- if not $isDefaultWorker }}
+                  worker-group: {{ $workerGroup.name }}
+                  {{- end }}
               topologyKey: kubernetes.io/hostname
             weight: 100
         {{- end }}
       tolerations: {{- toYaml $tolerations | nindent 8 }}
       topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | 
nindent 8 }}
-      {{- if .Values.workers.hostAliases }}
-      hostAliases: {{- toYaml .Values.workers.hostAliases | nindent 8 }}
+      {{- if $.Values.workers.hostAliases }}
+      hostAliases: {{- toYaml $.Values.workers.hostAliases | nindent 8 }}
       {{- end }}
-      terminationGracePeriodSeconds: {{ 
.Values.workers.terminationGracePeriodSeconds }}
+      terminationGracePeriodSeconds: {{ 
$.Values.workers.terminationGracePeriodSeconds }}
       restartPolicy: Always
-      {{- if .Values.workers.useWorkerDedicatedServiceAccounts }}
-      serviceAccountName: {{ include "worker.celery.serviceAccountName" . }}
+      {{- if $.Values.workers.useWorkerDedicatedServiceAccounts }}
+      serviceAccountName: {{ include "worker.celery.serviceAccountName" $ }}
       {{- else }}
-      serviceAccountName: {{ include "worker.serviceAccountName" . }}
+      serviceAccountName: {{ include "worker.serviceAccountName" $ }}
       {{- end }}
       securityContext: {{ $securityContext | nindent 8 }}
-      {{- if or .Values.registry.secretName .Values.registry.connection }}
+      {{- if or $.Values.registry.secretName $.Values.registry.connection }}

Review Comment:
   > We can use `$` for accessing the list Values.pizzaToppings from the parent 
scope. `$` is mapped to the root scope when template execution begins and it 
does not change during template execution. The following would work as well:
   https://helm.sh/docs/chart_template_guide/control_structures/
   
   The changing is required. After reviewing the Helm documentation, I've 
concluded the following is the behavior for context referencing:
   - `.` refers to the current context
   - `$`refers to the root context
   
   When inside a range loop, the current context (`.`) changes to the iterated 
item; to access chart-wide settings (like `.Values`), we must use the root 
context reference: `$.Values.something`
   
   
   
   
   



-- 
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