This commit is contained in:
Tour
2025-12-03 19:03:03 +01:00
parent 4c32043e5f
commit 8e06e20b70
12 changed files with 2232 additions and 76 deletions

197
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,197 @@
apiVersion: v1
kind: Namespace
metadata:
name: auction-monitor
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: auction-data-pvc
namespace: auction-monitor
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: auction-config
namespace: auction-monitor
data:
AUCTION_DATABASE_PATH: "/data/cache.db"
AUCTION_IMAGES_PATH: "/data/images"
AUCTION_NOTIFICATION_CONFIG: "desktop"
QUARKUS_HTTP_PORT: "8081"
QUARKUS_HTTP_HOST: "0.0.0.0"
# Workflow schedules (cron expressions)
AUCTION_WORKFLOW_SCRAPER_IMPORT_CRON: "0 */30 * * * ?"
AUCTION_WORKFLOW_IMAGE_PROCESSING_CRON: "0 0 * * * ?"
AUCTION_WORKFLOW_BID_MONITORING_CRON: "0 */15 * * * ?"
AUCTION_WORKFLOW_CLOSING_ALERTS_CRON: "0 */5 * * * ?"
---
apiVersion: v1
kind: Secret
metadata:
name: auction-secrets
namespace: auction-monitor
type: Opaque
stringData:
# Replace with your actual SMTP configuration
notification-config: "desktop"
# For email: smtp:your@gmail.com:app_password:recipient@example.com
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: auction-monitor
namespace: auction-monitor
labels:
app: auction-monitor
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: auction-monitor
template:
metadata:
labels:
app: auction-monitor
version: v1
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8081"
prometheus.io/path: "/q/metrics"
spec:
containers:
- name: auction-monitor
image: auction-monitor:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8081
protocol: TCP
env:
- name: JAVA_OPTS
value: "-Xmx256m -XX:+UseParallelGC"
envFrom:
- configMapRef:
name: auction-config
- secretRef:
name: auction-secrets
volumeMounts:
- name: data
mountPath: /data
- name: models
mountPath: /app/models
readOnly: true
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health/live
port: 8081
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /health/ready
port: 8081
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
startupProbe:
httpGet:
path: /health/started
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 30
volumes:
- name: data
persistentVolumeClaim:
claimName: auction-data-pvc
- name: models
emptyDir: {} # Or mount from ConfigMap/PVC if you have YOLO models
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: auction-monitor
namespace: auction-monitor
labels:
app: auction-monitor
spec:
type: ClusterIP
ports:
- port: 8081
targetPort: 8081
protocol: TCP
name: http
selector:
app: auction-monitor
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: auction-monitor-ingress
namespace: auction-monitor
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
ingressClassName: nginx
tls:
- hosts:
- auction-monitor.yourdomain.com
secretName: auction-monitor-tls
rules:
- host: auction-monitor.yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: auction-monitor
port:
number: 8081
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: auction-monitor-hpa
namespace: auction-monitor
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: auction-monitor
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80