cronjob to execute clearsessions regularly
This commit is contained in:
parent
60d62bd0af
commit
41ab33bee7
2 changed files with 49 additions and 0 deletions
48
deployment/kustomize/base/portal/cronjob.yaml
Normal file
48
deployment/kustomize/base/portal/cronjob.yaml
Normal file
|
@ -0,0 +1,48 @@
|
|||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: servala-clearsessions
|
||||
spec:
|
||||
schedule: "42 02 * * 1"
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: servala-clearsessions
|
||||
image: servala-2nkgm.app.codey.ch/servala/servala-portal:latest
|
||||
imagePullPolicy: Always
|
||||
# The command to clear sessions
|
||||
command: ["uv", "run", "src/manage.py", "clearsessions"]
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: servala
|
||||
env:
|
||||
- name: SERVALA_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-creds
|
||||
key: POSTGRESQL_USER
|
||||
- name: SERVALA_DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-creds
|
||||
key: POSTGRESQL_PASSWORD
|
||||
- name: SERVALA_DB_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-creds
|
||||
key: POSTGRESQL_HOST
|
||||
- name: SERVALA_DB_PORT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-creds
|
||||
key: POSTGRESQL_PORT
|
||||
- name: SERVALA_DB_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-creds
|
||||
key: POSTGRESQL_DB
|
||||
- name: UV_CACHE_DIR
|
||||
value: /app/.uvcache
|
||||
restartPolicy: OnFailure
|
|
@ -1,3 +1,4 @@
|
|||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- cronjob.yaml
|
||||
|
|
Loading…
Add table
Reference in a new issue