stegololz commented on code in PR #75945:
URL: https://github.com/apache/airflow/pull/75945#discussion_r4578074656


##########
chart/templates/dag-processor/dag-processor-serviceaccount.yaml:
##########
@@ -20,23 +20,52 @@
 #######################################
 ## Airflow Dag Processor ServiceAccount
 #######################################
-{{- if and .Values.dagProcessor.enabled 
.Values.dagProcessor.serviceAccount.create }}
+{{- if .Values.dagProcessor.enabled }}
+{{- $globals := deepCopy . -}}
+{{- $dagProcessorSets := .Values.dagProcessor.sets | default list -}}
+{{- $enableDefault := .Values.dagProcessor.enableDefault -}}
+{{- if kindIs "invalid" $enableDefault -}}
+  {{- $enableDefault = not .Values.dagProcessor.sets -}}
+{{- end -}}
+{{- if $enableDefault -}}
+  {{- $dagProcessorSets = concat (list (dict "name" "default")) 
$dagProcessorSets -}}
+{{- end -}}
+{{- $parentName := include "dagProcessor.serviceAccountName" . -}}
+{{- $rendered := dict -}}
+{{- range $dagProcessorSet := $dagProcessorSets -}}
+  {{- $dagProcessor := include "workersMergeValues" (list 
$.Values.dagProcessor $dagProcessorSet) | fromYaml -}}
+  {{- $_ := set $globals.Values "dagProcessor" $dagProcessor -}}
+  {{- with $globals -}}
+    {{- if .Values.dagProcessor.serviceAccount.create -}}

Review Comment:
   A set ServiceAccount is created here, but 
`rbac/security-context-constraint-rolebinding.yaml` (L113-116) still binds only 
`dagProcessor.serviceAccountName` of the parent values. With 
`rbac.createSCCRoleBinding: true`, `enableDefault: false` and a set using 
`serviceAccount: {create: true, name: team-a}`, the rolebinding lists 
`t-airflow-dag-processor` but never `team-a`, so that set's pods lose the SCC 
binding on OpenShift. Looping over the rendered SA names there would fix it.
   
   (Worker sets on main have the same gap in that file and in 
`pod-launcher-rolebinding.yaml`. Fine to keep that out of scope here.)
   



##########
chart/templates/dag-processor/dag-processor-deployment.yaml:
##########
@@ -32,10 +49,27 @@
 {{- $containerSecurityContextWaitForMigrations := include 
"containerSecurityContext" (list .Values.dagProcessor.waitForMigrations 
.Values) }}
 {{- $containerLifecycleHooks := or 
.Values.dagProcessor.containerLifecycleHooks .Values.containerLifecycleHooks }}
 {{- $containerLifecycleHooksLogGroomerSidecar := or 
.Values.dagProcessor.logGroomerSidecar.containerLifecycleHooks 
.Values.containerLifecycleHooks }}
+{{- $args := .Values.dagProcessor.args }}
+{{- $dagProcessorContext := . }}
+{{- with .Values.dagProcessor.bundleNames }}
+  {{- $definedBundles := list }}
+  {{- range $.Values.dagProcessor.dagBundleConfigList }}
+    {{- $definedBundles = append $definedBundles .name }}
+  {{- end }}
+  {{- $renderedArgs := tpl (toYaml $args) $dagProcessorContext }}
+  {{- range . }}
+    {{- if not (has . $definedBundles) }}

Review Comment:
   Two things here:
   
   - **Same bundle in two sets:** `bundleNames: [b1]` in two sets renders both, 
so `b1` gets parsed by two processors. A check that each bundle is claimed by 
at most one set would help; we hit this in our own setup.
   - **Substring match (nit):** the `contains . $renderedArgs` check on L64 
matches substrings, so a bundle `b1` passes when args only contain 
`--bundle-name 'b10'`.
   



##########
chart/templates/dag-processor/dag-processor-deployment.yaml:
##########
@@ -21,6 +21,23 @@
 ## Airflow Dag Processor Deployment
 #################################
 {{- if .Values.dagProcessor.enabled }}
+{{- $globals := deepCopy . -}}
+{{- $dagProcessorSets := .Values.dagProcessor.sets | default list -}}
+{{- $enableDefault := .Values.dagProcessor.enableDefault -}}
+{{- if kindIs "invalid" $enableDefault -}}
+  {{- $enableDefault = not .Values.dagProcessor.sets -}}
+{{- end -}}
+{{- if $enableDefault -}}
+  {{- $dagProcessorSets = concat (list (dict "name" "default")) 
$dagProcessorSets -}}
+{{- end -}}
+{{- range $dagProcessorSet := $dagProcessorSets -}}

Review Comment:
   Set names aren't validated, and these all render without error:
   
   - two sets named `x` give two Deployments `t-dag-processor-x`;
   - a set named `default` with `enableDefault: true` gives two 
`t-dag-processor`;
   - `team_a` gives `t-dag-processor-team_a`, which the API server rejects (not 
DNS-1123).
   
   A `fail` on duplicate names, on `default`, and on names that aren't DNS-1123 
labels would catch these at render time.
   



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