# Written by Mutlu Polatcan
# 17.12.2019
# --------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: airflow-scheduler
  labels:
    app: airflow
    unit: scheduler
spec:
  replicas: 1
  selector:
    matchLabels:
      app: airflow
      unit: scheduler
  template:
    metadata:
      name: airflow-scheduler
      labels:
        app: airflow
        unit: scheduler
    spec:
      restartPolicy: Always
      containers:
        - name: airflow-scheduler
          image: mpolatcan/airflow:1.10.6-python3.6
          imagePullPolicy: Always
          env:
            - name: AIRFLOW_DAEMONS
              value: |
                scheduler
          envFrom:
            - configMapRef:
                name: airflow-config
            - secretRef:
                name: airflow-secret
          volumeMounts:
            - mountPath: /home/airflow/airflow/dags
              name: airflow-nfs
              subPath: airflow/dags
            - mountPath: /home/airflow/airflow/plugins
              name: airflow-nfs
              subPath: airflow/plugins
      volumes:
        - name: airflow-nfs
          persistentVolumeClaim:
            claimName: airflow-nfs-pvc-rw