diff --git a/02_ingestion-job.yaml b/02_ingestion-job.yaml new file mode 100644 index 0000000..574f5f2 --- /dev/null +++ b/02_ingestion-job.yaml @@ -0,0 +1,71 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glvd-ingestion + labels: + app.kubernetes.io/name: glvd + gardenlinux.io/glvd-component: glvd-ingestion +data: + databaseName: glvd + databaseHost: glvd-database-0.glvd-database + databasePort: "5432" +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: glvd-ingestion + labels: + app.kubernetes.io/name: glvd + gardenlinux.io/glvd-component: glvd-ingestion +spec: + schedule: "30 8 * * 1-5" + timeZone: "Europe/Berlin" + jobTemplate: + metadata: + labels: + app.kubernetes.io/name: glvd + gardenlinux.io/glvd-component: glvd-ingestion + spec: + template: + spec: + restartPolicy: Never + containers: + - name: data-ingestion + image: ghcr.io/gardenlinux/glvd-data-ingestion:edge + # resources: + # requests: + # cpu: "1" + # memory: "2Gi" + # limits: + # cpu: "2" + # memory: "4Gi" + command: + - /bin/bash + - -c + - sleep 5 && echo start && /usr/local/src/ingest-postgres.sh + env: + - name: PGDATABASE + valueFrom: + configMapKeyRef: + name: glvd-ingestion + key: databaseName + - name: PGUSER + valueFrom: + secretKeyRef: + name: postgres-credentials + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: postgres-credentials + key: password + - name: PGHOST + valueFrom: + configMapKeyRef: + name: glvd-ingestion + key: databaseHost + - name: PGPORT + valueFrom: + configMapKeyRef: + name: glvd-ingestion + key: databasePort diff --git a/deploy-k8s.sh b/deploy-k8s.sh index 19548ee..b1a71d3 100755 --- a/deploy-k8s.sh +++ b/deploy-k8s.sh @@ -13,3 +13,4 @@ kubectl run init-pg --image=ghcr.io/gardenlinux/glvd-postgres-init:latest --rest sleep 60 kubectl apply -f 01_glvd-deployment.yaml +kubectl apply -f 02_ingestion-job.yaml