airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@apache.org
Subject [02/20] incubator-airflow git commit: [AIRFLOW-1314] Add support for volume mounts & Secrets in Kubernetes Executor
Date Sun, 22 Apr 2018 08:32:35 GMT
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/c177d6e8/kube/postgres.yaml
----------------------------------------------------------------------
diff --git a/kube/postgres.yaml b/kube/postgres.yaml
new file mode 100644
index 0000000..a7298d1
--- /dev/null
+++ b/kube/postgres.yaml
@@ -0,0 +1,94 @@
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: postgres-airflow
+spec:
+  accessModes:
+    - ReadWriteOnce
+  capacity:
+    storage: 5Gi
+  hostPath:
+    path: /data/postgres-airflow
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: postgres-airflow
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 5Gi
+---
+kind: Deployment
+apiVersion: extensions/v1beta1
+metadata:
+  name: postgres-airflow
+spec:
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        name: postgres-airflow
+    spec:
+      restartPolicy: Always
+      containers:
+        - name: postgres
+          image: postgres
+          ports:
+            - containerPort: 5432
+              protocol: TCP
+          volumeMounts:
+            - name: dbvol
+              mountPath: /var/lib/postgresql/data/pgdata
+              subPath: pgdata
+          env:
+            - name: POSTGRES_USER
+              value: root
+            - name: POSTGRES_PASSWORD
+              value: root
+            - name: POSTGRES_DB
+              value: airflow
+            - name: PGDATA
+              value: /var/lib/postgresql/data/pgdata
+            - name: POD_IP
+              valueFrom: { fieldRef: { fieldPath: status.podIP } }
+          livenessProbe:
+            initialDelaySeconds: 60
+            timeoutSeconds: 5
+            failureThreshold: 5
+            exec:
+              command:
+              - /bin/sh
+              - -c
+              - exec pg_isready --host $POD_IP ||  if [[ $(psql -qtAc --host $POD_IP 'SELECT
pg_is_in_recovery') != "f" ]]; then  exit 0 else; exit 1; fi
+          readinessProbe:
+            initialDelaySeconds: 5
+            timeoutSeconds: 5
+            periodSeconds: 5
+            exec:
+              command:
+              - /bin/sh
+              - -c
+              - exec pg_isready --host $POD_IP
+          resources:
+            requests:
+              memory: .5Gi
+              cpu: .5
+      volumes:
+        - name: dbvol
+          persistentVolumeClaim:
+            claimName: postgres-airflow
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: postgres-airflow
+spec:
+  clusterIP: None
+  ports:
+    - port: 5432
+      targetPort: 5432
+  selector:
+    name: postgres-airflow


Mime
View raw message