Skip to content
Merged
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
9 changes: 9 additions & 0 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}

{{/* User defined gitSync container environment from */}}
{{- define "custom_git_sync_environment_from" }}
{{- $Global := . }}
{{- with .Values.dags.gitSync.envFrom }}
{{- tpl . $Global | nindent 2 }}
{{- end }}
{{- end }}

{{/* Git ssh key volume */}}
{{- define "git_sync_ssh_key_volume" }}
- name: git-sync-ssh-key
Expand All @@ -198,6 +206,7 @@ If release name contains chart name it will be used as a full name.
image: {{ template "git_sync_image" . }}
imagePullPolicy: {{ .Values.images.gitSync.pullPolicy }}
securityContext: {{- include "localContainerSecurityContext" .Values.dags.gitSync | nindent 4 }}
envFrom: {{- include "custom_git_sync_environment_from" . | default "\n []" | indent 2 }}
env:
{{- if or .Values.dags.gitSync.sshKeySecret .Values.dags.gitSync.sshKey }}
- name: GIT_SSH_KEY_FILE
Expand Down
12 changes: 12 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8528,6 +8528,18 @@
}
]
},
"envFrom": {
"description": "Extra envFrom 'items' that will be added to the definition of Airflow gitSync containers; a string or array are expected (can be templated).",
"type": [
"null",
"string"
],
"default": null,
"examples": [
"- secretRef:\n name: 'proxy-config",
"- configMapRef:\n name: 'proxy-config"
]
},
"resources": {
"description": "Resources on workers git-sync sidecar",
"type": "object",
Expand Down
10 changes: 10 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ extraSecrets: {}
# '{{ .Release.Name }}-other-secret-name-suffix':
# data: |
# ...
# 'proxy-config':
# stringData: |
# HTTP_PROXY: http://proxy_user:proxy_password@192.168.0.10:2080
# HTTPS_PROXY: http://proxy_user:proxy_password@192.168.0.10:2080
# NO_PROXY: "localhost,127.0.0.1,.svc.cluster.local,kubernetes.default.svc"

# Extra ConfigMaps that will be managed by the chart
# (You can use them with extraEnv or extraEnvFrom or some of the extraVolumes values).
Expand Down Expand Up @@ -2655,6 +2660,11 @@ dags:
# For backwards compatibility, wait will be used if it is specified.
period: 5s
wait: ~
# add variables from secret into gitSync containers, such proxy-config
envFrom: ~
# envFrom: |
# - secretRef:
# name: 'proxy-config'

containerName: git-sync
uid: 65533
Expand Down
2 changes: 2 additions & 0 deletions helm_tests/airflow_aux/test_pod_template_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def test_should_add_an_init_container_if_git_sync_is_true(self):
"sshKeySecret": None,
"credentialsSecret": None,
"knownHosts": None,
"envFrom": "- secretRef:\n name: 'proxy-config'\n",
}
},
},
Expand All @@ -98,6 +99,7 @@ def test_should_add_an_init_container_if_git_sync_is_true(self):
"securityContext": {"runAsUser": 65533},
"image": "test-registry/test-repo:test-tag",
"imagePullPolicy": "Always",
"envFrom": [{"secretRef": {"name": "proxy-config"}}],
"env": [
{"name": "GIT_SYNC_REV", "value": "HEAD"},
{"name": "GITSYNC_REF", "value": "test-branch"},
Expand Down
4 changes: 4 additions & 0 deletions helm_tests/other/test_git_sync_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_validate_the_git_sync_container_spec(self):
"sshKeySecret": None,
"credentialsSecret": None,
"knownHosts": None,
"envFrom": "- secretRef:\n name: 'proxy-config'\n",
},
"persistence": {"enabled": True},
},
Expand All @@ -89,6 +90,7 @@ def test_validate_the_git_sync_container_spec(self):
"securityContext": {"runAsUser": 65533},
"image": "test-registry/test-repo:test-tag",
"imagePullPolicy": "Always",
"envFrom": [{"secretRef": {"name": "proxy-config"}}],
"env": [
{"name": "GIT_SYNC_REV", "value": "HEAD"},
{"name": "GITSYNC_REF", "value": "test-branch"},
Expand Down Expand Up @@ -137,6 +139,7 @@ def test_validate_the_git_sync_container_spec_if_wait_specified(self):
"sshKeySecret": None,
"credentialsSecret": None,
"knownHosts": None,
"envFrom": "- secretRef:\n name: 'proxy-config'\n",
},
"persistence": {"enabled": True},
},
Expand All @@ -149,6 +152,7 @@ def test_validate_the_git_sync_container_spec_if_wait_specified(self):
"securityContext": {"runAsUser": 65533},
"image": "test-registry/test-repo:test-tag",
"imagePullPolicy": "Always",
"envFrom": [{"secretRef": {"name": "proxy-config"}}],
"env": [
{"name": "GIT_SYNC_REV", "value": "HEAD"},
{"name": "GITSYNC_REF", "value": "test-branch"},
Expand Down