气流如何使用git sync从git分支中的dag文件夹中拾取dag

时间:2020-08-27 04:28:52

标签: git airflow kubernetes-helm

我的公司使用git-sync将压缩的dag同步到气流。我们使用气流舵图来部署气流。我想知道是否可以让气流只在git分支中的特定文件夹(例如dags-dev)中拾取压缩的dag,而不是所有压缩的dag?

有些参考可能有用。

气流头盔图表值文件。 https://github.com/helm/charts/blob/master/stable/airflow/values.yaml

我们的问题代码如下:

dags:
      doNotPickle: true
      git:
        url: <git url>
        ref: master
        gitSync:
          enabled: true
          image:
            repository: <some repo>
            tag: 1.0.7
          refreshTime: 60
      initContainer:
        enabled: true
        image:
          repository: <some repo>
          tag: 1.0.7

气流git同步配置如下:

AIRFLOW__KUBERNETES__DAGS_VOLUME_SUBPATH: repo # must match AIRFLOW__KUBERNETES__GIT_SUBPATH
AIRFLOW__KUBERNETES__GIT_REPO: <git repo>
AIRFLOW__KUBERNETES__GIT_BRANCH: master
AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT: /opt/airflow/dags
AIRFLOW__KUBERNETES__GIT_USER: <some user>
AIRFLOW__KUBERNETES__GIT_PASSWORD: <some password>
AIRFLOW__KUBERNETES__GIT_SYNC_CONTAINER_REPOSITORY: gitlab.beno.ai:4567/eng/external-images/k8s.gcr.io/git-sync
AIRFLOW__KUBERNETES__GIT_SYNC_CONTAINER_TAG: v3.1.1

1 个答案:

答案 0 :(得分:0)

您可以定义要忽略的文件夹/文件列表,使用 .airflowignore 文件

https://airflow.apache.org/docs/apache-airflow/stable/concepts.html#airflowignore