ashb commented on a change in pull request #8777:
URL: https://github.com/apache/airflow/pull/8777#discussion_r434430670
##########
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:
So this won't work for "master" images. We have two options here.
- We could make this command be `args: ["sh", "-c", "airflow upgradedb ||
airflow db upgrade"]`
- We update this to only work with master (i.e. change this to `"airflow",
"db", "upgrade"`)
I think I prefer the first option -- it lets people start to use this chart
much sooner. (Yes, people will be taking it from "master" which isn't great,
but I think for now that is an okay path to take.)
(We've got same issue with create_user in webserver)
----------------------------------------------------------------
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]