2025-09-27 11:18:13 +02:00
|
|
|
apiVersion: apps/v1
|
|
|
|
|
kind: Deployment
|
|
|
|
|
metadata:
|
|
|
|
|
name: alert-processor-service
|
|
|
|
|
namespace: bakery-ia
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: alert-processor-service
|
|
|
|
|
app.kubernetes.io/component: worker
|
|
|
|
|
app.kubernetes.io/part-of: bakery-ia
|
|
|
|
|
spec:
|
|
|
|
|
replicas: 2
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: alert-processor-service
|
|
|
|
|
app.kubernetes.io/component: worker
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: alert-processor-service
|
|
|
|
|
app.kubernetes.io/component: worker
|
|
|
|
|
spec:
|
2025-09-27 22:55:42 +02:00
|
|
|
initContainers:
|
2025-09-28 13:54:28 +02:00
|
|
|
- name: wait-for-database
|
|
|
|
|
image: busybox:1.36
|
|
|
|
|
command:
|
|
|
|
|
- sh
|
|
|
|
|
- -c
|
|
|
|
|
- |
|
|
|
|
|
echo "Waiting for alert processor database to be ready..."
|
|
|
|
|
until nc -z $ALERT_PROCESSOR_DB_HOST $ALERT_PROCESSOR_DB_PORT; do
|
|
|
|
|
echo "Database not ready yet, waiting..."
|
|
|
|
|
sleep 2
|
|
|
|
|
done
|
|
|
|
|
echo "Database is ready!"
|
|
|
|
|
env:
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_HOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: ALERT_PROCESSOR_DB_HOST
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_PORT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: DB_PORT
|
2025-09-27 22:55:42 +02:00
|
|
|
- name: wait-for-rabbitmq
|
|
|
|
|
image: busybox:1.36
|
|
|
|
|
command:
|
|
|
|
|
- sh
|
|
|
|
|
- -c
|
|
|
|
|
- |
|
|
|
|
|
echo "Waiting for RabbitMQ to be ready..."
|
|
|
|
|
until nc -z $RABBITMQ_HOST $RABBITMQ_PORT; do
|
|
|
|
|
echo "RabbitMQ not ready yet, waiting..."
|
|
|
|
|
sleep 2
|
|
|
|
|
done
|
|
|
|
|
echo "RabbitMQ is ready!"
|
|
|
|
|
env:
|
|
|
|
|
- name: RABBITMQ_HOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: RABBITMQ_HOST
|
|
|
|
|
- name: RABBITMQ_PORT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: RABBITMQ_PORT
|
2025-09-27 11:18:13 +02:00
|
|
|
containers:
|
|
|
|
|
- name: alert-processor-service
|
2025-09-27 22:55:42 +02:00
|
|
|
image: bakery/alert-processor:f246381-dirty
|
2025-09-27 11:18:13 +02:00
|
|
|
env:
|
|
|
|
|
- name: ENVIRONMENT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: ENVIRONMENT
|
|
|
|
|
- name: DEBUG
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: DEBUG
|
|
|
|
|
- name: LOG_LEVEL
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: LOG_LEVEL
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_HOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: ALERT_PROCESSOR_DB_HOST
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_PORT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: DB_PORT
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_NAME
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: ALERT_PROCESSOR_DB_NAME
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_USER
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: database-secrets
|
|
|
|
|
key: ALERT_PROCESSOR_DB_USER
|
|
|
|
|
- name: ALERT_PROCESSOR_DB_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: database-secrets
|
|
|
|
|
key: ALERT_PROCESSOR_DB_PASSWORD
|
|
|
|
|
- name: REDIS_HOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: REDIS_HOST
|
|
|
|
|
- name: REDIS_PORT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: REDIS_PORT
|
|
|
|
|
- name: REDIS_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: redis-secrets
|
|
|
|
|
key: REDIS_PASSWORD
|
|
|
|
|
- name: RABBITMQ_HOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: RABBITMQ_HOST
|
|
|
|
|
- name: RABBITMQ_PORT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: RABBITMQ_PORT
|
|
|
|
|
- name: RABBITMQ_USER
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: rabbitmq-secrets
|
|
|
|
|
key: RABBITMQ_USER
|
|
|
|
|
- name: RABBITMQ_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: rabbitmq-secrets
|
|
|
|
|
key: RABBITMQ_PASSWORD
|
2025-09-27 12:10:43 +02:00
|
|
|
- name: RABBITMQ_VHOST
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: RABBITMQ_VHOST
|
2025-09-27 11:18:13 +02:00
|
|
|
- name: NOTIFICATION_SERVICE_URL
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: bakery-config
|
|
|
|
|
key: NOTIFICATION_SERVICE_URL
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
2025-09-27 22:55:42 +02:00
|
|
|
memory: "128Mi"
|
|
|
|
|
cpu: "50m"
|
2025-09-27 11:18:13 +02:00
|
|
|
limits:
|
2025-09-27 22:55:42 +02:00
|
|
|
memory: "256Mi"
|
|
|
|
|
cpu: "200m"
|
|
|
|
|
readinessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
|
|
|
|
- python
|
|
|
|
|
- -c
|
|
|
|
|
- "import sys; sys.exit(0)"
|
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
|
periodSeconds: 10
|
|
|
|
|
timeoutSeconds: 5
|
|
|
|
|
failureThreshold: 3
|
|
|
|
|
livenessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
|
|
|
|
- python
|
|
|
|
|
- -c
|
|
|
|
|
- "import sys; sys.exit(0)"
|
|
|
|
|
initialDelaySeconds: 30
|
|
|
|
|
periodSeconds: 10
|
|
|
|
|
timeoutSeconds: 5
|
|
|
|
|
failureThreshold: 3
|