feat(helm): Conditionally render GIT_SYNC_* vs GITSYNC_* env vars based on Git Sync version #52388
+127
−58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses Issue #52320 by introducing conditional logic in the Helm Chart to support both Git Sync v3 and v4 credential environment variable formats.
Background
In Git Sync:
GIT_SYNC_USERNAME
,GIT_SYNC_PASSWORD
GITSYNC_USERNAME
,GITSYNC_PASSWORD
Prior to this change, the Airflow Helm Chart rendered all four variables, regardless of which version of Git Sync was being used. This led to confusion and potential misconfigurations.
What this PR changes
Added a helper function
git_sync.env_credentials
in_helpers.tpl
to conditionally render environment variables for git-sync v3 (
GIT_SYNC_*
) and v4 (GITSYNC_*
) based on image tag.Replaced hardcoded credential environment variable blocks in Helm templates
with the new
include
-based helper for better maintainability and correctness.Added two new parameterized unit tests:
test_git_sync_credentials_env_vars
(for pod-template-file)test_scheduler_git_sync_env_vars
(for scheduler-deployment)Both test the expected env vars for v3 and v4 using
@pytest.mark.parametrize
.Motivation
Previously, git-sync credential environment variables were rendered unconditionally for both v3 and v4,
causing redundancy and potential YAML issues. Also, tests for those were hard to maintain and unclear
when failures occurred due to overlapping expectations.
Benefits
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in airflow-core/newsfragments.