123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- # Licensed to the Apache Software Foundation (ASF) under one
- # or more contributor license agreements. See the NOTICE file
- # distributed with this work for additional information
- # regarding copyright ownership. The ASF licenses this file
- # to you under the Apache License, Version 2.0 (the
- # "License"); you may not use this file except in compliance
- # with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing,
- # software distributed under the License is distributed on an
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- # KIND, either express or implied. See the License for the
- # specific language governing permissions and limitations
- # under the License.
- ################################
- ## Airflow Flower Deployment
- #################################
- {{- if .Values.flower.enabled }}
- {{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor") }}
- {{- $nodeSelector := or .Values.flower.nodeSelector .Values.nodeSelector }}
- {{- $affinity := or .Values.flower.affinity .Values.affinity }}
- {{- $tolerations := or .Values.flower.tolerations .Values.tolerations }}
- {{- $topologySpreadConstraints := or .Values.flower.topologySpreadConstraints .Values.topologySpreadConstraints }}
- {{- $securityContext := include "airflowSecurityContext" (list . .Values.flower) }}
- kind: Deployment
- apiVersion: apps/v1
- metadata:
- name: {{ .Release.Name }}-flower
- labels:
- tier: airflow
- component: flower
- release: {{ .Release.Name }}
- chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
- heritage: {{ .Release.Service }}
- {{- with .Values.labels }}
- {{ toYaml . | indent 4 }}
- {{- end }}
- spec:
- replicas: 1
- selector:
- matchLabels:
- tier: airflow
- component: flower
- release: {{ .Release.Name }}
- template:
- metadata:
- labels:
- tier: airflow
- component: flower
- release: {{ .Release.Name }}
- {{- with .Values.labels }}
- {{ toYaml . | indent 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) }}
- {{- mustMerge .Values.flower.podAnnotations .Values.airflowPodAnnotations | toYaml | nindent 8 }}
- {{- end }}
- spec:
- nodeSelector:
- {{ toYaml $nodeSelector | indent 8 }}
- affinity:
- {{ toYaml $affinity | indent 8 }}
- tolerations:
- {{ toYaml $tolerations | indent 8 }}
- topologySpreadConstraints:
- {{ toYaml $topologySpreadConstraints | indent 8 }}
- serviceAccountName: {{ include "flower.serviceAccountName" . }}
- {{- if .Values.flower.priorityClassName }}
- priorityClassName: {{ .Values.flower.priorityClassName }}
- {{- end }}
- restartPolicy: Always
- securityContext: {{ $securityContext | nindent 8 }}
- {{- if or .Values.registry.secretName .Values.registry.connection }}
- imagePullSecrets:
- - name: {{ template "registry_secret" . }}
- {{- end }}
- containers:
- - name: flower
- image: {{ template "flower_image" . }}
- imagePullPolicy: {{ .Values.images.flower.pullPolicy }}
- {{- if .Values.flower.command }}
- command: {{ tpl (toYaml .Values.flower.command) . | nindent 12 }}
- {{- end }}
- {{- if .Values.flower.args }}
- args: {{ tpl (toYaml .Values.flower.args) . | nindent 12 }}
- {{- end }}
- resources:
- {{ toYaml .Values.flower.resources | indent 12 }}
- volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
- {{- if .Values.flower.extraVolumeMounts }}
- {{ toYaml .Values.flower.extraVolumeMounts | nindent 12 }}
- {{- end }}
- ports:
- - name: flower-ui
- containerPort: {{ .Values.ports.flowerUI }}
- livenessProbe:
- failureThreshold: 10
- exec:
- command:
- - curl
- {{- if (or .Values.flower.secretName (and .Values.flower.username .Values.flower.password))}}
- - "--user"
- - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
- {{- end }}
- - {{ printf "localhost:%s" (.Values.ports.flowerUI | toString) }}
- initialDelaySeconds: 10
- periodSeconds: 5
- readinessProbe:
- failureThreshold: 10
- exec:
- command:
- - curl
- {{- if (or .Values.flower.secretName (and .Values.flower.username .Values.flower.password))}}
- - "--user"
- - $AIRFLOW__CELERY__FLOWER_BASIC_AUTH
- {{- end }}
- - {{ printf "localhost:%s" (.Values.ports.flowerUI | toString) }}
- initialDelaySeconds: 10
- periodSeconds: 5
- envFrom:
- {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
- env:
- {{- if (or .Values.flower.secretName (and .Values.flower.username .Values.flower.password))}}
- - name: AIRFLOW__CELERY__FLOWER_BASIC_AUTH
- valueFrom:
- secretKeyRef:
- name: {{ template "flower_secret" . }}
- key: basicAuth
- {{- end }}
- {{- include "standard_airflow_environment" . | indent 10 }}
- {{- include "custom_airflow_environment" . | indent 10 }}
- {{- if .Values.flower.extraContainers }}
- {{- toYaml .Values.flower.extraContainers | nindent 8 }}
- {{- end }}
- volumes:
- - name: config
- configMap:
- name: {{ template "airflow_config" . }}
- {{- if .Values.flower.extraVolumes }}
- {{ toYaml .Values.flower.extraVolumes | indent 8 }}
- {{- end }}
- {{- end }}
- {{- end }}
|