Skip to content

Commit

Permalink
Chart: add git-sync-ssh secret template to dagprocessor (apache#40691)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aakcht authored Jul 10, 2024
1 parent 224cb75 commit b17a9fd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ spec:
- name: dags
emptyDir: {{- toYaml (default (dict) .Values.dags.gitSync.emptyDirConfig) | nindent 12 }}
{{- end }}
{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.sshKeySecret }}
{{- if and .Values.dags.gitSync.enabled (or .Values.dags.gitSync.sshKeySecret .Values.dags.gitSync.sshKey) }}
{{- include "git_sync_ssh_key_volume" . | indent 8 }}
{{- end }}
{{- if .Values.volumes }}
Expand Down
38 changes: 38 additions & 0 deletions helm_tests/airflow_core/test_dag_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,44 @@ def test_should_add_webserver_config_volume_and_volume_mount_when_exists(
assert expected_volume not in created_volumes
assert expected_volume_mount not in created_volume_mounts

def test_validate_if_ssh_params_are_added_with_git_ssh_key(self):
docs = render_chart(
values={
"dagProcessor": {"enabled": True},
"dags": {
"gitSync": {
"enabled": True,
"sshKey": "my-ssh-key",
},
"persistence": {"enabled": False},
},
},
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
)

assert {"name": "GIT_SSH_KEY_FILE", "value": "/etc/git-secret/ssh"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {"name": "GITSYNC_SSH_KEY_FILE", "value": "/etc/git-secret/ssh"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {"name": "GIT_SYNC_SSH", "value": "true"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {"name": "GITSYNC_SSH", "value": "true"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {"name": "GIT_KNOWN_HOSTS", "value": "false"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {"name": "GITSYNC_SSH_KNOWN_HOSTS", "value": "false"} in jmespath.search(
"spec.template.spec.containers[1].env", docs[0]
)
assert {
"name": "git-sync-ssh-key",
"secret": {"secretName": "release-name-ssh-secret", "defaultMode": 288},
} in jmespath.search("spec.template.spec.volumes", docs[0])


class TestDagProcessorLogGroomer(LogGroomerTestBase):
"""DAG processor log groomer."""
Expand Down

0 comments on commit b17a9fd

Please sign in to comment.