mirror of
https://github.com/bitnami/charts.git
synced 2026-08-10 14:15:55 +08:00
* Add missing params to worker template * Rebase and bump version
207 lines
9.4 KiB
YAML
207 lines
9.4 KiB
YAML
{{- $kube := eq .Values.executor "KubernetesExecutor" -}}
|
|
{{- if or .Values.config $kube }}
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{ include "common.names.fullname" . }}-configuration
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
data:
|
|
{{- if .Values.config }}
|
|
airflow.cfg: |-
|
|
{{ .Values.config | nindent 4 }}
|
|
{{- end }}
|
|
{{- if $kube }}
|
|
pod_template.yaml: |-
|
|
{{- if .Values.worker.podTemplate }}
|
|
{{ .Values.worker.podTemplate | nindent 4 }}
|
|
{{- else }}
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: k8s-executor-pod
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
app.kubernetes.io/component: worker
|
|
{{- if .Values.worker.podLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.podLabels "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.worker.podAnnotations }}
|
|
annotations:
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
|
initContainers: {{- include "airflow.git.containers.clone" . | trim | nindent 8 }}
|
|
- name: k8s-executor-init-config
|
|
image: {{ include "airflow.workerImage" . }}
|
|
imagePullPolicy: {{ .Values.worker.image.pullPolicy }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
command:
|
|
- "/bin/bash"
|
|
- "-ce"
|
|
- |
|
|
. /opt/bitnami/base/helpers
|
|
|
|
nami_initialize airflow-worker
|
|
cp /opt/bitnami/airflow/airflow.cfg /opt/bitnami/airflow/k8s-executor-config/airflow.cfg
|
|
|
|
env:
|
|
{{- include "airflow.configure.airflow.common" . | nindent 12 }}
|
|
{{- include "airflow.configure.database" . | nindent 12 }}
|
|
{{- include "airflow.configure.redis" . | nindent 12 }}
|
|
{{- include "airflow.configure.airflow.kubernetesExecutor" . | nindent 12 }}
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ .Values.extraEnvVarsCM }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ .Values.extraEnvVarsSecret }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ .Values.worker.extraEnvVarsCM }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ .Values.worker.extraEnvVarsSecret }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: k8s-executor-config
|
|
mountPath: /opt/bitnami/airflow/k8s-executor-config
|
|
{{- if .Values.worker.initContainers }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.initContainers "context" $) | trim | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.initContainers }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | trim | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: airflow-worker
|
|
image: {{ include "airflow.workerImage" . }}
|
|
imagePullPolicy: {{ .Values.worker.image.pullPolicy }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
env:
|
|
- name: AIRFLOW__CORE__EXECUTOR
|
|
value: LocalExecutor
|
|
{{- include "airflow.configure.airflow.common" . | nindent 12 }}
|
|
{{- include "airflow.configure.database" . | nindent 12 }}
|
|
{{- include "airflow.configure.redis" . | nindent 12 }}
|
|
- name: AIRFLOW_WEBSERVER_HOST
|
|
value: {{ include "common.names.fullname" . }}
|
|
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
|
|
value: {{ .Values.service.port | quote }}
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ .Values.extraEnvVarsCM }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ .Values.extraEnvVarsSecret }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ .Values.worker.extraEnvVarsCM }}
|
|
{{- end }}
|
|
{{- if .Values.worker.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ .Values.worker.extraEnvVarsSecret }}
|
|
{{- end }}
|
|
ports:
|
|
- name: worker
|
|
containerPort: {{ .Values.worker.port }}
|
|
volumeMounts:
|
|
{{- if .Files.Glob "files/dags/*.py" }}
|
|
- name: local-dag-files
|
|
mountPath: /opt/bitnami/airflow/dags/local
|
|
{{- end }}
|
|
{{- if .Values.dagsConfigMap }}
|
|
- name: external-dag-files
|
|
mountPath: /opt/bitnami/airflow/dags/external
|
|
{{- end }}
|
|
{{- if include "airflow.shouldUseConfigFromConfigMap" . }}
|
|
- name: custom-configuration-file
|
|
mountPath: /opt/bitnami/airflow/airflow.cfg
|
|
subPath: airflow.cfg
|
|
{{- else }}
|
|
- name: k8s-executor-config
|
|
mountPath: /opt/bitnami/airflow/airflow.cfg
|
|
subPath: airflow.cfg
|
|
{{- end }}
|
|
{{- include "airflow.git.maincontainer.volumeMounts" . | trim | nindent 12 }}
|
|
{{- if .Values.worker.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- include "airflow.imagePullSecrets" . | nindent 6 }}
|
|
{{- if .Values.worker.sidecars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.sidecars "context" $) | trim | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.sidecars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | trim | nindent 8 }}
|
|
{{- end }}
|
|
restartPolicy: Never
|
|
{{- if .Values.podSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "worker" "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "worker" "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if or .Values.nodeSelector .Values.worker.nodeSelector }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.worker.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "airflow.serviceAccountName" . }}
|
|
volumes:
|
|
- name: k8s-executor-config
|
|
emptyDir: {}
|
|
{{- if .Values.dagsConfigMap }}
|
|
- name: external-dag-files
|
|
configMap:
|
|
name: {{ .Values.dagsConfigMap }}
|
|
{{- end }}
|
|
{{- if include "airflow.shouldUseConfigFromConfigMap" . }}
|
|
- name: custom-configuration-file
|
|
configMap:
|
|
name: {{ include "airflow.configMapName" . }}
|
|
{{- end }}
|
|
{{- include "airflow.git.volumes" . | trim | nindent 8 }}
|
|
{{- if .Values.worker.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.worker.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|