-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Add git sync option and unit tests for the Helm chart #9371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f1ba895
c8fb2ec
e17430c
351d69a
dd08690
6786d5e
784e285
60f768f
0e69d66
22b1b15
8fdc1bd
c4370ea
362e163
4f2496c
a4a0cf5
465a018
0dc3471
b7a40e8
eabf6c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ The command removes all the Kubernetes components associated with the chart and | |
|
|
||
| ## Updating DAGs | ||
|
|
||
| The recommended way to update your DAGs with this chart is to build a new docker image with the latest code (`docker build -t my-company/airflow:8a0da78 .`), push it to an accessible registry (`docker push my-company/airflow:8a0da78`), then update the Airflow pods with that image: | ||
| The recommended way to update your DAGs with this chart is to build a new docker image with the latest DAG code (`docker build -t my-company/airflow:8a0da78 .`), push it to an accessible registry (`docker push my-company/airflow:8a0da78`), then update the Airflow pods with that image: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we will want to change that description as it is not valid any more and we have "EMBED_DAGS" directive while building the dockerfiles + we will add on-build most likely to add the DAGs on building deppendent image but I will do it separately. |
||
|
|
||
| ```bash | ||
| helm upgrade airflow . \ | ||
|
|
@@ -76,6 +76,42 @@ helm upgrade airflow . \ | |
|
|
||
| For local development purpose you can also build the image locally and use it via deployment method described by Breeze. | ||
|
|
||
| ## Mounting DAGS using Git-Sync side car with Persistence enabled | ||
|
|
||
| This option will use a Persistent Volume Claim with an accessMode of `ReadWriteMany`. The scheduler pod will sync DAGs from a git repository onto the PVC every configured number of seconds. The other pods will read the synced DAGs. Not all volume plugins have support for `ReadWriteMany` accessMode. Refer [Persistent Volume Access Modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) for details | ||
|
|
||
| ```bash | ||
| helm upgrade airflow . \ | ||
| --set dags.persistence.enabled=true \ | ||
| --set dags.gitSync.enabled=true | ||
| # you can also override the other persistence or gitSync values | ||
| # by setting the dags.persistence.* and dags.gitSync.* values | ||
| # Please refer to values.yaml for details | ||
| ``` | ||
|
|
||
| ## Mounting DAGS using Git-Sync side car without Persistence | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to have this option.! |
||
| This option will use an always running Git-Sync side car on every scheduler,webserver and worker pods. The Git-Sync side car containers will sync DAGs from a git repository every configured number of seconds. If you are using the KubernetesExecutor, Git-sync will run as an initContainer on your worker pods. | ||
|
|
||
| ```bash | ||
| helm upgrade airflow . \ | ||
| --set dags.persistence.enabled=false \ | ||
| --set dags.gitSync.enabled=true | ||
| # you can also override the other gitSync values | ||
| # by setting the dags.gitSync.* values | ||
| # Refer values.yaml for details | ||
| ``` | ||
|
|
||
| ## Mounting DAGS from an externally populated PVC | ||
| In this approach, Airflow will read the DAGs from a PVC which has `ReadOnlyMany` or `ReadWriteMany` accessMode. You will have to ensure that the PVC is populated/updated with the required DAGs(this won't be handled by the chart). You can pass in the name of the volume claim to the chart | ||
|
|
||
| ```bash | ||
| helm upgrade airflow . \ | ||
| --set dags.persistence.enabled=true \ | ||
| --set dags.persistence.existingClaim=my-volume-claim | ||
| --set dags.gitSync.enabled=false | ||
| ``` | ||
|
|
||
|
|
||
| ## Parameters | ||
|
|
||
| The following tables lists the configurable parameters of the Airflow chart and their default values. | ||
|
|
@@ -159,6 +195,8 @@ The following tables lists the configurable parameters of the Airflow chart and | |
| | `webserver.resources.requests.cpu` | CPU Request of webserver | `~` | | ||
| | `webserver.resources.requests.memory` | Memory Request of webserver | `~` | | ||
| | `webserver.defaultUser` | Optional default airflow user information | `{}` | | ||
| | `dags.persistence.*` | Dag persistence configutation | Please refer to `values.yaml` | | ||
| | `dags.gitSync.*` | Git sync configuration | Please refer to `values.yaml` | | ||
|
|
||
|
|
||
| Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # 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. | ||
|
|
||
| {{- if and (not .Values.dags.persistence.existingClaim ) .Values.dags.persistence.enabled }} | ||
| kind: PersistentVolumeClaim | ||
| apiVersion: v1 | ||
| metadata: | ||
| name: {{ .Release.Name }}-dags | ||
| labels: | ||
| tier: airflow | ||
| component: dags-pvc | ||
| release: {{ .Release.Name }} | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| heritage: {{ .Release.Service }} | ||
| spec: | ||
| accessModes: [{{ .Values.dags.persistence.accessMode | quote }}] | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.dags.persistence.size | quote }} | ||
| {{- if .Values.dags.persistence.storageClass }} | ||
| {{- if (eq "-" .Values.dags.persistence.storageClass) }} | ||
| storageClassName: "" | ||
| {{- else }} | ||
| storageClassName: "{{ .Values.dags.persistence.storageClass }}" | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,7 @@ spec: | |
| restartPolicy: Always | ||
| securityContext: | ||
| runAsUser: {{ .Values.uid }} | ||
| fsGroup: {{ .Values.gid }} | ||
| {{- if or .Values.registry.secretName .Values.registry.connection }} | ||
| imagePullSecrets: | ||
| - name: {{ template "registry_secret" . }} | ||
|
|
@@ -82,6 +83,9 @@ spec: | |
| {{- include "custom_airflow_environment" . | indent 10 }} | ||
| {{- include "standard_airflow_environment" . | indent 10 }} | ||
| containers: | ||
| {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} | ||
| {{- include "git_sync_container" . | indent 8 }} | ||
| {{- end }} | ||
| - name: webserver | ||
| image: {{ template "airflow_image" . }} | ||
| imagePullPolicy: {{ .Values.images.airflow.pullPolicy }} | ||
|
|
@@ -105,6 +109,10 @@ spec: | |
| subPath: airflow_local_settings.py | ||
| readOnly: true | ||
| {{- end }} | ||
| {{- if or .Values.dags.gitSync.enabled .Values.dags.persistence.enabled }} | ||
| - name: dags | ||
| mountPath: {{ template "airflow_dags_mount_path" . }} | ||
| {{- end }} | ||
| {{- if .Values.webserver.extraVolumeMounts }} | ||
| {{ toYaml .Values.webserver.extraVolumeMounts | indent 12 }} | ||
| {{- end }} | ||
|
|
@@ -134,6 +142,17 @@ spec: | |
| - name: config | ||
| configMap: | ||
| name: {{ template "airflow_config" . }} | ||
| {{- if .Values.dags.persistence.enabled }} | ||
| - name: dags | ||
| persistentVolumeClaim: | ||
| claimName: {{ .Release.Name }}-dags | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If uses
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have raised a PR to fix this - #9688 |
||
| {{- else if .Values.dags.gitSync.enabled }} | ||
| - name: dags | ||
| emptyDir: {} | ||
| {{- if .Values.dags.gitSync.sshKeySecret }} | ||
| {{- include "git_sync_ssh_key_volume" . | indent 8 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.webserver.extraVolumes }} | ||
| {{ toYaml .Values.webserver.extraVolumes | indent 8 }} | ||
| {{- end }} | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replicating the chart config onto the kubernetes worker as well, without this config git sync with ssh may not work on the worker when
git_sync_run_as_useris set to 50000