Add DEMO feature to the project
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: demo-session-cleanup
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-cleanup
|
||||
component: maintenance
|
||||
spec:
|
||||
schedule: "0 * * * *" # Every hour
|
||||
timeZone: "Europe/Madrid"
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 3
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-cleanup
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-cleanup
|
||||
spec:
|
||||
containers:
|
||||
- name: cleanup
|
||||
image: bakery/demo-session-service:latest
|
||||
command:
|
||||
- python
|
||||
- -c
|
||||
- |
|
||||
import asyncio
|
||||
import httpx
|
||||
async def cleanup():
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post("http://demo-session-service:8000/api/demo/cleanup/run")
|
||||
print(response.json())
|
||||
asyncio.run(cleanup())
|
||||
env:
|
||||
- name: DEMO_SESSION_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: DEMO_SESSION_DATABASE_URL
|
||||
- name: REDIS_URL
|
||||
value: "redis://redis-service:6379/0"
|
||||
- name: LOG_LEVEL
|
||||
value: "INFO"
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
restartPolicy: OnFailure
|
||||
Reference in New Issue
Block a user