potiuk commented on a change in pull request #8777:
URL: https://github.com/apache/airflow/pull/8777#discussion_r434483343
##########
File path: chart/templates/scheduler/scheduler-deployment.yaml
##########
@@ -0,0 +1,175 @@
+################################
+## Airflow Scheduler Deployment/StatefulSet
+#################################
+
+# Are we using a local/sequenial executor?
+{{- $local := or (eq .Values.executor "LocalExecutor") (eq .Values.executor
"SequentialExecutor") }}
+# Are we using the kubernetes executor?
+{{- $kube := eq .Values.executor "KubernetesExecutor" }}
+# Is persistence enabled on the _workers_?
+# This is important because in $local mode, the scheduler assumes the role of
the worker
+{{- $persistence := .Values.workers.persistence.enabled }}
+# If we're using a StatefulSet
+{{- $stateful := and $local $persistence }}
+# If we're using elasticsearch logging
+{{- $elasticsearch := .Values.elasticsearch.enabled }}
+
+kind: {{ if $stateful }}StatefulSet{{ else }}Deployment{{ end }}
+apiVersion: apps/v1
+metadata:
+ name: {{ .Release.Name }}-scheduler
+ labels:
+ tier: airflow
+ component: scheduler
+ release: {{ .Release.Name }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+{{- if $stateful }}
+ serviceName: {{ .Release.Name }}-scheduler
+{{- end }}
+ replicas: 1
+ selector:
+ matchLabels:
+ tier: airflow
+ component: scheduler
+ release: {{ .Release.Name }}
+ template:
+ metadata:
+ labels:
+ tier: airflow
+ component: scheduler
+ release: {{ .Release.Name }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 8 }}
+{{- end }}
+ annotations:
+ checksum/metadata-secret: {{ include (print $.Template.BasePath
"/secrets/metadata-connection-secret.yaml") . | sha256sum }}
+ checksum/result-backend-secret: {{ include (print $.Template.BasePath
"/secrets/result-backend-connection-secret.yaml") . | sha256sum }}
+ checksum/pgbouncer-config-secret: {{ include (print
$.Template.BasePath "/secrets/pgbouncer-config-secret.yaml") . | sha256sum }}
+ checksum/airflow-config: {{ include (print $.Template.BasePath
"/configmap.yaml") . | sha256sum }}
+ {{- if .Values.scheduler.safeToEvict }}
+ cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
+ {{- end }}
+ {{- if .Values.airflowPodAnnotations }}
+ {{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
+ {{- end }}
+ spec:
+ nodeSelector:
+{{ toYaml .Values.nodeSelector | indent 8 }}
+ affinity:
+{{ toYaml .Values.affinity | indent 8 }}
+ tolerations:
+{{ toYaml .Values.tolerations | indent 8 }}
+ restartPolicy: Always
+ terminationGracePeriodSeconds: 10
+ serviceAccountName: {{ .Release.Name }}-scheduler-serviceaccount
+ securityContext:
+ runAsUser: {{ .Values.uid }}
+ fsGroup: {{ .Values.gid }}
+ {{- if or .Values.registry.secretName .Values.registry.connection }}
+ imagePullSecrets:
+ - name: {{ template "registry_secret" . }}
+ {{- end }}
+ initContainers:
+ - name: run-airflow-migrations
+ image: {{ template "airflow_image" . }}
+ imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
+ args: ["airflow", "upgradedb"]
Review comment:
We could also make it part of the Docker Image. It could be part of the
script in the image - we already have conditional code to build airflow images
1.10/2.0 for that there - and we could simply call "upgradedb.sh" script in the
image and that script would behave well depending on the version.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]