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

jscheffl 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 cfe4d2bc274 Simplify Helm Chart Logic & Misc (#63957)
cfe4d2bc274 is described below

commit cfe4d2bc274d19d37f7b76ac63d674bd8106cc24
Author: Przemysław Mirowski <[email protected]>
AuthorDate: Sat Mar 28 21:45:54 2026 +0100

    Simplify Helm Chart Logic & Misc (#63957)
    
    * Modify formatting
    
    * Simplify & combine logic statements
    
    * Move conditional envs to the bottom
    
    * Adjust tests
    
    * Remove some unneeded commants from scheduler
---
 chart/templates/_helpers.yaml                      | 111 ++++++++++-----------
 .../api-server/api-server-deployment.yaml          |   4 +-
 chart/templates/api-server/api-server-hpa.yaml     |   2 +-
 chart/templates/api-server/api-server-ingress.yaml |  18 ++--
 .../api-server/api-server-networkpolicy.yaml       |   6 +-
 .../api-server/api-server-poddisruptionbudget.yaml |   6 +-
 chart/templates/api-server/api-server-service.yaml |   2 +-
 .../api-server/api-server-serviceaccount.yaml      |   2 +-
 chart/templates/cleanup/cleanup-cronjob.yaml       |   6 +-
 .../templates/cleanup/cleanup-serviceaccount.yaml  |   6 +-
 .../templates/configmaps/api-server-configmap.yaml |   4 +-
 chart/templates/configmaps/configmap.yaml          |   8 +-
 chart/templates/configmaps/statsd-configmap.yaml   |   2 +-
 .../dag-processor/dag-processor-deployment.yaml    |   2 +-
 .../dag-processor-poddisruptionbudget.yaml         |   2 +-
 chart/templates/dags-persistent-volume-claim.yaml  |   2 +-
 .../database-cleanup/database-cleanup-cronjob.yaml |   4 +-
 .../database-cleanup-serviceaccount.yaml           |   2 +-
 chart/templates/flower/flower-deployment.yaml      |  16 ++-
 chart/templates/flower/flower-ingress.yaml         |  12 +--
 chart/templates/flower/flower-networkpolicy.yaml   |   6 +-
 chart/templates/flower/flower-service.yaml         |   6 +-
 chart/templates/flower/flower-serviceaccount.yaml  |   4 +-
 .../jobs/create-user-job-serviceaccount.yaml       |   2 +-
 chart/templates/jobs/create-user-job.yaml          |   2 +-
 .../jobs/migrate-database-job-serviceaccount.yaml  |   2 +-
 chart/templates/jobs/migrate-database-job.yaml     |   2 +-
 chart/templates/logs-persistent-volume-claim.yaml  |   2 +-
 .../templates/pgbouncer/pgbouncer-deployment.yaml  |   4 +-
 chart/templates/pgbouncer/pgbouncer-ingress.yaml   |  12 +--
 .../pgbouncer/pgbouncer-networkpolicy.yaml         |  15 ++-
 .../pgbouncer/pgbouncer-poddisruptionbudget.yaml   |   2 +-
 chart/templates/pgbouncer/pgbouncer-service.yaml   |   2 +-
 .../pgbouncer/pgbouncer-serviceaccount.yaml        |   2 +-
 chart/templates/rbac/job-launcher-rolebinding.yaml |  10 +-
 chart/templates/rbac/pod-launcher-rolebinding.yaml |  10 +-
 chart/templates/redis/redis-service.yaml           |   2 +-
 .../templates/scheduler/scheduler-deployment.yaml  |  10 +-
 .../scheduler/scheduler-networkpolicy.yaml         |   6 +-
 .../scheduler/scheduler-poddisruptionbudget.yaml   |   6 +-
 chart/templates/scheduler/scheduler-service.yaml   |   6 +-
 .../scheduler/scheduler-serviceaccount.yaml        |   2 +-
 chart/templates/secrets/elasticsearch-secret.yaml  |   2 +-
 chart/templates/secrets/git-ssh-key-secret.yaml    |   2 +-
 chart/templates/secrets/jwt-secret.yaml            |   6 +-
 .../secrets/metadata-connection-secret.yaml        |   4 +-
 chart/templates/secrets/opensearch-secret.yaml     |   2 +-
 .../templates/secrets/pgbouncer-config-secret.yaml |   2 +-
 .../templates/secrets/pgbouncer-stats-secret.yaml  |   2 +-
 chart/templates/secrets/registry-secret.yaml       |   2 +-
 .../secrets/result-backend-connection-secret.yaml  |   6 +-
 chart/templates/statsd/statsd-ingress.yaml         |  11 +-
 .../templates/triggerer/triggerer-deployment.yaml  |   8 +-
 .../triggerer/triggerer-kedaautoscaler.yaml        |   2 +-
 .../triggerer/triggerer-networkpolicy.yaml         |   6 +-
 chart/templates/triggerer/triggerer-service.yaml   |   2 +-
 .../triggerer/triggerer-serviceaccount.yaml        |   2 +-
 .../templates/webserver/webserver-deployment.yaml  |   2 +-
 chart/templates/webserver/webserver-hpa.yaml       |   6 +-
 chart/templates/webserver/webserver-ingress.yaml   |  14 +--
 .../webserver/webserver-networkpolicy.yaml         |   6 +-
 .../webserver/webserver-poddisruptionbudget.yaml   |   6 +-
 chart/templates/webserver/webserver-service.yaml   |   2 +-
 .../webserver/webserver-serviceaccount.yaml        |   6 +-
 chart/templates/workers/worker-deployment.yaml     |   6 +-
 chart/templates/workers/worker-hpa.yaml            |   2 +-
 chart/templates/workers/worker-kedaautoscaler.yaml |   2 +-
 chart/templates/workers/worker-networkpolicy.yaml  |   2 +-
 chart/templates/workers/worker-service.yaml        |   2 +-
 chart/templates/workers/worker-serviceaccount.yaml |   2 +-
 helm-tests/tests/chart_utils/log_groomer.py        |   6 +-
 .../helm_tests/airflow_aux/test_airflow_common.py  |   6 +-
 .../helm_tests/airflow_aux/test_remote_logging.py  |   4 +-
 helm-tests/tests/helm_tests/other/test_flower.py   |   6 +-
 .../helm_tests/other/test_git_sync_scheduler.py    |   2 +-
 75 files changed, 197 insertions(+), 276 deletions(-)

diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 46391a7bdb6..5ef1759f604 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -53,6 +53,8 @@ If release name contains chart name it will be used as a full 
name.
 {{/* Standard Airflow environment variables */}}
 {{- define "standard_airflow_environment" }}
   # Hard Coded Airflow Envs
+  - name: AIRFLOW_HOME
+    value: {{ .Values.airflowHome }}
   {{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__CORE__FERNET_KEY }}
   - name: AIRFLOW__CORE__FERNET_KEY
     valueFrom:
@@ -60,8 +62,6 @@ If release name contains chart name it will be used as a full 
name.
         name: {{ template "fernet_key_secret" . }}
         key: fernet-key
   {{- end }}
-  - name: AIRFLOW_HOME
-    value: {{ .Values.airflowHome }}
   {{- if 
.Values.enableBuiltInSecretEnvVars.AIRFLOW__DATABASE__SQL_ALCHEMY_CONN }}
   - name: AIRFLOW__DATABASE__SQL_ALCHEMY_CONN
     valueFrom:
@@ -111,15 +111,13 @@ If release name contains chart name it will be used as a 
full name.
         key: jwt-secret
   {{- end }}
   {{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
-    {{- if or (.Values.data.resultBackendSecretName) 
(.Values.data.resultBackendConnection) }}
-    {{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__RESULT_BACKEND 
}}
+    {{- if and 
.Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__RESULT_BACKEND (or 
.Values.data.resultBackendSecretName .Values.data.resultBackendConnection) }}
   - name: AIRFLOW__CELERY__RESULT_BACKEND
     valueFrom:
       secretKeyRef:
         name: {{ template "airflow_result_backend_secret" . }}
         key: connection
     {{- end }}
-    {{- end }}
     {{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__BROKER_URL }}
   - name: AIRFLOW__CELERY__BROKER_URL
     valueFrom:
@@ -128,23 +126,19 @@ If release name contains chart name it will be used as a 
full name.
         key: connection
     {{- end }}
   {{- end }}
-  {{- if .Values.elasticsearch.enabled }}
-    {{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__ELASTICSEARCH__HOST }}
+  {{- if and .Values.elasticsearch.enabled 
.Values.enableBuiltInSecretEnvVars.AIRFLOW__ELASTICSEARCH__HOST }}
   - name: AIRFLOW__ELASTICSEARCH__HOST
     valueFrom:
       secretKeyRef:
         name: {{ template "elasticsearch_secret" . }}
         key: connection
-    {{- end }}
   {{- end }}
-  {{- if .Values.opensearch.enabled }}
-    {{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__OPENSEARCH__HOST }}
+  {{- if and .Values.opensearch.enabled 
.Values.enableBuiltInSecretEnvVars.AIRFLOW__OPENSEARCH__HOST }}
   - name: AIRFLOW__OPENSEARCH__HOST
     valueFrom:
       secretKeyRef:
         name: {{ template "opensearch_secret" . }}
         key: connection
-    {{- end }}
   {{- end }}
 {{- end }}
 
@@ -186,7 +180,7 @@ If release name contains chart name it will be used as a 
full name.
   {{- end }}
 {{- end }}
 
-{{/*  Git ssh key volume */}}
+{{/* Git ssh key volume */}}
 {{- define "git_sync_ssh_key_volume" }}
 - name: git-sync-ssh-key
   secret:
@@ -194,7 +188,7 @@ If release name contains chart name it will be used as a 
full name.
     defaultMode: 288
 {{- end }}
 
-{{/*  Git sync container */}}
+{{/* Git sync container */}}
 {{- define "git_sync_container" }}
 - name: {{ .Values.dags.gitSync.containerName }}{{ if .is_init }}-init{{ end }}
   image: {{ template "git_sync_image" . }}
@@ -202,6 +196,38 @@ If release name contains chart name it will be used as a 
full name.
   securityContext: {{- include "localContainerSecurityContext" 
.Values.dags.gitSync | nindent 4 }}
   envFrom: {{- include "custom_git_sync_environment_from" . | default "\n  []" 
| indent 2 }}
   env:
+    - name: GIT_SYNC_REV
+      value: {{ .Values.dags.gitSync.rev | quote }}
+    - name: GITSYNC_REF
+      value: {{ .Values.dags.gitSync.ref | quote }}
+    - name: GIT_SYNC_BRANCH
+      value: {{ .Values.dags.gitSync.branch | quote }}
+    - name: GIT_SYNC_REPO
+      value: {{ .Values.dags.gitSync.repo | quote }}
+    - name: GITSYNC_REPO
+      value: {{ .Values.dags.gitSync.repo | quote }}
+    - name: GIT_SYNC_DEPTH
+      value: {{ .Values.dags.gitSync.depth | quote }}
+    - name: GITSYNC_DEPTH
+      value: {{ .Values.dags.gitSync.depth | quote }}
+    - name: GIT_SYNC_ROOT
+      value: "/git"
+    - name: GITSYNC_ROOT
+      value: "/git"
+    - name: GIT_SYNC_DEST
+      value: "repo"
+    - name: GITSYNC_LINK
+      value: "repo"
+    - name: GIT_SYNC_ADD_USER
+      value: "true"
+    - name: GITSYNC_ADD_USER
+      value: "true"
+    - name: GITSYNC_PERIOD
+      value: {{ .Values.dags.gitSync.period | quote }}
+    - name: GIT_SYNC_MAX_SYNC_FAILURES
+      value: {{ .Values.dags.gitSync.maxFailures | quote }}
+    - name: GITSYNC_MAX_FAILURES
+      value: {{ .Values.dags.gitSync.maxFailures | quote }}
     {{- if or .Values.dags.gitSync.sshKeySecret .Values.dags.gitSync.sshKey }}
     - name: GIT_SSH_KEY_FILE
       value: "/etc/git-secret/ssh"
@@ -248,42 +274,10 @@ If release name contains chart name it will be used as a 
full name.
           name: {{ .Values.dags.gitSync.credentialsSecret | quote }}
           key: GITSYNC_PASSWORD
     {{- end }}
-    - name: GIT_SYNC_REV
-      value: {{ .Values.dags.gitSync.rev | quote }}
-    - name: GITSYNC_REF
-      value: {{ .Values.dags.gitSync.ref | quote }}
-    - name: GIT_SYNC_BRANCH
-      value: {{ .Values.dags.gitSync.branch | quote }}
-    - name: GIT_SYNC_REPO
-      value: {{ .Values.dags.gitSync.repo | quote }}
-    - name: GITSYNC_REPO
-      value: {{ .Values.dags.gitSync.repo | quote }}
-    - name: GIT_SYNC_DEPTH
-      value: {{ .Values.dags.gitSync.depth | quote }}
-    - name: GITSYNC_DEPTH
-      value: {{ .Values.dags.gitSync.depth | quote }}
-    - name: GIT_SYNC_ROOT
-      value: "/git"
-    - name: GITSYNC_ROOT
-      value: "/git"
-    - name: GIT_SYNC_DEST
-      value: "repo"
-    - name: GITSYNC_LINK
-      value: "repo"
-    - name: GIT_SYNC_ADD_USER
-      value: "true"
-    - name: GITSYNC_ADD_USER
-      value: "true"
     {{- if .Values.dags.gitSync.wait }}
     - name: GIT_SYNC_WAIT
       value: {{ .Values.dags.gitSync.wait | quote }}
     {{- end }}
-    - name: GITSYNC_PERIOD
-      value: {{ .Values.dags.gitSync.period | quote }}
-    - name: GIT_SYNC_MAX_SYNC_FAILURES
-      value: {{ .Values.dags.gitSync.maxFailures | quote }}
-    - name: GITSYNC_MAX_FAILURES
-      value: {{ .Values.dags.gitSync.maxFailures | quote }}
     {{- if .is_init }}
     - name: GIT_SYNC_ONE_TIME
       value: "true"
@@ -454,9 +448,9 @@ If release name contains chart name it will be used as a 
full name.
 {{- end }}
 
 {{- define "image_pull_secrets" -}}
-  {{- $secrets := (default (list .Values.registry.secretName) 
.Values.imagePullSecrets) -}}
+  {{- $secrets := default (list .Values.registry.secretName) 
.Values.imagePullSecrets -}}
   {{- $secrets = ($secrets | compact | uniq) -}}
-  {{- if and (not $secrets) (or .Values.registry.connection) -}}
+  {{- if and (not $secrets) .Values.registry.connection -}}
     {{- $secrets = append $secrets (printf "%s-registry" (include 
"airflow.fullname" .)) -}}
   {{- end -}}
   {{- $out := list -}}
@@ -778,8 +772,6 @@ server_tls_key_file = /etc/pgbouncer/server.key
 {{- end }}
 
 {{- define "registry_docker_config" }}
-  {{- $host := .Values.registry.connection.host }}
-  {{- $email := .Values.registry.connection.email }}
   {{- $user := .Values.registry.connection.user }}
   {{- $pass := .Values.registry.connection.pass }}
 
@@ -788,9 +780,9 @@ server_tls_key_file = /etc/pgbouncer/server.key
   {{- $data := dict }}
   {{- $_ := set $data "username" $user }}
   {{- $_ := set $data "password" $pass }}
-  {{- $_ := set $data "email" $email }}
+  {{- $_ := set $data "email" .Values.registry.connection.email }}
   {{- $_ := set $data "auth" (printf "%v:%v" $user $pass | b64enc) }}
-  {{- $_ := set $auth $host $data }}
+  {{- $_ := set $auth .Values.registry.connection.host $data }}
   {{- $_ := set $config "auths" $auth }}
   {{ $config | toJson | print }}
 {{- end }}
@@ -837,9 +829,9 @@ fsGroup: {{ $.gid }}
 Set the default value for pod securityContext
 If no value is passed for <node>.securityContexts.pod or 
<node>.securityContext, defaults to UID in the local node.
 
-    +-----------------------------+      +------------------------+      
+-------------+
-    | <node>.securityContexts.pod |  ->  | <node>.securityContext |  ->  | 
<node>.uid  |
-    +-----------------------------+      +------------------------+      
+-------------+
+    +-----------------------------+      +------------------------+      
+------------+
+    | <node>.securityContexts.pod |  ->  | <node>.securityContext |  ->  | 
<node>.uid |
+    +-----------------------------+      +------------------------+      
+------------+
 
 The template can be called like so:
   include "localPodSecurityContext" (list . .Values.schedule)
@@ -860,9 +852,9 @@ runAsUser: {{ .uid }}
 Set the default value for container securityContext
 If no value is passed for <node>.securityContexts.container or 
<node>.securityContext, defaults to UID in the local node.
 
-    +-----------------------------------+      +------------------------+      
+-------------+
-    | <node>.securityContexts.container |  ->  | <node>.securityContext |  ->  
| <node>.uid  |
-    +-----------------------------------+      +------------------------+      
+-------------+
+    +-----------------------------------+      +------------------------+      
+------------+
+    | <node>.securityContexts.container |  ->  | <node>.securityContext |  ->  
| <node>.uid |
+    +-----------------------------------+      +------------------------+      
+------------+
 
 The template can be called like so:
   include "localContainerSecurityContext" .Values.statsd
@@ -1027,11 +1019,10 @@ Usage:
 */}}
 {{- define "airflow.revisionHistoryLimit" -}}
   {{- $result := "" -}}
-  {{- $found := false -}}
   {{- range . -}}
-    {{- if and (not $found) (not (kindIs "invalid" .)) -}}
+    {{- if and (not (kindIs "invalid" .)) -}}
       {{- $result = . -}}
-      {{- $found = true -}}
+      {{- break -}}
     {{- end -}}
   {{- end -}}
   {{- $result -}}
diff --git a/chart/templates/api-server/api-server-deployment.yaml 
b/chart/templates/api-server/api-server-deployment.yaml
index 4ef8a5be3ea..a79b77c7013 100644
--- a/chart/templates/api-server/api-server-deployment.yaml
+++ b/chart/templates/api-server/api-server-deployment.yaml
@@ -55,7 +55,7 @@ spec:
   {{- end }}
   strategy:
     {{- if .Values.apiServer.strategy }}
-    {{- toYaml .Values.apiServer.strategy | nindent 4 }}
+      {{- toYaml .Values.apiServer.strategy | nindent 4 }}
     {{- else }}
     # Here we define the rolling update strategy
     # - maxSurge define how many pod we can add at a time
@@ -80,7 +80,7 @@ spec:
         tier: airflow
         component: api-server
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+        {{- if or .Values.labels .Values.apiServer.labels }}
           {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
diff --git a/chart/templates/api-server/api-server-hpa.yaml 
b/chart/templates/api-server/api-server-hpa.yaml
index ee714efd918..16988bc440e 100644
--- a/chart/templates/api-server/api-server-hpa.yaml
+++ b/chart/templates/api-server/api-server-hpa.yaml
@@ -32,7 +32,7 @@ metadata:
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
     deploymentName: {{ .Release.Name }}-api-server
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
diff --git a/chart/templates/api-server/api-server-ingress.yaml 
b/chart/templates/api-server/api-server-ingress.yaml
index 02860382cd1..9e530d74cd8 100644
--- a/chart/templates/api-server/api-server-ingress.yaml
+++ b/chart/templates/api-server/api-server-ingress.yaml
@@ -20,9 +20,8 @@
 ################################
 ## Airflow API Server Ingress
 #################################
-{{- if and .Values.apiServer.enabled (semverCompare ">=3.0.0" 
.Values.airflowVersion) }}
-{{- if or .Values.ingress.apiServer.enabled .Values.ingress.enabled }}
-{{- $fullname := (include "airflow.fullname" .) }}
+{{- if and .Values.apiServer.enabled (semverCompare ">=3.0.0" 
.Values.airflowVersion) (or .Values.ingress.apiServer.enabled 
.Values.ingress.enabled) }}
+{{- $fullname := include "airflow.fullname" . }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
@@ -33,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.ingress.apiServer.annotations }}
@@ -43,24 +42,20 @@ spec:
   {{- if and .Values.ingress.apiServer.hosts (.Values.ingress.apiServer.hosts 
| first | kindIs "string" | not) }}
   {{- $anyTlsHosts := false -}}
   {{- range .Values.ingress.apiServer.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
   {{- $anyTlsHosts = true -}}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- if $anyTlsHosts }}
   tls:
   {{- range .Values.ingress.apiServer.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
     - hosts:
         - {{ tpl .name $ | quote }}
       secretName: {{ .tls.secretName }}
   {{- end }}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- else if .Values.ingress.apiServer.tls.enabled }}
   tls:
     - hosts:
@@ -102,7 +97,7 @@ spec:
           {{- end }}
       {{- $hostname := . -}}
       {{- if . | kindIs "string" | not }}
-      {{- $hostname = .name -}}
+        {{- $hostname = .name -}}
       {{- end }}
       {{- if $hostname }}
       host: {{ tpl $hostname $ | quote }}
@@ -112,4 +107,3 @@ spec:
   ingressClassName: {{ .Values.ingress.apiServer.ingressClassName }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/api-server/api-server-networkpolicy.yaml 
b/chart/templates/api-server/api-server-networkpolicy.yaml
index c3171049aa2..4459a85a17a 100644
--- a/chart/templates/api-server/api-server-networkpolicy.yaml
+++ b/chart/templates/api-server/api-server-networkpolicy.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow API Server NetworkPolicy
 #################################
-{{- if and .Values.apiServer.enabled (semverCompare ">=3.0.0" 
.Values.airflowVersion) }}
-{{- if .Values.networkPolicies.enabled }}
+{{- if and .Values.apiServer.enabled .Values.networkPolicies.enabled 
(semverCompare ">=3.0.0" .Values.airflowVersion) }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -55,4 +54,3 @@ spec:
       {{- end }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/api-server/api-server-poddisruptionbudget.yaml 
b/chart/templates/api-server/api-server-poddisruptionbudget.yaml
index 4895b4ab5bb..f6dfb85d480 100644
--- a/chart/templates/api-server/api-server-poddisruptionbudget.yaml
+++ b/chart/templates/api-server/api-server-poddisruptionbudget.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow API Server PodDisruptionBudget
 #################################
-{{- if and .Values.apiServer.enabled (semverCompare ">=3.0.0" 
.Values.airflowVersion) }}
-{{- if .Values.apiServer.podDisruptionBudget.enabled }}
+{{- if and .Values.apiServer.enabled 
.Values.apiServer.podDisruptionBudget.enabled (semverCompare ">=3.0.0" 
.Values.airflowVersion) }}
 apiVersion: policy/v1
 kind: PodDisruptionBudget
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -43,4 +42,3 @@ spec:
       release: {{ .Release.Name }}
   {{- toYaml .Values.apiServer.podDisruptionBudget.config | nindent 2 }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/api-server/api-server-service.yaml 
b/chart/templates/api-server/api-server-service.yaml
index 6cf50a172c3..a402321a1bd 100644
--- a/chart/templates/api-server/api-server-service.yaml
+++ b/chart/templates/api-server/api-server-service.yaml
@@ -31,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.apiServer.service.annotations }}
diff --git a/chart/templates/api-server/api-server-serviceaccount.yaml 
b/chart/templates/api-server/api-server-serviceaccount.yaml
index 0fc260ea64b..0cd9984df96 100644
--- a/chart/templates/api-server/api-server-serviceaccount.yaml
+++ b/chart/templates/api-server/api-server-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.apiServer.labels) }}
+    {{- if or .Values.labels .Values.apiServer.labels }}
       {{- mustMerge .Values.apiServer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.apiServer.serviceAccount.annotations }}
diff --git a/chart/templates/cleanup/cleanup-cronjob.yaml 
b/chart/templates/cleanup/cleanup-cronjob.yaml
index 88ca64e8c42..ae202fddde5 100644
--- a/chart/templates/cleanup/cleanup-cronjob.yaml
+++ b/chart/templates/cleanup/cleanup-cronjob.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Cleanup Pods CronJob
 #################################
-{{- if (and .Values.cleanup.enabled (contains "KubernetesExecutor" 
.Values.executor)) }}
+{{- if and .Values.cleanup.enabled (contains "KubernetesExecutor" 
.Values.executor) }}
 {{- $nodeSelector := or .Values.cleanup.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.cleanup.affinity .Values.affinity }}
 {{- $tolerations := or .Values.cleanup.tolerations .Values.tolerations }}
@@ -47,7 +47,7 @@ spec:
   schedule: "{{ tpl .Values.cleanup.schedule . }}"
   # The cron job does not allow concurrent runs; if it is time for a new job 
run and the previous job run hasn't finished yet, the cron job skips the new 
job run
   concurrencyPolicy: Forbid
-  {{- if not ( eq .Values.cleanup.failedJobsHistoryLimit nil) }}
+  {{- if not (eq .Values.cleanup.failedJobsHistoryLimit nil) }}
   failedJobsHistoryLimit: {{ .Values.cleanup.failedJobsHistoryLimit }}
   {{- end }}
   {{- if not (eq .Values.cleanup.successfulJobsHistoryLimit nil) }}
@@ -62,7 +62,7 @@ spec:
             tier: airflow
             component: airflow-cleanup-pods
             release: {{ .Release.Name }}
-            {{- if or (.Values.labels) (.Values.cleanup.labels) }}
+            {{- if or .Values.labels .Values.cleanup.labels }}
               {{- mustMerge .Values.cleanup.labels .Values.labels | toYaml | 
nindent 12 }}
             {{- end }}
           annotations:
diff --git a/chart/templates/cleanup/cleanup-serviceaccount.yaml 
b/chart/templates/cleanup/cleanup-serviceaccount.yaml
index 00075f03795..d3c2222b159 100644
--- a/chart/templates/cleanup/cleanup-serviceaccount.yaml
+++ b/chart/templates/cleanup/cleanup-serviceaccount.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Cleanup ServiceAccount
 #################################
-{{- if (and .Values.cleanup.enabled (contains "KubernetesExecutor" 
.Values.executor)) }}
-{{- if .Values.cleanup.serviceAccount.create }}
+{{- if and .Values.cleanup.enabled .Values.cleanup.serviceAccount.create 
(contains "KubernetesExecutor" .Values.executor) }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.cleanup.serviceAccount.automountServiceAccountToken }}
@@ -33,11 +32,10 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.cleanup.labels) }}
+    {{- if or .Values.labels .Values.cleanup.labels }}
       {{- mustMerge .Values.cleanup.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
   {{- with .Values.cleanup.serviceAccount.annotations }}
   annotations: {{- toYaml . | nindent 4 }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/configmaps/api-server-configmap.yaml 
b/chart/templates/configmaps/api-server-configmap.yaml
index 2cc4ced23d3..69d5dd4a141 100644
--- a/chart/templates/configmaps/api-server-configmap.yaml
+++ b/chart/templates/configmaps/api-server-configmap.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow ConfigMap
 #################################
-{{- if semverCompare ">=3.0.0" .Values.airflowVersion }}
-{{- if and .Values.apiServer.apiServerConfig (not 
.Values.apiServer.apiServerConfigConfigMapName) }}
+{{- if and (semverCompare ">=3.0.0" .Values.airflowVersion) 
.Values.apiServer.apiServerConfig (not 
.Values.apiServer.apiServerConfigConfigMapName) }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
@@ -43,4 +42,3 @@ data:
   webserver_config.py: |-
     {{- tpl .Values.apiServer.apiServerConfig . | nindent 4 }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/configmaps/configmap.yaml 
b/chart/templates/configmaps/configmap.yaml
index 079b67d94b8..3b0ac74c057 100644
--- a/chart/templates/configmaps/configmap.yaml
+++ b/chart/templates/configmaps/configmap.yaml
@@ -43,7 +43,7 @@ data:
   {{- if semverCompare ">=3.0.0" .Values.airflowVersion -}}
     {{- $basePath := "" -}}
     {{- if not (hasKey $config.core "execution_api_server_url") -}}
-      {{-  if (and $config.api $config.api.base_url) -}}
+      {{-  if and $config.api $config.api.base_url -}}
         {{- with urlParse $config.api.base_url }}{{ $basePath = (trimSuffix 
"/" .path) }}{{ end }}
       {{- end -}}
       {{- $_ := set $config.core "execution_api_server_url" (printf 
"http://%s-api-server:%d%s/execution/"; (include "airflow.fullname" .) (int 
.Values.ports.apiServer) $basePath)  -}}
@@ -56,7 +56,7 @@ data:
     {{- range $key, $val := $settings }}
     {{ $key }} = {{ tpl ($val | toString) $Global }}
     {{- end }}
-    {{ end }}
+    {{- end }}
 
   {{- if .Values.airflowLocalSettings }}
   airflow_local_settings.py: |-
@@ -68,14 +68,14 @@ data:
     {{- .Values.dags.gitSync.knownHosts | nindent 4 }}
   {{- end }}
 
-{{- if or (contains "LocalKubernetesExecutor" $.Values.executor) (contains 
"KubernetesExecutor" $.Values.executor) (contains "CeleryKubernetesExecutor" 
$.Values.executor) }}
+  {{- if or (contains "LocalKubernetesExecutor" $.Values.executor) (contains 
"KubernetesExecutor" $.Values.executor) (contains "CeleryKubernetesExecutor" 
$.Values.executor) }}
   pod_template_file.yaml: |-
     {{- if .Values.podTemplate }}
       {{- tpl .Values.podTemplate . | nindent 4 }}
     {{- else }}
       {{- tpl (.Files.Get "files/pod-template-file.kubernetes-helm-yaml") . | 
nindent 4 }}
     {{- end }}
-{{- end }}
+  {{- end }}
 
   {{- if .Values.kerberos.enabled }}
   krb5.conf: |-
diff --git a/chart/templates/configmaps/statsd-configmap.yaml 
b/chart/templates/configmaps/statsd-configmap.yaml
index b5aa884d1d0..69799cb1238 100644
--- a/chart/templates/configmaps/statsd-configmap.yaml
+++ b/chart/templates/configmaps/statsd-configmap.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow StatsD ConfigMap
 #################################
-{{- if and .Values.statsd.enabled }}
+{{- if .Values.statsd.enabled }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml 
b/chart/templates/dag-processor/dag-processor-deployment.yaml
index 0123c5b3e0c..f2286315bf4 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -140,7 +140,7 @@ spec:
               {{- tpl (toYaml .Values.dagProcessor.waitForMigrations.env) $ | 
nindent 12 }}
             {{- end }}
         {{- end }}
-        {{- if and (.Values.dags.gitSync.enabled) (not 
.Values.dags.persistence.enabled) }}
+        {{- if and .Values.dags.gitSync.enabled (not 
.Values.dags.persistence.enabled) }}
           {{- include "git_sync_container" (dict "Values" .Values "is_init" 
"true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.dagProcessor.extraInitContainers }}
diff --git 
a/chart/templates/dag-processor/dag-processor-poddisruptionbudget.yaml 
b/chart/templates/dag-processor/dag-processor-poddisruptionbudget.yaml
index 27c39a8e050..996c0e7e8f8 100644
--- a/chart/templates/dag-processor/dag-processor-poddisruptionbudget.yaml
+++ b/chart/templates/dag-processor/dag-processor-poddisruptionbudget.yaml
@@ -35,7 +35,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.dagProcessor.labels) }}
+    {{- if or .Values.labels .Values.dagProcessor.labels }}
       {{- mustMerge .Values.dagProcessor.labels .Values.labels | toYaml | 
nindent 4 }}
     {{- end }}
 spec:
diff --git a/chart/templates/dags-persistent-volume-claim.yaml 
b/chart/templates/dags-persistent-volume-claim.yaml
index c0999aa0b40..198330b1f47 100644
--- a/chart/templates/dags-persistent-volume-claim.yaml
+++ b/chart/templates/dags-persistent-volume-claim.yaml
@@ -20,7 +20,7 @@
 ######################################
 ## Airflow DAGs PersistentVolumeClaim
 ######################################
-{{- if and (not .Values.dags.persistence.existingClaim ) 
.Values.dags.persistence.enabled }}
+{{- if and (not .Values.dags.persistence.existingClaim) 
.Values.dags.persistence.enabled }}
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
diff --git a/chart/templates/database-cleanup/database-cleanup-cronjob.yaml 
b/chart/templates/database-cleanup/database-cleanup-cronjob.yaml
index 03e0ce08d4b..f22db1fc47d 100644
--- a/chart/templates/database-cleanup/database-cleanup-cronjob.yaml
+++ b/chart/templates/database-cleanup/database-cleanup-cronjob.yaml
@@ -47,7 +47,7 @@ spec:
   schedule: "{{ tpl .Values.databaseCleanup.schedule . }}"
   # The cron job does not allow concurrent runs; if it is time for a new job 
run and the previous job run hasn't finished yet, the cron job skips the new 
job run
   concurrencyPolicy: Forbid
-  {{- if not ( eq .Values.databaseCleanup.failedJobsHistoryLimit nil) }}
+  {{- if not (eq .Values.databaseCleanup.failedJobsHistoryLimit nil) }}
   failedJobsHistoryLimit: {{ .Values.databaseCleanup.failedJobsHistoryLimit }}
   {{- end }}
   {{- if not (eq .Values.databaseCleanup.successfulJobsHistoryLimit nil) }}
@@ -62,7 +62,7 @@ spec:
             tier: airflow
             component: database-cleanup
             release: {{ .Release.Name }}
-            {{- if or (.Values.labels) (.Values.databaseCleanup.labels) }}
+            {{- if or .Values.labels .Values.databaseCleanup.labels }}
               {{- mustMerge .Values.databaseCleanup.labels .Values.labels | 
toYaml | nindent 12 }}
             {{- end }}
           annotations:
diff --git 
a/chart/templates/database-cleanup/database-cleanup-serviceaccount.yaml 
b/chart/templates/database-cleanup/database-cleanup-serviceaccount.yaml
index d3b823f1fe6..80262a4f60a 100644
--- a/chart/templates/database-cleanup/database-cleanup-serviceaccount.yaml
+++ b/chart/templates/database-cleanup/database-cleanup-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.databaseCleanup.labels) }}
+    {{- if or .Values.labels .Values.databaseCleanup.labels }}
       {{- mustMerge .Values.databaseCleanup.labels .Values.labels | toYaml | 
nindent 4 }}
     {{- end }}
   {{- with .Values.databaseCleanup.serviceAccount.annotations }}
diff --git a/chart/templates/flower/flower-deployment.yaml 
b/chart/templates/flower/flower-deployment.yaml
index a68c8400c3e..4f5ee7961eb 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Flower Deployment
 #################################
-{{- if .Values.flower.enabled }}
-{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
+{{- if and .Values.flower.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 {{- $nodeSelector := or .Values.flower.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.flower.affinity .Values.affinity }}
 {{- $tolerations := or .Values.flower.tolerations .Values.tolerations }}
@@ -62,13 +61,13 @@ spec:
         tier: airflow
         component: flower
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.flower.labels) }}
+        {{- if or .Values.labels .Values.flower.labels }}
           {{- mustMerge .Values.flower.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
         checksum/airflow-config: {{ include (print $.Template.BasePath 
"/configmaps/configmap.yaml") . | sha256sum }}
         checksum/flower-secret: {{ include (print $.Template.BasePath 
"/secrets/flower-secret.yaml") . | sha256sum }}
-        {{- if or (.Values.airflowPodAnnotations) 
(.Values.flower.podAnnotations) }}
+        {{- if or .Values.airflowPodAnnotations .Values.flower.podAnnotations 
}}
           {{- tpl (mustMerge .Values.flower.podAnnotations 
.Values.airflowPodAnnotations | toYaml) . | nindent 8 }}
         {{- end }}
     spec:
@@ -117,7 +116,7 @@ spec:
             exec:
               command:
                 - curl
-                {{- if (or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password))}}
+                {{- if or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password) }}
                 - "--user"
                 - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
                 {{- end }}
@@ -130,7 +129,7 @@ spec:
             exec:
               command:
                 - curl
-                {{- if (or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password))}}
+                {{- if or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password) }}
                 - "--user"
                 - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
                 {{- end }}
@@ -143,7 +142,7 @@ spec:
             exec:
               command:
                 - curl
-                {{- if (or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password))}}
+                {{- if or .Values.flower.secretName (and 
.Values.flower.username .Values.flower.password) }}
                 - "--user"
                 - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
                 {{- end }}
@@ -154,7 +153,7 @@ spec:
           envFrom:
           {{- include "custom_airflow_environment_from" . | default "\n  []" | 
indent 10 }}
           env:
-            {{- if (or .Values.flower.secretName (and .Values.flower.username 
.Values.flower.password))}}
+            {{- if or .Values.flower.secretName (and .Values.flower.username 
.Values.flower.password) }}
             - name: AIRFLOW__CELERY__FLOWER_BASIC_AUTH
               valueFrom:
                 secretKeyRef:
@@ -178,4 +177,3 @@ spec:
           {{- tpl (toYaml .Values.flower.extraVolumes) . | nindent 8 }}
         {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/flower/flower-ingress.yaml 
b/chart/templates/flower/flower-ingress.yaml
index f1822338d5d..11ba85a0939 100644
--- a/chart/templates/flower/flower-ingress.yaml
+++ b/chart/templates/flower/flower-ingress.yaml
@@ -22,7 +22,7 @@
 #################################
 {{- if .Values.flower.enabled }}
 {{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
-{{- $fullname := (include "airflow.fullname" .) }}
+{{- $fullname := include "airflow.fullname" . }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
@@ -33,7 +33,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.flower.labels) }}
+    {{- if or .Values.labels .Values.flower.labels }}
       {{- mustMerge .Values.flower.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
   {{- with .Values.ingress.flower.annotations }}
@@ -43,24 +43,20 @@ spec:
   {{- if and .Values.ingress.flower.hosts (.Values.ingress.flower.hosts | 
first | kindIs "string" | not) }}
   {{- $anyTlsHosts := false -}}
   {{- range .Values.ingress.flower.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
   {{- $anyTlsHosts = true -}}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- if $anyTlsHosts }}
   tls:
   {{- range .Values.ingress.flower.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
     - hosts:
         - {{ tpl .name $ | quote }}
       secretName: {{ .tls.secretName }}
   {{- end }}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- else if .Values.ingress.flower.tls.enabled }}
   tls:
     - hosts:
diff --git a/chart/templates/flower/flower-networkpolicy.yaml 
b/chart/templates/flower/flower-networkpolicy.yaml
index 127a0e77a74..118480aaee7 100644
--- a/chart/templates/flower/flower-networkpolicy.yaml
+++ b/chart/templates/flower/flower-networkpolicy.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Flower NetworkPolicy
 #################################
-{{- if .Values.flower.enabled }}
-{{- if and .Values.networkPolicies.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
+{{- if and .Values.flower.enabled .Values.networkPolicies.enabled (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
 {{- $from := or .Values.flower.networkPolicy.ingress.from 
.Values.flower.extraNetworkPolicies }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
@@ -33,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.flower.labels) }}
+    {{- if or .Values.labels .Values.flower.labels }}
       {{- mustMerge .Values.flower.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
 spec:
@@ -56,4 +55,3 @@ spec:
       {{- end }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/flower/flower-service.yaml 
b/chart/templates/flower/flower-service.yaml
index 1a023d5575a..9539677c0d8 100644
--- a/chart/templates/flower/flower-service.yaml
+++ b/chart/templates/flower/flower-service.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Flower Service Component
 #################################
-{{- if .Values.flower.enabled }}
-{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
+{{- if and .Values.flower.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: Service
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.flower.labels) }}
+    {{- if or .Values.labels .Values.flower.labels }}
       {{- mustMerge .Values.flower.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
   {{- with .Values.flower.service.annotations }}
@@ -58,4 +57,3 @@ spec:
   loadBalancerSourceRanges: {{- toYaml 
.Values.flower.service.loadBalancerSourceRanges | nindent 4 }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/flower/flower-serviceaccount.yaml 
b/chart/templates/flower/flower-serviceaccount.yaml
index 7eae8d52bed..87aacdb803c 100644
--- a/chart/templates/flower/flower-serviceaccount.yaml
+++ b/chart/templates/flower/flower-serviceaccount.yaml
@@ -20,7 +20,7 @@
 ######################################
 ## Airflow Flower ServiceAccount
 ######################################
-{{- if and .Values.flower.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) 
.Values.flower.serviceAccount.create }}
+{{- if and .Values.flower.enabled .Values.flower.serviceAccount.create (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.flower.serviceAccount.automountServiceAccountToken }}
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.flower.labels) }}
+    {{- if or .Values.labels .Values.flower.labels }}
       {{- mustMerge .Values.flower.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
   {{- with .Values.flower.serviceAccount.annotations }}
diff --git a/chart/templates/jobs/create-user-job-serviceaccount.yaml 
b/chart/templates/jobs/create-user-job-serviceaccount.yaml
index 0af6a9e96b5..be619b0fcac 100644
--- a/chart/templates/jobs/create-user-job-serviceaccount.yaml
+++ b/chart/templates/jobs/create-user-job-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.createUserJob.labels) }}
+    {{- if or .Values.labels .Values.createUserJob.labels }}
       {{- mustMerge .Values.createUserJob.labels .Values.labels | toYaml | 
nindent 4 }}
     {{- end }}
   {{- with .Values.createUserJob.serviceAccount.annotations }}
diff --git a/chart/templates/jobs/create-user-job.yaml 
b/chart/templates/jobs/create-user-job.yaml
index 1d89502ae71..1f4151fd023 100644
--- a/chart/templates/jobs/create-user-job.yaml
+++ b/chart/templates/jobs/create-user-job.yaml
@@ -60,7 +60,7 @@ spec:
         tier: airflow
         component: create-user-job
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.createUserJob.labels) }}
+        {{- if or .Values.labels .Values.createUserJob.labels }}
           {{- mustMerge .Values.createUserJob.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       {{- if or .Values.airflowPodAnnotations 
.Values.createUserJob.annotations }}
diff --git a/chart/templates/jobs/migrate-database-job-serviceaccount.yaml 
b/chart/templates/jobs/migrate-database-job-serviceaccount.yaml
index edd74523cd2..e5ee856f6cb 100644
--- a/chart/templates/jobs/migrate-database-job-serviceaccount.yaml
+++ b/chart/templates/jobs/migrate-database-job-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.migrateDatabaseJob.labels) }}
+    {{- if or .Values.labels .Values.migrateDatabaseJob.labels }}
       {{- mustMerge .Values.migrateDatabaseJob.labels .Values.labels | toYaml 
| nindent 4 }}
     {{- end }}
   {{- with .Values.migrateDatabaseJob.serviceAccount.annotations }}
diff --git a/chart/templates/jobs/migrate-database-job.yaml 
b/chart/templates/jobs/migrate-database-job.yaml
index fe28f6bb0cb..362d5f406b0 100644
--- a/chart/templates/jobs/migrate-database-job.yaml
+++ b/chart/templates/jobs/migrate-database-job.yaml
@@ -60,7 +60,7 @@ spec:
         tier: airflow
         component: run-airflow-migrations
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.migrateDatabaseJob.labels) }}
+        {{- if or .Values.labels .Values.migrateDatabaseJob.labels }}
           {{- mustMerge .Values.migrateDatabaseJob.labels .Values.labels | 
toYaml | nindent 8 }}
         {{- end }}
       {{- if or .Values.airflowPodAnnotations 
.Values.migrateDatabaseJob.annotations }}
diff --git a/chart/templates/logs-persistent-volume-claim.yaml 
b/chart/templates/logs-persistent-volume-claim.yaml
index aa5b11dadad..00028a34db8 100644
--- a/chart/templates/logs-persistent-volume-claim.yaml
+++ b/chart/templates/logs-persistent-volume-claim.yaml
@@ -20,7 +20,7 @@
 ######################################
 ## Airflow LOGs PersistentVolumeClaim
 ######################################
-{{- if and (not .Values.logs.persistence.existingClaim ) 
.Values.logs.persistence.enabled }}
+{{- if and (not .Values.logs.persistence.existingClaim) 
.Values.logs.persistence.enabled }}
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml 
b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
index 0ecbc1e208f..9d6550afbee 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -67,7 +67,7 @@ spec:
         tier: airflow
         component: pgbouncer
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+        {{- if or .Values.labels .Values.pgbouncer.labels }}
           {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
@@ -165,7 +165,7 @@ spec:
               valueFrom:
                 secretKeyRef:
                   name: {{ template "pgbouncer_stats_secret" . }}
-                  {{- if (and 
.Values.pgbouncer.metricsExporterSidecar.statsSecretName 
.Values.pgbouncer.metricsExporterSidecar.statsSecretKey) }}
+                  {{- if and 
.Values.pgbouncer.metricsExporterSidecar.statsSecretName 
.Values.pgbouncer.metricsExporterSidecar.statsSecretKey }}
                   key: {{ 
.Values.pgbouncer.metricsExporterSidecar.statsSecretKey }}
                   {{- else }}
                   key: "connection"
diff --git a/chart/templates/pgbouncer/pgbouncer-ingress.yaml 
b/chart/templates/pgbouncer/pgbouncer-ingress.yaml
index e1e5a8d6393..0ad1f88c3d4 100644
--- a/chart/templates/pgbouncer/pgbouncer-ingress.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-ingress.yaml
@@ -21,7 +21,7 @@
 ## Airflow Pgbouncer Ingress
 #################################
 {{- if and .Values.pgbouncer.enabled .Values.ingress.pgbouncer.enabled }}
-{{- $fullname := (include "airflow.fullname" .) }}
+{{- $fullname := include "airflow.fullname" . }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+    {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.ingress.pgbouncer.annotations }}
@@ -42,17 +42,14 @@ spec:
   {{- if and .Values.ingress.pgbouncer.hosts (.Values.ingress.pgbouncer.hosts 
| first | kindIs "string" | not) }}
   {{- $anyTlsHosts := false -}}
   {{- range .Values.ingress.pgbouncer.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
   {{- $anyTlsHosts = true -}}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- if $anyTlsHosts }}
   tls:
   {{- range .Values.ingress.pgbouncer.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
     - hosts:
         - {{ tpl .name $ | quote }}
       secretName: {{ .tls.secretName }}
@@ -60,7 +57,6 @@ spec:
   {{- end }}
   {{- end }}
   {{- end }}
-  {{- end }}
   rules:
     {{- range .Values.ingress.pgbouncer.hosts | default (list 
.Values.ingress.pgbouncer.host) }}
     - http:
diff --git a/chart/templates/pgbouncer/pgbouncer-networkpolicy.yaml 
b/chart/templates/pgbouncer/pgbouncer-networkpolicy.yaml
index 8fd2a616f36..0c6a4dcc659 100644
--- a/chart/templates/pgbouncer/pgbouncer-networkpolicy.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-networkpolicy.yaml
@@ -25,8 +25,7 @@
   {{- $kedaEnabled = or .Values.workers.celery.keda.enabled (and (not (has 
.Values.workers.celery.keda.enabled (list true false))) 
.Values.workers.keda.enabled) }}
 {{- end }}
 {{- $workersKedaEnabled := and $kedaEnabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
-{{- $triggererEnabled := .Values.triggerer.enabled }}
-{{- $triggererKedaEnabled := and $triggererEnabled 
.Values.triggerer.keda.enabled }}
+{{- $triggererKedaEnabled := and .Values.triggerer.enabled 
.Values.triggerer.keda.enabled }}
 {{- if and .Values.pgbouncer.enabled .Values.networkPolicies.enabled }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
@@ -38,7 +37,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+    {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -55,18 +54,18 @@ spec:
         matchLabels:
           tier: airflow
           release: {{ .Release.Name }}
-    {{- if or $workersKedaEnabled  $triggererKedaEnabled }}
-    {{- if and $workersKedaEnabled 
(.Values.workers.celery.keda.namespaceLabels | default 
.Values.workers.keda.namespaceLabels) }}
+    {{- if or $workersKedaEnabled $triggererKedaEnabled }}
+      {{- if and $workersKedaEnabled 
(.Values.workers.celery.keda.namespaceLabels | default 
.Values.workers.keda.namespaceLabels) }}
     - namespaceSelector:
        matchLabels: {{- toYaml (.Values.workers.celery.keda.namespaceLabels | 
default .Values.workers.keda.namespaceLabels) | nindent 10 }}
       podSelector:
-    {{- else if and $triggererEnabled .Values.triggerer.keda.namespaceLabels }}
+      {{- else if and .Values.triggerer.enabled 
.Values.triggerer.keda.namespaceLabels }}
     - namespaceSelector:
         matchLabels: {{- toYaml .Values.triggerer.keda.namespaceLabels | 
nindent 10 }}
       podSelector:
-    {{- else }}
+      {{- else }}
     - podSelector:
-    {{- end }}
+      {{- end }}
         matchLabels:
           app: keda-operator
     {{- end }}
diff --git a/chart/templates/pgbouncer/pgbouncer-poddisruptionbudget.yaml 
b/chart/templates/pgbouncer/pgbouncer-poddisruptionbudget.yaml
index 4bd6b9848b6..25640aec75a 100644
--- a/chart/templates/pgbouncer/pgbouncer-poddisruptionbudget.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-poddisruptionbudget.yaml
@@ -31,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+    {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
diff --git a/chart/templates/pgbouncer/pgbouncer-service.yaml 
b/chart/templates/pgbouncer/pgbouncer-service.yaml
index 3ed4e111682..1290abe14a4 100644
--- a/chart/templates/pgbouncer/pgbouncer-service.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-service.yaml
@@ -31,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+    {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   annotations:
diff --git a/chart/templates/pgbouncer/pgbouncer-serviceaccount.yaml 
b/chart/templates/pgbouncer/pgbouncer-serviceaccount.yaml
index 63546d86973..c9f757eb103 100644
--- a/chart/templates/pgbouncer/pgbouncer-serviceaccount.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.pgbouncer.labels) }}
+    {{- if or .Values.labels .Values.pgbouncer.labels }}
       {{- mustMerge .Values.pgbouncer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.pgbouncer.serviceAccount.annotations }}
diff --git a/chart/templates/rbac/job-launcher-rolebinding.yaml 
b/chart/templates/rbac/job-launcher-rolebinding.yaml
index d0ceb2ff080..6b80e319646 100644
--- a/chart/templates/rbac/job-launcher-rolebinding.yaml
+++ b/chart/templates/rbac/job-launcher-rolebinding.yaml
@@ -58,22 +58,20 @@ roleRef:
   name: {{ include "airflow.fullname" . }}-job-launcher-role
   {{- end }}
 subjects:
-  {{- $schedulerAdded := false }}
   {{- range $executor := $executors }}
-  {{- if and (has $executor $schedulerLaunchExecutors) (not $schedulerAdded) }}
-  {{- $schedulerAdded = true }}
+  {{- if has $executor $schedulerLaunchExecutors }}
   - kind: ServiceAccount
     name: {{ include "scheduler.serviceAccountName" $ }}
     namespace: "{{ $.Release.Namespace }}"
+  {{- break }}
   {{- end }}
   {{- end }}
-  {{- $workerAdded := false }}
   {{- range $executor := $executors }}
-  {{- if and (has $executor $workerLaunchExecutors) (not $workerAdded) }}
-  {{- $workerAdded = true }}
+  {{- if has $executor $workerLaunchExecutors }}
   - kind: ServiceAccount
     name: {{ include "worker.serviceAccountName" $ }}
     namespace: "{{ $.Release.Namespace }}"
+  {{- break }}
   {{- end }}
   {{- end }}
 {{- end }}
diff --git a/chart/templates/rbac/pod-launcher-rolebinding.yaml 
b/chart/templates/rbac/pod-launcher-rolebinding.yaml
index 781e4fc082a..d4eb37af051 100644
--- a/chart/templates/rbac/pod-launcher-rolebinding.yaml
+++ b/chart/templates/rbac/pod-launcher-rolebinding.yaml
@@ -58,22 +58,20 @@ roleRef:
   name: {{ include "airflow.fullname" . }}-pod-launcher-role
   {{- end }}
 subjects:
-  {{- $schedulerAdded := false }}
   {{- range $executor := $executors }}
-  {{- if and (has $executor $schedulerLaunchExecutors) (not $schedulerAdded) }}
-  {{- $schedulerAdded = true }}
+  {{- if has $executor $schedulerLaunchExecutors }}
   - kind: ServiceAccount
     name: {{ include "scheduler.serviceAccountName" $ }}
     namespace: "{{ $.Release.Namespace }}"
+  {{- break }}
   {{- end }}
   {{- end }}
-  {{- $workerAdded := false }}
   {{- range $executor := $executors }}
-  {{- if and (has $executor $workerLaunchExecutors) (not $workerAdded) }}
-  {{- $workerAdded = true }}
+  {{- if has $executor $workerLaunchExecutors }}
   - kind: ServiceAccount
     name: {{ include "worker.serviceAccountName" $ }}
     namespace: "{{ $.Release.Namespace }}"
+  {{- break }}
   {{- end }}
   {{- end }}
   {{- if .Values.triggerer.enabled }}
diff --git a/chart/templates/redis/redis-service.yaml 
b/chart/templates/redis/redis-service.yaml
index 3ade825f28d..36c9daf5c40 100644
--- a/chart/templates/redis/redis-service.yaml
+++ b/chart/templates/redis/redis-service.yaml
@@ -52,7 +52,7 @@ spec:
       protocol: TCP
       port: {{ .Values.ports.redisDB }}
       targetPort: {{ .Values.ports.redisDB }}
-      {{- if (and (eq .Values.redis.service.type "NodePort") (not (empty 
.Values.redis.service.nodePort))) }}
+      {{- if and (eq .Values.redis.service.type "NodePort") (not (empty 
.Values.redis.service.nodePort)) }}
       nodePort: {{ .Values.redis.service.nodePort }}
       {{- end }}
 {{- end }}
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml 
b/chart/templates/scheduler/scheduler-deployment.yaml
index ec563b880da..4371b09beb2 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -21,12 +21,10 @@
 ## Airflow Scheduler Deployment/StatefulSet
 #################################
 {{- if .Values.scheduler.enabled }}
-# Are we using a local executor?
 {{- $local := contains "Local" .Values.executor }}
 # Is persistence enabled on the _workers_?
 # This is important because in $local mode, the scheduler assumes the role of 
the worker
 {{- $persistence := or .Values.workers.celery.persistence.enabled (and (not 
(has .Values.workers.celery.persistence.enabled (list true false))) 
.Values.workers.persistence.enabled) }}
-# If we're using a StatefulSet
 {{- $stateful := and $local $persistence }}
 # We can skip DAGs mounts on scheduler if dagProcessor is enabled, except with 
$local mode
 {{- $dagProcessorEnabled := .Values.dagProcessor.enabled }}
@@ -34,7 +32,6 @@
   {{ $dagProcessorEnabled = ternary true false (semverCompare ">=3.0.0" 
.Values.airflowVersion) }}
 {{- end }}
 {{- $localOrDagProcessorDisabled := or (not $dagProcessorEnabled) $local }}
-# If we're using elasticsearch or opensearch logging
 {{- $remoteLogging := or .Values.elasticsearch.enabled 
.Values.opensearch.enabled }}
 {{- $nodeSelector := or .Values.scheduler.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.scheduler.affinity .Values.affinity }}
@@ -92,7 +89,7 @@ spec:
         tier: airflow
         component: scheduler
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.scheduler.labels) }}
+        {{- if or .Values.labels .Values.scheduler.labels }}
           {{- mustMerge .Values.scheduler.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
@@ -187,7 +184,6 @@ spec:
           {{- tpl (toYaml .Values.scheduler.extraInitContainers) . | nindent 8 
}}
         {{- end }}
       containers:
-        # Always run the main scheduler container.
         - name: scheduler
           image: {{ template "airflow_image" . }}
           imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
@@ -284,6 +280,8 @@ spec:
           args: {{- tpl (toYaml .Values.scheduler.logGroomerSidecar.args) . | 
nindent 12 }}
           {{- end }}
           env:
+            - name: AIRFLOW_HOME
+              value: "{{ .Values.airflowHome }}"
           {{- if .Values.scheduler.logGroomerSidecar.retentionDays }}
             - name: AIRFLOW__LOG_RETENTION_DAYS
               value: "{{ .Values.scheduler.logGroomerSidecar.retentionDays }}"
@@ -304,8 +302,6 @@ spec:
             - name: AIRFLOW__LOG_MAX_SIZE_PERCENT
               value: "{{ .Values.scheduler.logGroomerSidecar.maxSizePercent }}"
           {{- end }}
-            - name: AIRFLOW_HOME
-              value: "{{ .Values.airflowHome }}"
           {{- if .Values.scheduler.logGroomerSidecar.env }}
               {{- tpl (toYaml .Values.scheduler.logGroomerSidecar.env) $ | 
nindent 12 }}
           {{- end }}
diff --git a/chart/templates/scheduler/scheduler-networkpolicy.yaml 
b/chart/templates/scheduler/scheduler-networkpolicy.yaml
index 4327e8f89b5..37d0b3ed532 100644
--- a/chart/templates/scheduler/scheduler-networkpolicy.yaml
+++ b/chart/templates/scheduler/scheduler-networkpolicy.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Scheduler NetworkPolicy
 #################################
-{{- if .Values.scheduler.enabled }}
-{{- if .Values.networkPolicies.enabled }}
+{{- if and .Values.scheduler.enabled .Values.networkPolicies.enabled }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.scheduler.labels) }}
+    {{- if or .Values.labels .Values.scheduler.labels }}
       {{- mustMerge .Values.scheduler.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -56,4 +55,3 @@ spec:
       port: {{ .Values.ports.workerLogs }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/scheduler/scheduler-poddisruptionbudget.yaml 
b/chart/templates/scheduler/scheduler-poddisruptionbudget.yaml
index 4548d40a62a..087d0a9b861 100644
--- a/chart/templates/scheduler/scheduler-poddisruptionbudget.yaml
+++ b/chart/templates/scheduler/scheduler-poddisruptionbudget.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Scheduler PodDisruptionBudget
 #################################
-{{- if .Values.scheduler.enabled }}
-{{- if .Values.scheduler.podDisruptionBudget.enabled }}
+{{- if and .Values.scheduler.enabled 
.Values.scheduler.podDisruptionBudget.enabled }}
 apiVersion: policy/v1
 kind: PodDisruptionBudget
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.scheduler.labels) }}
+    {{- if or .Values.labels .Values.scheduler.labels }}
       {{- mustMerge .Values.scheduler.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -43,4 +42,3 @@ spec:
       release: {{ .Release.Name }}
   {{- toYaml .Values.scheduler.podDisruptionBudget.config | nindent 2 }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/scheduler/scheduler-service.yaml 
b/chart/templates/scheduler/scheduler-service.yaml
index 1ac300648cd..993d10e46af 100644
--- a/chart/templates/scheduler/scheduler-service.yaml
+++ b/chart/templates/scheduler/scheduler-service.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Scheduler Service
 #################################
-{{- if .Values.scheduler.enabled }}
-{{- if or (contains "LocalExecutor" .Values.executor) (contains 
"LocalKubernetesExecutor" .Values.executor) }}
+{{- if and .Values.scheduler.enabled (or (contains "LocalExecutor" 
.Values.executor) (contains "LocalKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: Service
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.scheduler.labels) }}
+    {{- if or .Values.labels .Values.scheduler.labels }}
       {{- mustMerge .Values.scheduler.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -47,4 +46,3 @@ spec:
       port: {{ .Values.ports.workerLogs }}
       targetPort: {{ .Values.ports.workerLogs }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/scheduler/scheduler-serviceaccount.yaml 
b/chart/templates/scheduler/scheduler-serviceaccount.yaml
index 0a204f105f3..b87a5149d4f 100644
--- a/chart/templates/scheduler/scheduler-serviceaccount.yaml
+++ b/chart/templates/scheduler/scheduler-serviceaccount.yaml
@@ -34,7 +34,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.scheduler.labels) }}
+    {{- if or .Values.labels .Values.scheduler.labels }}
       {{- mustMerge .Values.scheduler.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.scheduler.serviceAccount.annotations }}
diff --git a/chart/templates/secrets/elasticsearch-secret.yaml 
b/chart/templates/secrets/elasticsearch-secret.yaml
index fc075c6960d..97d00277efd 100644
--- a/chart/templates/secrets/elasticsearch-secret.yaml
+++ b/chart/templates/secrets/elasticsearch-secret.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Elasticsearch Secret
 #################################
-{{- if (and .Values.elasticsearch.enabled (not 
.Values.elasticsearch.secretName)) }}
+{{- if and .Values.elasticsearch.enabled (not 
.Values.elasticsearch.secretName) }}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/git-ssh-key-secret.yaml 
b/chart/templates/secrets/git-ssh-key-secret.yaml
index db626fa9f7d..d912f6b83b1 100644
--- a/chart/templates/secrets/git-ssh-key-secret.yaml
+++ b/chart/templates/secrets/git-ssh-key-secret.yaml
@@ -17,7 +17,7 @@
  under the License.
 */}}
 
-{{- if and .Values.dags.gitSync.sshKey .Values.dags.gitSync.enabled}}
+{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.sshKey }}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/jwt-secret.yaml 
b/chart/templates/secrets/jwt-secret.yaml
index 0eebbedd709..04f04a3a70a 100644
--- a/chart/templates/secrets/jwt-secret.yaml
+++ b/chart/templates/secrets/jwt-secret.yaml
@@ -20,8 +20,7 @@
 ############################################
 ## Airflow JWT Secret
 ############################################
-{{- if semverCompare ">=3.0.0" .Values.airflowVersion }}
-{{- if and .Values.apiServer.enabled (not .Values.jwtSecretName) }}
+{{- if and (semverCompare ">=3.0.0" .Values.airflowVersion) 
.Values.apiServer.enabled (not .Values.jwtSecretName) }}
 apiVersion: v1
 kind: Secret
 metadata:
@@ -41,6 +40,5 @@ metadata:
   {{- end }}
 type: Opaque
 data:
-  jwt-secret: {{ (.Values.jwtSecret) | default (randAlphaNum 32) | b64enc | 
quote }}
-{{- end }}
+  jwt-secret: {{ .Values.jwtSecret | default (randAlphaNum 32) | b64enc | 
quote }}
 {{- end }}
diff --git a/chart/templates/secrets/metadata-connection-secret.yaml 
b/chart/templates/secrets/metadata-connection-secret.yaml
index 04e3fe7bc40..d64637d805e 100644
--- a/chart/templates/secrets/metadata-connection-secret.yaml
+++ b/chart/templates/secrets/metadata-connection-secret.yaml
@@ -26,9 +26,9 @@
 {{- $pgbouncerHost := (printf "%s-%s.%s" ( include "airflow.fullname" . ) 
"pgbouncer" .Release.Namespace) }}
 {{- $host := ternary $pgbouncerHost $metadataHost .Values.pgbouncer.enabled }}
 {{- $metadataPort := .Values.data.metadataConnection.port | toString }}
-{{- $port := ((ternary .Values.ports.pgbouncer $metadataPort 
.Values.pgbouncer.enabled) | toString) }}
+{{- $port := (ternary .Values.ports.pgbouncer $metadataPort 
.Values.pgbouncer.enabled) | toString }}
 {{- $metadataDatabase := .Values.data.metadataConnection.db }}
-{{- $database := (ternary (printf "%s-%s" .Release.Name "metadata") 
$metadataDatabase .Values.pgbouncer.enabled) }}
+{{- $database := ternary (printf "%s-%s" .Release.Name "metadata") 
$metadataDatabase .Values.pgbouncer.enabled }}
 {{- $query := ternary (printf "sslmode=%s" 
.Values.data.metadataConnection.sslmode) "" (eq 
.Values.data.metadataConnection.protocol "postgresql") }}
 {{- $kedaEnabled := .Values.workers.keda.enabled }}
 {{- $kedaUsePgBouncer := .Values.workers.keda.usePgbouncer }}
diff --git a/chart/templates/secrets/opensearch-secret.yaml 
b/chart/templates/secrets/opensearch-secret.yaml
index 4cd1ebafd02..b90b4c2af4c 100644
--- a/chart/templates/secrets/opensearch-secret.yaml
+++ b/chart/templates/secrets/opensearch-secret.yaml
@@ -20,7 +20,7 @@
 ################################
 ## OpenSearch Secret
 #################################
-{{- if (and .Values.opensearch.enabled (not .Values.opensearch.secretName)) }}
+{{- if and .Values.opensearch.enabled (not .Values.opensearch.secretName) }}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/pgbouncer-config-secret.yaml 
b/chart/templates/secrets/pgbouncer-config-secret.yaml
index 06c485b1511..4e18b91c383 100644
--- a/chart/templates/secrets/pgbouncer-config-secret.yaml
+++ b/chart/templates/secrets/pgbouncer-config-secret.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Pgbouncer Config Secret
 #################################
-{{- if (and .Values.pgbouncer.enabled (not 
.Values.pgbouncer.configSecretName)) }}
+{{- if and .Values.pgbouncer.enabled (not .Values.pgbouncer.configSecretName) 
}}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/pgbouncer-stats-secret.yaml 
b/chart/templates/secrets/pgbouncer-stats-secret.yaml
index 54d3e9fd3d4..a6897fd58de 100644
--- a/chart/templates/secrets/pgbouncer-stats-secret.yaml
+++ b/chart/templates/secrets/pgbouncer-stats-secret.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Pgbouncer Stats Secret
 #################################
-{{- if (and .Values.pgbouncer.enabled (not 
.Values.pgbouncer.metricsExporterSidecar.statsSecretName)) }}
+{{- if and .Values.pgbouncer.enabled (not 
.Values.pgbouncer.metricsExporterSidecar.statsSecretName) }}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/registry-secret.yaml 
b/chart/templates/secrets/registry-secret.yaml
index 4acbe1bf881..334e8b98812 100644
--- a/chart/templates/secrets/registry-secret.yaml
+++ b/chart/templates/secrets/registry-secret.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Registry Secret
 #################################
-{{- if (and (or .Values.registry.connection) (not (or 
.Values.registry.secretName .Values.imagePullSecrets))) }}
+{{- if and .Values.registry.connection (not (or .Values.registry.secretName 
.Values.imagePullSecrets)) }}
 apiVersion: v1
 kind: Secret
 metadata:
diff --git a/chart/templates/secrets/result-backend-connection-secret.yaml 
b/chart/templates/secrets/result-backend-connection-secret.yaml
index e2489030642..e05f3fbc38a 100644
--- a/chart/templates/secrets/result-backend-connection-secret.yaml
+++ b/chart/templates/secrets/result-backend-connection-secret.yaml
@@ -20,9 +20,7 @@
 ################################
 ## Airflow Result Backend Secret
 #################################
-{{- if not .Values.data.resultBackendSecretName }}
-{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
-{{- if .Values.data.resultBackendConnection }}
+{{- if and .Values.data.resultBackendConnection (not 
.Values.data.resultBackendSecretName) (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 {{- $connection := .Values.data.resultBackendConnection | default 
.Values.data.metadataConnection }}
 {{- $resultBackendHost := $connection.host | default (printf "%s-%s" 
.Release.Name "postgresql") }}
 {{- $pgbouncerHost := printf "%s-%s" .Release.Name "pgbouncer" }}
@@ -50,5 +48,3 @@ type: Opaque
 data:
   connection: {{ urlJoin (dict "scheme" (printf "db+%s" $connection.protocol) 
"userinfo" (printf "%s:%s" ($connection.user|urlquery) ($connection.pass | 
urlquery)) "host" (printf "%s:%s" $host $port) "path" (printf "/%s" $database) 
"query" $query) | b64enc | quote }}
 {{- end }}
-{{- end }}
-{{- end }}
diff --git a/chart/templates/statsd/statsd-ingress.yaml 
b/chart/templates/statsd/statsd-ingress.yaml
index 8544bd19d7d..14386d6f3d5 100644
--- a/chart/templates/statsd/statsd-ingress.yaml
+++ b/chart/templates/statsd/statsd-ingress.yaml
@@ -21,7 +21,7 @@
 ## Airflow Statsd Ingress
 #################################
 {{- if and .Values.statsd.enabled .Values.ingress.statsd.enabled }}
-{{- $fullname := (include "airflow.fullname" .) }}
+{{- $fullname := include "airflow.fullname" . }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
@@ -42,17 +42,15 @@ spec:
   {{- if and .Values.ingress.statsd.hosts (.Values.ingress.statsd.hosts | 
first | kindIs "string" | not) }}
   {{- $anyTlsHosts := false -}}
   {{- range .Values.ingress.statsd.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
   {{- $anyTlsHosts = true -}}
-  {{- end }}
+  {{- break }}
   {{- end }}
   {{- end }}
   {{- if $anyTlsHosts }}
   tls:
   {{- range .Values.ingress.statsd.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
     - hosts:
         - {{ tpl .name $ | quote }}
       secretName: {{ .tls.secretName }}
@@ -60,7 +58,6 @@ spec:
   {{- end }}
   {{- end }}
   {{- end }}
-  {{- end }}
   rules:
     {{- range .Values.ingress.statsd.hosts | default (list 
.Values.ingress.statsd.host) }}
     - http:
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml 
b/chart/templates/triggerer/triggerer-deployment.yaml
index d43ab05ec53..fa7a90c033f 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -68,7 +68,7 @@ spec:
   {{- if and $persistence .Values.triggerer.updateStrategy }}
   updateStrategy: {{- toYaml .Values.triggerer.updateStrategy | nindent 4 }}
   {{- end }}
-  {{- if and (not $persistence) (.Values.triggerer.strategy) }}
+  {{- if and (not $persistence) .Values.triggerer.strategy }}
   strategy: {{- toYaml .Values.triggerer.strategy | nindent 4 }}
   {{- end }}
   {{- if and $persistence 
.Values.triggerer.persistence.persistentVolumeClaimRetentionPolicy }}
@@ -80,7 +80,7 @@ spec:
         tier: airflow
         component: triggerer
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.triggerer.labels) }}
+        {{- if or .Values.labels .Values.triggerer.labels }}
           {{- mustMerge .Values.triggerer.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
@@ -162,7 +162,7 @@ spec:
               {{- tpl (toYaml .Values.triggerer.waitForMigrations.env) $ | 
nindent 12 }}
             {{- end }}
         {{- end }}
-        {{- if and (.Values.dags.gitSync.enabled) (not 
.Values.dags.persistence.enabled) }}
+        {{- if and .Values.dags.gitSync.enabled (not 
.Values.dags.persistence.enabled) }}
           {{- include "git_sync_container" (dict "Values" .Values "is_init" 
"true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.triggerer.extraInitContainers }}
@@ -222,7 +222,7 @@ spec:
           ports:
             - name: triggerer-logs
               containerPort: {{ .Values.ports.triggererLogs }}
-        {{- if and (.Values.dags.gitSync.enabled) (not 
.Values.dags.persistence.enabled) }}
+        {{- if and .Values.dags.gitSync.enabled (not 
.Values.dags.persistence.enabled) }}
           {{- include "git_sync_container" . | nindent 8 }}
         {{- end }}
         {{- if .Values.triggerer.logGroomerSidecar.enabled }}
diff --git a/chart/templates/triggerer/triggerer-kedaautoscaler.yaml 
b/chart/templates/triggerer/triggerer-kedaautoscaler.yaml
index fa54aa37367..bf040e66675 100644
--- a/chart/templates/triggerer/triggerer-kedaautoscaler.yaml
+++ b/chart/templates/triggerer/triggerer-kedaautoscaler.yaml
@@ -32,7 +32,7 @@ metadata:
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
     deploymentName: {{ .Release.Name }}-triggerer
-    {{- if or (.Values.labels) (.Values.triggerer.labels) }}
+    {{- if or .Values.labels .Values.triggerer.labels }}
       {{- mustMerge .Values.triggerer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
diff --git a/chart/templates/triggerer/triggerer-networkpolicy.yaml 
b/chart/templates/triggerer/triggerer-networkpolicy.yaml
index 7a0da192404..a5a729cbd96 100644
--- a/chart/templates/triggerer/triggerer-networkpolicy.yaml
+++ b/chart/templates/triggerer/triggerer-networkpolicy.yaml
@@ -20,8 +20,7 @@
 ##################################
 ## Airflow triggerer NetworkPolicy
 ##################################
-{{- if .Values.networkPolicies.enabled }}
-{{- if .Values.triggerer.enabled }}
+{{- if and .Values.triggerer.enabled .Values.networkPolicies.enabled }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.triggerer.labels) }}
+    {{- if or .Values.labels .Values.triggerer.labels }}
       {{- mustMerge .Values.triggerer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -54,4 +53,3 @@ spec:
     - protocol: TCP
       port: {{ .Values.ports.triggererLogs }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/triggerer/triggerer-service.yaml 
b/chart/templates/triggerer/triggerer-service.yaml
index db38087c254..f29af89dca7 100644
--- a/chart/templates/triggerer/triggerer-service.yaml
+++ b/chart/templates/triggerer/triggerer-service.yaml
@@ -31,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.triggerer.labels) }}
+    {{- if or .Values.labels .Values.triggerer.labels }}
       {{- mustMerge .Values.triggerer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
diff --git a/chart/templates/triggerer/triggerer-serviceaccount.yaml 
b/chart/templates/triggerer/triggerer-serviceaccount.yaml
index e0adf606c45..27fd76d0802 100644
--- a/chart/templates/triggerer/triggerer-serviceaccount.yaml
+++ b/chart/templates/triggerer/triggerer-serviceaccount.yaml
@@ -32,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.triggerer.labels) }}
+    {{- if or .Values.labels .Values.triggerer.labels }}
       {{- mustMerge .Values.triggerer.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.triggerer.serviceAccount.annotations}}
diff --git a/chart/templates/webserver/webserver-deployment.yaml 
b/chart/templates/webserver/webserver-deployment.yaml
index 7b958f581ac..eca8c26a948 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -80,7 +80,7 @@ spec:
         tier: airflow
         component: webserver
         release: {{ .Release.Name }}
-        {{- if or (.Values.labels) (.Values.webserver.labels) }}
+        {{- if or .Values.labels .Values.webserver.labels }}
           {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
diff --git a/chart/templates/webserver/webserver-hpa.yaml 
b/chart/templates/webserver/webserver-hpa.yaml
index 2c4ba1ba0f7..eded09a3192 100644
--- a/chart/templates/webserver/webserver-hpa.yaml
+++ b/chart/templates/webserver/webserver-hpa.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Webserver HPA
 #################################
-{{- if semverCompare "<3.0.0" .Values.airflowVersion }}
-{{- if and .Values.webserver.enabled .Values.webserver.hpa.enabled }}
+{{- if and .Values.webserver.enabled .Values.webserver.hpa.enabled 
(semverCompare "<3.0.0" .Values.airflowVersion) }}
 apiVersion: autoscaling/v2
 kind: HorizontalPodAutoscaler
 metadata:
@@ -33,7 +32,7 @@ metadata:
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
     deploymentName: {{ .Release.Name }}-webserver
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -48,4 +47,3 @@ spec:
   behavior: {{- toYaml . | nindent 4 }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/webserver/webserver-ingress.yaml 
b/chart/templates/webserver/webserver-ingress.yaml
index 6e0e2f6d3e9..1b9f8d41b4a 100644
--- a/chart/templates/webserver/webserver-ingress.yaml
+++ b/chart/templates/webserver/webserver-ingress.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Webserver Ingress
 #################################
-{{- if and .Values.webserver.enabled (semverCompare "<3.0.0" 
.Values.airflowVersion) }}
-{{- if or .Values.ingress.web.enabled .Values.ingress.enabled }}
+{{- if and .Values.webserver.enabled (or .Values.ingress.web.enabled 
.Values.ingress.enabled) (semverCompare "<3.0.0" .Values.airflowVersion) }}
 {{- $fullname := (include "airflow.fullname" .) }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
@@ -33,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.ingress.web.annotations }}
@@ -43,24 +42,20 @@ spec:
   {{- if and .Values.ingress.web.hosts (.Values.ingress.web.hosts | first | 
kindIs "string" | not) }}
   {{- $anyTlsHosts := false -}}
   {{- range .Values.ingress.web.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
   {{- $anyTlsHosts = true -}}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- if $anyTlsHosts }}
   tls:
   {{- range .Values.ingress.web.hosts }}
-  {{- if .tls }}
-  {{- if .tls.enabled }}
+  {{- if and .tls .tls.enabled }}
     - hosts:
         - {{ tpl .name $ | quote }}
       secretName: {{ .tls.secretName }}
   {{- end }}
   {{- end }}
   {{- end }}
-  {{- end }}
   {{- else if .Values.ingress.web.tls.enabled }}
   tls:
     - hosts:
@@ -112,4 +107,3 @@ spec:
   ingressClassName: {{ .Values.ingress.web.ingressClassName }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/webserver/webserver-networkpolicy.yaml 
b/chart/templates/webserver/webserver-networkpolicy.yaml
index 037132fc166..e2f02be2c69 100644
--- a/chart/templates/webserver/webserver-networkpolicy.yaml
+++ b/chart/templates/webserver/webserver-networkpolicy.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Webserver NetworkPolicy
 #################################
-{{- if and .Values.webserver.enabled (semverCompare "<3.0.0" 
.Values.airflowVersion) }}
-{{- if .Values.networkPolicies.enabled }}
+{{- if and .Values.webserver.enabled (semverCompare "<3.0.0" 
.Values.airflowVersion) .Values.networkPolicies.enabled }}
 {{- $from := or .Values.webserver.networkPolicy.ingress.from 
.Values.webserver.extraNetworkPolicies }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
@@ -33,7 +32,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -56,4 +55,3 @@ spec:
       {{- end }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/webserver/webserver-poddisruptionbudget.yaml 
b/chart/templates/webserver/webserver-poddisruptionbudget.yaml
index fbf36d08638..822303dcd1f 100644
--- a/chart/templates/webserver/webserver-poddisruptionbudget.yaml
+++ b/chart/templates/webserver/webserver-poddisruptionbudget.yaml
@@ -20,8 +20,7 @@
 ################################
 ## Airflow Webserver PodDisruptionBudget
 #################################
-{{- if and .Values.webserver.enabled (semverCompare "<3.0.0" 
.Values.airflowVersion) }}
-{{- if .Values.webserver.podDisruptionBudget.enabled }}
+{{- if and .Values.webserver.enabled (semverCompare "<3.0.0" 
.Values.airflowVersion) .Values.webserver.podDisruptionBudget.enabled }}
 apiVersion: policy/v1
 kind: PodDisruptionBudget
 metadata:
@@ -32,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
 spec:
@@ -43,4 +42,3 @@ spec:
       release: {{ .Release.Name }}
   {{- toYaml .Values.webserver.podDisruptionBudget.config | nindent 2 }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/webserver/webserver-service.yaml 
b/chart/templates/webserver/webserver-service.yaml
index fab8d281fcb..6a67a03abf3 100644
--- a/chart/templates/webserver/webserver-service.yaml
+++ b/chart/templates/webserver/webserver-service.yaml
@@ -31,7 +31,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.webserver.service.annotations }}
diff --git a/chart/templates/webserver/webserver-serviceaccount.yaml 
b/chart/templates/webserver/webserver-serviceaccount.yaml
index 8bd392adfa1..e105dbde0a0 100644
--- a/chart/templates/webserver/webserver-serviceaccount.yaml
+++ b/chart/templates/webserver/webserver-serviceaccount.yaml
@@ -20,8 +20,7 @@
 ######################################
 ## Airflow Webserver ServiceAccount
 ######################################
-{{- if semverCompare "<3.0.0" .Values.airflowVersion }}
-{{- if and .Values.webserver.enabled .Values.webserver.serviceAccount.create }}
+{{- if and .Values.webserver.enabled .Values.webserver.serviceAccount.create 
(semverCompare "<3.0.0" .Values.airflowVersion) }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.webserver.serviceAccount.automountServiceAccountToken }}
@@ -33,11 +32,10 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.webserver.labels) }}
+    {{- if or .Values.labels .Values.webserver.labels }}
       {{- mustMerge .Values.webserver.labels .Values.labels | toYaml | nindent 
4 }}
     {{- end }}
   {{- with .Values.webserver.serviceAccount.annotations }}
   annotations: {{- toYaml . | nindent 4 }}
   {{- end }}
 {{- end }}
-{{- end }}
diff --git a/chart/templates/workers/worker-deployment.yaml 
b/chart/templates/workers/worker-deployment.yaml
index 3838e32e43e..0d221fd003a 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -111,7 +111,7 @@ spec:
         {{- if ne .Values.workers.name "default" }}
         worker-set: {{ .Values.workers.name }}
         {{- end }}
-        {{- if or (.Values.labels) (.Values.workers.labels) }}
+        {{- if or .Values.labels .Values.workers.labels }}
           {{- mustMerge .Values.workers.labels .Values.labels | toYaml | 
nindent 8 }}
         {{- end }}
       annotations:
@@ -256,7 +256,7 @@ spec:
               {{- tpl (toYaml .Values.workers.waitForMigrations.env) $ | 
nindent 12 }}
             {{- end }}
         {{- end }}
-        {{- if and (.Values.dags.gitSync.enabled) (not 
.Values.dags.persistence.enabled) }}
+        {{- if and .Values.dags.gitSync.enabled (not 
.Values.dags.persistence.enabled) }}
           {{- include "git_sync_container" (dict "Values" .Values "is_init" 
"true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.workers.extraInitContainers }}
@@ -345,7 +345,7 @@ spec:
             - name: KRB5CCNAME
               value:  {{ include "kerberos_ccache_path" . | quote }}
             {{- end }}
-        {{- if and (.Values.dags.gitSync.enabled) (not 
.Values.dags.persistence.enabled) }}
+        {{- if and .Values.dags.gitSync.enabled (not 
.Values.dags.persistence.enabled) }}
           {{- include "git_sync_container" . | nindent 8 }}
         {{- end }}
         {{- if and $persistence .Values.workers.logGroomerSidecar.enabled }}
diff --git a/chart/templates/workers/worker-hpa.yaml 
b/chart/templates/workers/worker-hpa.yaml
index 99dd5a29468..0e9f6819b70 100644
--- a/chart/templates/workers/worker-hpa.yaml
+++ b/chart/templates/workers/worker-hpa.yaml
@@ -45,7 +45,7 @@ metadata:
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
     deploymentName: {{ .Release.Name }}-worker{{ if ne .Values.workers.name 
"default" }}-{{ .Values.workers.name }}{{ end }}
-    {{- if or (.Values.labels) (.Values.workers.labels) }}
+    {{- if or .Values.labels .Values.workers.labels }}
       {{- mustMerge .Values.workers.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
 spec:
diff --git a/chart/templates/workers/worker-kedaautoscaler.yaml 
b/chart/templates/workers/worker-kedaautoscaler.yaml
index dac8991c4d7..5d746d669b1 100644
--- a/chart/templates/workers/worker-kedaautoscaler.yaml
+++ b/chart/templates/workers/worker-kedaautoscaler.yaml
@@ -45,7 +45,7 @@ metadata:
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
     deploymentName: {{ .Release.Name }}-worker{{ if ne .Values.workers.name 
"default" }}-{{ .Values.workers.name }}{{ end }}
-    {{- if or (.Values.labels) (.Values.workers.labels) }}
+    {{- if or .Values.labels .Values.workers.labels }}
       {{- mustMerge .Values.workers.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
 spec:
diff --git a/chart/templates/workers/worker-networkpolicy.yaml 
b/chart/templates/workers/worker-networkpolicy.yaml
index 814a183d524..2fcb6662237 100644
--- a/chart/templates/workers/worker-networkpolicy.yaml
+++ b/chart/templates/workers/worker-networkpolicy.yaml
@@ -44,7 +44,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.workers.labels) }}
+    {{- if or .Values.labels .Values.workers.labels }}
       {{- mustMerge .Values.workers.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
 spec:
diff --git a/chart/templates/workers/worker-service.yaml 
b/chart/templates/workers/worker-service.yaml
index 367ebcb496f..23a8a234c15 100644
--- a/chart/templates/workers/worker-service.yaml
+++ b/chart/templates/workers/worker-service.yaml
@@ -44,7 +44,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.workers.labels) }}
+    {{- if or .Values.labels .Values.workers.labels }}
       {{- mustMerge .Values.workers.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
 spec:
diff --git a/chart/templates/workers/worker-serviceaccount.yaml 
b/chart/templates/workers/worker-serviceaccount.yaml
index c1f4d6f816f..d8e377f56f4 100644
--- a/chart/templates/workers/worker-serviceaccount.yaml
+++ b/chart/templates/workers/worker-serviceaccount.yaml
@@ -45,7 +45,7 @@ metadata:
     release: {{ .Release.Name }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     heritage: {{ .Release.Service }}
-    {{- if or (.Values.labels) (.Values.workers.labels) }}
+    {{- if or .Values.labels .Values.workers.labels }}
       {{- mustMerge .Values.workers.labels .Values.labels | toYaml | nindent 4 
}}
     {{- end }}
   {{- with .Values.workers.serviceAccount.annotations}}
diff --git a/helm-tests/tests/chart_utils/log_groomer.py 
b/helm-tests/tests/chart_utils/log_groomer.py
index 5709c93796a..4d88c7da947 100644
--- a/helm-tests/tests/chart_utils/log_groomer.py
+++ b/helm-tests/tests/chart_utils/log_groomer.py
@@ -84,11 +84,9 @@ class LogGroomerTestBase:
             values=values, 
show_only=[f"templates/{self.folder}/{self.obj_name}-deployment.yaml"]
         )
 
-        assert (
-            jmespath.search("spec.template.spec.containers[1].env[0].name", 
docs[0])
-            == "AIRFLOW__LOG_RETENTION_DAYS"
+        assert {"name": "AIRFLOW__LOG_RETENTION_DAYS", "value": "15"} in 
jmespath.search(
+            "spec.template.spec.containers[1].env", docs[0]
         )
-        assert 
jmespath.search("spec.template.spec.containers[1].env[0].value", docs[0]) == 
"15"
 
     def test_log_groomer_collector_custom_env(self):
         env = [
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py 
b/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
index 5d715985da9..9234d8ea116 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
@@ -415,8 +415,8 @@ class TestAirflowCommon:
             ],
         )
         expected_vars = [
-            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW_HOME",
+            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW_CONN_AIRFLOW_DB",
             "AIRFLOW__CELERY__BROKER_URL",
         ]
@@ -442,8 +442,8 @@ class TestAirflowCommon:
         # JWT secret is only injected into scheduler (and api-server); not 
into workers,
         # webserver, triggerer, dag-processor (security: no JWT where not 
needed).
         expected_vars_with_jwt = [
-            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW_HOME",
+            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN",
             "AIRFLOW_CONN_AIRFLOW_DB",
             "AIRFLOW__API__SECRET_KEY",
@@ -451,8 +451,8 @@ class TestAirflowCommon:
             "AIRFLOW__CELERY__BROKER_URL",
         ]
         expected_vars_no_jwt = [
-            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW_HOME",
+            "AIRFLOW__CORE__FERNET_KEY",
             "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN",
             "AIRFLOW_CONN_AIRFLOW_DB",
             "AIRFLOW__API__SECRET_KEY",
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_remote_logging.py 
b/helm-tests/tests/helm_tests/airflow_aux/test_remote_logging.py
index 03be5245011..4b9860e35a6 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_remote_logging.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_remote_logging.py
@@ -28,8 +28,8 @@ OS_SECRET_TEMPLATE = 
"templates/secrets/opensearch-secret.yaml"
 SCHEDULER_DEPLOYMENT_TEMPLATE = "templates/scheduler/scheduler-deployment.yaml"
 CONFIGMAP_TEMPLATE = "templates/configmaps/configmap.yaml"
 
-CORE_CFG_REGEX = re.compile(r"\[core]\n.*?\n\n", flags=re.RegexFlag.DOTALL)
-LOGGING_CFG_REGEX = re.compile(r"\[logging]\n.*?\n\n", 
flags=re.RegexFlag.DOTALL)
+CORE_CFG_REGEX = re.compile(r"\[core]\n.*?\n\[", flags=re.RegexFlag.DOTALL)
+LOGGING_CFG_REGEX = re.compile(r"\[logging]\n.*?\n\[", 
flags=re.RegexFlag.DOTALL)
 
 
 class TestElasticsearchConfig:
diff --git a/helm-tests/tests/helm_tests/other/test_flower.py 
b/helm-tests/tests/helm_tests/other/test_flower.py
index 5bc695fdd53..c0de8810460 100644
--- a/helm-tests/tests/helm_tests/other/test_flower.py
+++ b/helm-tests/tests/helm_tests/other/test_flower.py
@@ -182,10 +182,10 @@ class TestFlowerDeployment:
             show_only=["templates/flower/flower-deployment.yaml"],
         )
 
-        assert (
-            jmespath.search("spec.template.spec.containers[0].env[0].name", 
docs[0])
-            == "AIRFLOW__CORE__FERNET_KEY"
+        assert "AIRFLOW__CORE__FERNET_KEY" in jmespath.search(
+            "spec.template.spec.containers[0].env | [*].name", docs[0]
         )
+
         assert 
jmespath.search("spec.template.spec.containers[0].livenessProbe.exec.command", 
docs[0]) == [
             "curl",
             "localhost:7777",
diff --git a/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py 
b/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
index 71b5f69abd0..4d05600af91 100644
--- a/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
+++ b/helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
@@ -177,10 +177,10 @@ class TestGitSyncSchedulerTest:
                 {"name": "GITSYNC_LINK", "value": "repo"},
                 {"name": "GIT_SYNC_ADD_USER", "value": "true"},
                 {"name": "GITSYNC_ADD_USER", "value": "true"},
-                {"name": "GIT_SYNC_WAIT", "value": "66"},
                 {"name": "GITSYNC_PERIOD", "value": "66s"},
                 {"name": "GIT_SYNC_MAX_SYNC_FAILURES", "value": "70"},
                 {"name": "GITSYNC_MAX_FAILURES", "value": "70"},
+                {"name": "GIT_SYNC_WAIT", "value": "66"},
                 {"name": "GIT_SYNC_HTTP_BIND", "value": ":1234"},
                 {"name": "GITSYNC_HTTP_BIND", "value": ":1234"},
             ],


Reply via email to