Files
Bruno GaoandQwen-Coder a6a016e5ea feat: Batch 9 - Actuator security, metrics, cache resilience and K8s deployments
- Implement dual-tier security with ActuatorSecurityConfig having higher priority
- Add metrics collection for order creation with tenant tagging
- Enhance cache resilience with graceful error handling
- Create custom Redis ping health indicator
- Add comprehensive K8s deployment manifests with Kustomize overlays
- Update OrderController to align with Batch 8 AppService methods
- Configure management endpoints with separate port in production
- Add deployment scripts for image tag updates

Co-authored-by: Qwen-Coder <[email protected]>
2026-02-12 19:22:08 +08:00

67 lines
2.0 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: tmpl-api
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: tmpl-api
template:
metadata:
labels:
app.kubernetes.io/name: tmpl-api
annotations:
# 原生 Prometheus 部署使用以下 annotations。
# 如使用 Prometheus Operator,建议改为 ServiceMonitor CRD 并删除这些 annotations。
# 参考: https://prometheus-operator.dev/docs/api-reference/api/#monitoring.coreos.com/v1.ServiceMonitor
prometheus.io/scrape: "true"
prometheus.io/port: "9090"
prometheus.io/path: "/actuator/prometheus"
spec:
containers:
- name: tmpl-api
image: tmpl-api:latest
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: management
containerPort: 9090
protocol: TCP
env:
- name: JAVA_OPTS
value: "-XX:MaxRAMPercentage=75.0 -XX:+UseG1GC"
envFrom:
- configMapRef:
name: tmpl-api-config
- secretRef:
name: tmpl-api-secret
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: management
initialDelaySeconds: 15
periodSeconds: 10
failureThreshold: 3
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: management
initialDelaySeconds: 30
periodSeconds: 15
failureThreshold: 3
startupProbe:
httpGet:
path: /actuator/health/liveness
port: management
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 12
resources:
requests:
cpu: 200m
memory: 384Mi
limits:
cpu: "1"
memory: 768Mi