Skip to content

Commit 37112bf

Browse files
committed
chore(airflow): custom pip and requirement config
1 parent cc03cc7 commit 37112bf

4 files changed

Lines changed: 56 additions & 2 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if or .Values.worker.requirements .Values.worker.pip }}
7+
apiVersion: v1
8+
kind: ConfigMap
9+
metadata:
10+
name: {{ include "common.names.fullname" . }}-worker
11+
namespace: {{ .Release.Namespace | quote }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13+
{{- if .Values.commonAnnotations }}
14+
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
15+
{{- end }}
16+
data:
17+
{{- if .Values.worker.requirements }}
18+
requirements.txt: |-
19+
{{- include "common.tplvalues.render" ( dict "value" .Values.worker.requirements "context" $ ) | nindent 4 }}
20+
{{- end }}
21+
{{- if .Values.worker.pip }}
22+
pip.conf: |-
23+
{{- include "common.tplvalues.render" ( dict "value" .Values.worker.pip "context" $ ) | nindent 4 }}
24+
{{- end }}
25+
{{- end }}

addons/airflow/2/chart/airflow/templates/worker/statefulset.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ spec:
195195
mountPath: /opt/drycc/airflow/airflow.cfg
196196
subPath: airflow.cfg
197197
{{- end }}
198+
{{- if .Values.worker.requirements }}
199+
- name: worker-config
200+
mountPath: /opt/drycc/python/requirements.txt
201+
subPath: requirements.txt
202+
{{- end }}
203+
{{- if .Values.worker.pip }}
204+
- name: worker-config
205+
mountPath: /opt/drycc/.config/pip/pip.conf
206+
subPath: pip.conf
207+
{{- end }}
198208
{{- include "airflow.git.maincontainer.volumeMounts" . | trim | nindent 12 }}
199209
{{- if .Values.extraVolumeMounts }}
200210
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
@@ -221,6 +231,11 @@ spec:
221231
configMap:
222232
name: {{ include "airflow.configMapName" . }}
223233
{{- end }}
234+
{{- if or .Values.worker.requirements .Values.worker.pip }}
235+
- name: worker-config
236+
configMap:
237+
name: {{ include "common.names.fullname" . }}-worker
238+
{{- end }}
224239
{{- if .Values.extraVolumes }}
225240
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
226241
{{- end }}

addons/airflow/2/chart/airflow/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,20 @@ worker:
706706
## @param worker.extraEnvVarsSecrets List of secrets with extra environment variables for Airflow worker pods
707707
##
708708
extraEnvVarsSecrets: []
709+
## @param requirements Specify content for Airflow worker requirements.txt file
710+
## e.g:
711+
## requirements: |-
712+
## pylint==2.13.9
713+
## ...
714+
##
715+
requirements: ""
716+
## @param pip.conf Specify content for Airflow worker pip.conf file
717+
## e.g:
718+
## pip: |-
719+
## [global]
720+
## ...
721+
##
722+
pip: ""
709723
## @param worker.containerPorts.http Airflow worker HTTP container port
710724
##
711725
containerPorts:

addons/airflow/2/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ allow_parameters:
2828
required: false
2929
description: "metrics enable or not config for values.yaml"
3030
- name: "externalDatabase"
31-
required: false
31+
required: true
3232
description: "externalDatabase config for values.yaml"
3333
- name: "externalRedis"
34-
required: false
34+
required: true
3535
description: "externalRedis config for values.yaml"
3636
archive: false

0 commit comments

Comments
 (0)