Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions chart/docs/manage-dag-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ This option will always use running Git-Sync sidecar on every dag-processor, wor
The Git-Sync sidecar 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 init container on your worker pods.

If you want the synced files to appear under a different directory name than ``repo`` inside the Dag mount path,
set ``dags.gitSync.link`` in your ``values.yaml``. For example, ``link: myrepo`` will mount Dags under
``$AIRFLOW_HOME/dags/myrepo`` instead of ``$AIRFLOW_HOME/dags/repo``.

.. code-block:: bash

helm upgrade --install airflow apache-airflow/airflow \
Expand Down
8 changes: 4 additions & 4 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ If release name contains chart name it will be used as a full name.
- name: GITSYNC_ROOT
value: "/git"
- name: GIT_SYNC_DEST
value: "repo"
value: {{ default "repo" .Values.dags.gitSync.link | quote }}
- name: GITSYNC_LINK
value: "repo"
value: {{ default "repo" .Values.dags.gitSync.link | quote }}
- name: GIT_SYNC_ADD_USER
value: "true"
- name: GITSYNC_ADD_USER
Expand Down Expand Up @@ -590,13 +590,13 @@ server_tls_key_file = /etc/pgbouncer/server.key
{{- define "airflow_dags" -}}
{{- if .Values.dags.mountPath }}
{{- if .Values.dags.gitSync.enabled }}
{{- printf "%s/repo/%s" .Values.dags.mountPath .Values.dags.gitSync.subPath }}
{{- printf "%s/%s/%s" .Values.dags.mountPath (default "repo" .Values.dags.gitSync.link) .Values.dags.gitSync.subPath }}
{{- else }}
{{- printf "%s" .Values.dags.mountPath }}
{{- end }}
{{- else }}
{{- if .Values.dags.gitSync.enabled }}
{{- printf "%s/dags/repo/%s" .Values.airflowHome .Values.dags.gitSync.subPath }}
{{- printf "%s/dags/%s/%s" .Values.airflowHome (default "repo" .Values.dags.gitSync.link) .Values.dags.gitSync.subPath }}
{{- else }}
{{- printf "%s/dags" .Values.airflowHome }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11908,6 +11908,11 @@
"type": "integer",
"default": 1
},
"link": {
"description": "Name of the directory where git-sync will create the symlink to the checked out repository. This allows customization of the DAG mount path structure.",
"type": "string",
"default": "repo"
},
"maxFailures": {
"description": "The number of consecutive failures allowed before aborting.",
"type": "integer",
Expand Down
5 changes: 5 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4347,6 +4347,11 @@ dags:
# Should be "" if dags are at repo root
subPath: "tests/dags"

# Name of the directory where git-sync will create the symlink to the checked out repository.
# This allows customization of the DAG mount path structure.
# Default is "repo" for backward compatibility.
link: "repo"

# If your repo needs a username/password, you can load them to a k8s secret
#
# credentialsSecret: git-credentials
Expand Down
15 changes: 15 additions & 0 deletions helm-tests/tests/helm_tests/airflow_aux/test_configmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ def test_overridedn_flower_url_prefix(self):
{"mountPath": "/opt/airflow/dags/custom", "persistence": {"enabled": True}},
"/opt/airflow/dags/custom",
),
(
# Test custom link name with default mountPath
{"gitSync": {"enabled": True, "link": "myrepo"}},
"/opt/airflow/dags/myrepo/tests/dags",
),
(
# Test custom link with custom mountPath
{"mountPath": "/opt/airflow/dags/custom", "gitSync": {"enabled": True, "link": "customrepo"}},
"/opt/airflow/dags/custom/customrepo/tests/dags",
),
(
# Test custom link with subPath
{"gitSync": {"enabled": True, "link": "myrepo", "subPath": "mysubPath"}},
"/opt/airflow/dags/myrepo/mysubPath",
),
],
)
def test_expected_default_dag_folder(self, dag_values, expected_default_dag_folder):
Expand Down
Loading