Skip to content

Commit

Permalink
Add ingest cronjob (#111)
Browse files Browse the repository at this point in the history
Run ingestion as cronjob to update the database

Fixes #102
  • Loading branch information
fwilhe authored Sep 18, 2024
1 parent 7757beb commit ac43ac6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
71 changes: 71 additions & 0 deletions 02_ingestion-job.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions deploy-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ac43ac6

Please sign in to comment.