prop/k8s/hpa.yaml
Graham McIntire 93dd20f830
ops(prop): pin HPA to 1 replica
Set minReplicas == maxReplicas == 1 on the `prop` HPA so the cluster
runs exactly one app pod. HPA still owns the replica count (Flux
ignores spec.replicas on the Deployment), so this is the right knob —
no need to touch deployment.yaml. Restore autoscaling by raising both
bounds together.
2026-04-29 09:55:46 -05:00

128 lines
3.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Horizontal pod autoscalers for the three load-responsive Deployments.
# prop-backfill is deliberately excluded — it's a single-replica catch-up
# worker that's bottlenecked on IEM rate-limit waits rather than CPU, so
# scaling by CPU would just add idle replicas parked on 429 backoffs.
#
# CPU targets use AverageValue (absolute cores) rather than Utilization
# (% of request) so the scale-up thresholds don't depend on the request
# number. Request fields in the Deployments can be tuned independently
# for scheduler bin-packing without accidentally changing when HPA
# decides to add a replica.
#
# The corresponding Deployments have their `spec.replicas` removed so
# Flux's periodic reconcile doesn't fight HPA's live scaling.
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: prop
namespace: prop
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: prop
# Pinned at 1 pod (min == max). HPA still owns the replica count so
# Flux reconcile stays out of the way; raise both bounds together to
# restore autoscaling.
minReplicas: 1
maxReplicas: 1
metrics:
- type: Resource
resource:
name: cpu
target:
# Average of 800m across pods triggers scale-up. The hourly
# :05 propagation chain + ScoreCache warming on one pod can
# peak near 2 cores — averaging across 23 replicas keeps the
# threshold meaningful without flapping on every cron tick.
type: AverageValue
averageValue: 800m
behavior:
scaleUp:
# React quickly to sudden surges (LiveView + propagation chain
# can coincide). Add up to 2 pods or 100% of current replica
# count per 30 s window, whichever is larger.
stabilizationWindowSeconds: 30
policies:
- type: Pods
value: 2
periodSeconds: 30
- type: Percent
value: 100
periodSeconds: 30
selectPolicy: Max
scaleDown:
# Slower scale-down so the hourly chain doesn't immediately
# trigger a churn of terminations five minutes later.
stabilizationWindowSeconds: 600
policies:
- type: Pods
value: 1
periodSeconds: 120
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: prop-grid-rs
namespace: prop
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: prop-grid-rs
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: 400m
behavior:
scaleUp:
stabilizationWindowSeconds: 30
policies:
- type: Pods
value: 1
periodSeconds: 30
scaleDown:
stabilizationWindowSeconds: 600
policies:
- type: Pods
value: 1
periodSeconds: 120
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: hrrr-point-rs
namespace: prop
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: hrrr-point-rs
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: 400m
behavior:
scaleUp:
stabilizationWindowSeconds: 30
policies:
- type: Pods
value: 1
periodSeconds: 30
scaleDown:
stabilizationWindowSeconds: 600
policies:
- type: Pods
value: 1
periodSeconds: 120