Files
infrastructure/servers/legion/k8s/neuron-technologies/prod/hpa.yaml
T
Will Anderson 81c301f013 fix(neuron-prod): set neuron-marketing-hpa minReplicas to 1
Kubernetes rejects minReplicas=0 unless at least one Object or
External metric is configured. With only a Resource (CPU) metric,
the HPA is invalid:

  HorizontalPodAutoscaler.autoscaling "neuron-marketing-hpa"
  is invalid: [spec.minReplicas: Invalid value: 0: must be greater
  than or equal to 1, spec.metrics: Forbidden: must specify at
  least one Object or External metric to support scaling to zero
  replicas]

This was blocking the entire neuron-prod Argo CD sync — every
manifest in the directory had to be applied individually after
this single resource caused the multi-resource patch to fail.
The dharma NetworkPolicy applied today only because Argo retried
individually after the failure.

The file header already states "minReplicas=1 prevents unnecessary
idle waste" as the intent for this single-Legion-node period;
this brings the marketing HPA into line with the other two.
2026-05-04 16:21:01 -05:00

104 lines
2.5 KiB
YAML

---
# HorizontalPodAutoscalers for neuron-prod
# Single Legion node today — minReplicas=1 prevents unnecessary idle waste.
# When GCP GKE is live these minimums should go to 2 for HA.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: neuron-mcp-hpa
namespace: neuron-prod
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: neuron-mcp-blue
minReplicas: 1
maxReplicas: 6
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 65
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
behavior:
scaleDown:
stabilizationWindowSeconds: 300 # Don't thrash — wait 5m before scaling down
policies:
- type: Pods
value: 1
periodSeconds: 120
scaleUp:
stabilizationWindowSeconds: 30
policies:
- type: Pods
value: 2
periodSeconds: 60
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: neuron-rest-hpa
namespace: neuron-prod
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: neuron-rest
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 65
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
behavior:
scaleDown:
stabilizationWindowSeconds: 300
scaleUp:
stabilizationWindowSeconds: 30
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: neuron-marketing-hpa
namespace: neuron-prod
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: neuron-marketing
# minReplicas=1 to match the file's own convention (see header comment).
# Kubernetes only allows minReplicas=0 when at least one Object or External
# metric is configured (queue depth, custom signal, etc.); with only a
# Resource (CPU) metric, scale-to-zero is rejected and the whole HPA is
# invalid — which was blocking neuron-prod's Argo CD sync.
minReplicas: 1
maxReplicas: 8
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
behavior:
scaleDown:
stabilizationWindowSeconds: 120
scaleUp:
stabilizationWindowSeconds: 15