2026-08-17 13:40:09 +03:00

116 lines
2.7 KiB
YAML

# Production replica policy expressed as HorizontalPodAutoscalers.
#
# The stateless services (api, gateway, artifact) and the worker pool scale on
# CPU utilisation. The scheduler is deliberately excluded: it is a singleton by
# design (a second active scheduler could double-lease jobs), so it keeps the
# base `replicas: 1` and the Recreate strategy. Worker scaling absorbs discovery
# demand; the scheduler simply keeps more jobs in the leasable state.
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api
labels:
app.kubernetes.io/name: api
app.kubernetes.io/component: control-plane
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api
minReplicas: 3
maxReplicas: 12
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
behavior:
scaleDown:
stabilizationWindowSeconds: 300
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: gateway
labels:
app.kubernetes.io/name: gateway
app.kubernetes.io/component: edge
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: gateway
minReplicas: 3
maxReplicas: 12
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
behavior:
scaleDown:
stabilizationWindowSeconds: 300
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: worker
labels:
app.kubernetes.io/name: worker
app.kubernetes.io/component: compute
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: worker
minReplicas: 3
maxReplicas: 50
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
behavior:
scaleUp:
# Discovery jobs are bursty; scale out quickly to drain the queue.
stabilizationWindowSeconds: 30
policies:
- type: Percent
value: 100
periodSeconds: 60
scaleDown:
# Scale in slowly so long-running searches are not evicted needlessly.
stabilizationWindowSeconds: 600
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: artifact
labels:
app.kubernetes.io/name: artifact
app.kubernetes.io/component: storage
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: artifact
minReplicas: 2
maxReplicas: 8
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
behavior:
scaleDown:
stabilizationWindowSeconds: 300