git-sync-relay RWX volume doesn’t work with azurefile-csi.Choose a git-sync strategy
When you configure git-sync, you must choose both a repo fetch mode and a repo share mode:- Repo fetch mode: How the git-sync relay retrieves changes from your Git repository. Choose between poll mode or webhook.
- Repo share mode: How the git-sync relay distributes changes to Airflow Pods in the Deployment. Choose between git-daemon or shared volume.
Repo fetch mode
Repo fetch mode determines how the git-sync relay retrieves changes from your Git repository. Choose one of the following options:Poll mode
The git-sync relay checks the remote Git repository for changes at regular intervals. Use poll mode for repositories with frequent changes across branches. Tradeoff: Frequent polling generates unnecessary network traffic between your Deployment and the repository when changes are infrequent.Webhook
The git-sync relay fetches changes only when a push event fires from the Git repository. Use Webhook mode for repositories that don’t change frequently, to avoid unnecessary network traffic between your Deployment and the repository. Tradeoff: If configured for a specific branch, the git-sync relay only downloads changes for that branch regardless of fetch mode. However, in Webhook mode, the webhook fires for every push event in the repository — not just pushes to the configured branch. This means a busy repository can still generate frequent webhook calls even when branch filtering is in place.Repo share mode
Repo share mode determines how the git-sync relay distributes the synced repository to Airflow Pods in the Deployment. Choose one of the following options:git-daemon
A git-daemon container serves the repository within the namespace using the Git protocol on port 9418. The Airflow Deployment contains a git-sync relay Pod with both a git-sync container that stores the Git repository and a git-daemon container that serves the repository to the namespace.
Tradeoff: All Airflow containers must clone the repository at startup, which can cause significant network use with large repositories and increase startup time.
Shared volume
The git repository contents are stored on a ReadWriteMany (RWX) storage volume mounted into each Airflow Pod, which eliminates git clone activity between Pods. The git-sync relay Pod pulls from the external Git repository and writes to the RWX volume. Requirement: An RWX-compatible StorageClass volume. RWX-compatible StorageClasses aren’t included in standard Kubernetes. You must provision additional cloud infrastructure to support RWX volumes, and the configuration steps differ between cloud providers. See your cloud provider’s documentation for details.Prerequisites
To enable the git-sync deploy feature, you need:- An Astro Private Cloud installation that runs Deployments with the Astronomer Runtime Helm chart. This is the default for most installations.
- Permission to push new configuration changes to your Astro Private Cloud installation.
- (Shared volume mode) A ReadWriteMany (RWX) compatible StorageClass volume. RWX-compatible StorageClasses require additional cloud infrastructure that varies between providers. See your cloud provider’s documentation for configuration steps.
Enable git-sync
Git-sync deploys must be explicitly selected in the UI for each Airflow Deployment, for bothgit-daemon and shared-volume repo share modes.
However, for the shared-volume mode, an APC Admin must configure the RWX shared volume storage class name, storageClassName, in the cluster configuration.
To do so:
- In the APC UI, go to your Clusters page and select your cluster.
-
In the cluster details, click Edit and add the following override to the Cluster Deployments Configuration field, including the path to your RWX compatible storage:
For details on using the UI for configuration, see Override base configuration.
- Save and apply your changes in the UI.
shared-volume repo share mode, an APC Admin must also set the RWX shared-volume storage class name, storageClassName, under deployMechanisms.gitSyncRelay. This is a global default; the repo share mode itself is still chosen per Deployment in the UI.
Configure your APC Deployment
Workspace editors can configure a new or existing Airflow Deployment to use a git-sync mechanism for Dag deploys. From there, any member of your organization with write permissions to the Git repository can deploy Dags to the Deployment. To configure a Deployment for git-sync deploys:- In the Astro Private Cloud UI, create a new Airflow Deployment or open an existing one.
- Go to the Dag Deployment section of the Deployment’s Settings page.
- For your Mechanism, select Git Sync.
-
Configure the following values:
- Repository URL: The URL for the Git repository that hosts your Astro project. Use an SSH URL (for example,
git@github.com:org/repo.git). - Branch Name: The name of the Git branch that you want to sync with your Deployment
- Ssh Key: The SSH private key for your Git repository
- Known Hosts: The public key for your Git provider, which can be retrieved using
ssh-keyscan -t rsa <provider-domain>. For an example of how to retrieve GitHub’s public key, refer to Apache Airflow documentation. - Authentication Method: (APC 2.1 and later) How git-sync authenticates to the repository. Choose one of:
- SSH: Clone over SSH using a private key — the same Ssh Key and Known Hosts fields described previously.
- HTTPS + Personal Access Token: Clone a private repository over HTTPS using a personal access token. Requires Personal Access Token and, optionally, HTTPS Username. Set Repository URL to an
https://URL instead of an SSH URL. See Authenticate to a private repository over HTTPS. - HTTPS (public repository): Clone a public repository over HTTPS with no credentials. Set Repository URL to an
https://URL.
- HTTPS Username: (APC 2.1 and later; HTTPS + Personal Access Token only) Optional. The username paired with your personal access token. Most providers (GitHub, GitLab) accept any non-empty username when a token is supplied; some (for example, Azure DevOps) require a specific username.
- Personal Access Token: (APC 2.1 and later; HTTPS + Personal Access Token only) The token used to clone your repository. The token is stored write-only and is never displayed after saving.
- Sync Interval: The time interval between checks for updates in your Git repository, in seconds. A sync is only performed when an update is detected. Astronomer recommends a minimum interval of 60 seconds.
- Dags Directory: The directory in your Git repository that hosts your Dags. Specify the directory’s path as relative to the repository’s root directory. To use your root directory as your Dags directory, specify this value as
./. Other changes outside the Dags directory in your Git repository must be deployed usingastro deploy. - Rev: The commit reference of the branch that you want to sync with your Deployment
- Repo Fetch Mode: Choose Poll or WebHook. If you select WebHook, you need the Webhook URL and Webhook Secret Key for your GitHub Configuration.
- Webhook URL: (Webhook mode only)
- Webhook Secret Key: (Webhook mode only)
- Ephemeral Storage Overwrite Gigabytes: The storage limit for your Git repository. If your Git repository is larger than 2 GB, Astronomer recommends setting this slider to your repository size + 1 Gi
- Sync Timeout: The maximum amount of seconds allowed for a sync. Astronomer recommends increasing this value if your repository is larger than 1 GB
- Repository URL: The URL for the Git repository that hosts your Astro project. Use an SSH URL (for example,
-
(Webhook Only) You can now open your GitHub repository and set up a Repository Webhook, or you can return to your Deployment details page to configure this later. Be sure to set the following configurations:
- Payload URL: Paste the Webhook URL from the Astro Private Cloud UI
- Content Type: Select JSON.
- Secret: Paste the Webhook Secret Key from the Astro Private Cloud UI
- Enable SSL verification
- Choose Just the push event for the event trigger
- Save your changes.
Configure a Git repository for git-sync deploys
The Git repository you want to sync should contain a directory of Dags that you want to deploy to APC. You can include additional files in the repository, such as your other Astro project files, but note that this might affect performance when deploying new changes to Dags. To deploy Dags from a private Git repository, add a deploy key to your Git repository and provide the matching private key as the Ssh Key so your APC Deployment can access the repository. This process varies slightly between Git repository management tools. For an example, read GitLab’s SSH Key documentation. Starting in APC 2.1, you can authenticate to a private repository over HTTPS with a personal access token instead of SSH. See Authenticate to a private repository over HTTPS.Authenticate to a private repository over HTTPS
Astro Private Cloud 2.1This feature was introduced in Astro Private Cloud 2.1. To access this feature, upgrade your Astro Private Cloud installation to 2.1 or later.
- In your Git provider, create a personal access token (PAT) with read access to the repository (for example, GitHub’s
repo/read:repositoryscope). - In the Deployment’s Dag Deployment settings, set Authentication Method to HTTPS + Personal Access Token.
- Set Repository URL to the repository’s
https://clone URL. - Enter the Personal Access Token. Optionally set HTTPS Username if your provider requires a specific username; otherwise leave it blank.
- Save your changes.
Trust a private certificate authority (CA)
Astro Private Cloud 2.1This feature was introduced in Astro Private Cloud 2.1. To access this feature, upgrade your Astro Private Cloud installation to 2.1 or later.
-
Create a Kubernetes Secret in the platform namespace (for example,
astronomer) containing the CA certificate under the keycert.pem, and annotate it socommanderreplicates it into your Deployment namespaces: -
Reference the Secret in your APC API configuration. Houston emits
deployments.privateCaCertSecretNamesasglobal.privateCaCertsin the Airflow chart values, and the git-sync container trusts the listed CAs viaupdate-ca-certificates. Setting the platform-levelglobal.privateCaCertsto the same Secret lets the control-plane credential-validation check trust the host as well:
The Secret name must be added to
privateCaCertSecretNames for each cluster that runs git-sync Deployments. Add a git-sync CA to the existing global.privateCaCerts list rather than replacing it — Helm replaces list values across -f files, so dropping an existing platform CA can break other platform TLS.Deploy a project image to a git-sync Deployment
git-sync updates only the Dags in your Deployment. Python packages, OS-level packages, and the other files in your Astro project stay in the Deployment image. To update them, deploy a new image. The Deployment keeps git-sync as its Dag deploy mechanism. Use one of the following methods:-
Build a new image and push it with the Astro CLI:
The
--imageflag deploys only the image. The CLI doesn’t deploy the Dags from your Astro project, because git-sync provides them. -
Point the Deployment at an image that is already in a registry:
This command calls the
updateDeploymentImagemutation of the APC API. Deploys to a custom registry and direct API calls use the same mutation. See Update a Deployment image with the APC API.
Enable the update deployment image endpoint
APC disables theupdateDeploymentImage endpoint by default. When the endpoint is disabled, an image update returns the following error:
values.yaml file:
Add Kubernetes scheduling configurations for git-sync relay
You can add Kubernetes scheduling configurations —tolerations, nodeSelector, and affinity — to your global git-sync relay configuration. These configurations allow you to:
- Specify node selection criteria with
nodeSelector - Configure Pod affinity and anti-affinity rules
- Set tolerations for tainted nodes
nodeSelector, affinity, or tolerations only if you need specific node placement for your git-sync-relay components.