삽질/Airflow

GitLab, Airflow 연동

maengis 2023. 5. 22. 18:46

1. 깃랩 연동을 위해 계정 정보 등록

apiVersion: v1
kind: Secret
metadata:
  name: git-credentials
  namespace: airflow
type: Opaque
data:
  GIT_SYNC_USERNAME: {아이디 base64인코딩}
  GIT_SYNC_PASSWORD: {비번 base64인코딩}

적용

kubectl apply -f airflow_gitlab_secret.yaml

 

2. airflow gitsync 설정 변경

values.yaml 수정

# Git sync
dags:
  persistence:
    # Annotations for dags PVC
    annotations: {}
    # Enable persistent volume for storing dags
    enabled: false
...
  gitSync:
    enabled: true
 
    # git repo clone url
    # ssh example: git@github.com:apache/airflow.git
    # https example: https://github.com/apache/airflow.git
    repo: {저장소 주소}
    branch: main
...
    subPath: ""
    credentialsSecret: git-credentials
    wait: 10

 

DAG 목록에 뜨는 것 확인

 

코드 변경시 반영 되는 것 확인

 

반응형