Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deployment/k8s/charts/build-bot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: build-bot
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: build-bot
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/build-bot/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
17 changes: 17 additions & 0 deletions deployment/k8s/charts/build-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@ resources:
replicaCount: 4
timer: 5000
logLevel: "DEBUG"

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 2
maxReplicas: 12
targetCPUUtilizationPercentage: 75
behavior:
scaleDown:
# 300s: build tasks are relatively short-lived and can tolerate faster scale-down
stabilizationWindowSeconds: 300
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Pods
value: 3
periodSeconds: 60
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: coverage-bot
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: coverage-bot
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/coverage-bot/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
18 changes: 18 additions & 0 deletions deployment/k8s/charts/coverage-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ resources:
requests:
cpu: 250m
memory: 256Mi

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 6
targetCPUUtilizationPercentage: 70
targetMemoryUtilizationPercentage: 75
behavior:
scaleDown:
# 600s: long-running coverage analysis should not be interrupted by premature scale-down
stabilizationWindowSeconds: 600
scaleUp:
stabilizationWindowSeconds: 120
policies:
- type: Pods
value: 1
periodSeconds: 60
2 changes: 2 additions & 0 deletions deployment/k8s/charts/fuzzer-bot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: fuzzer-bot
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: fuzzer-bot
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/fuzzer-bot/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
22 changes: 22 additions & 0 deletions deployment/k8s/charts/fuzzer-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,25 @@ healthCheck:
timeoutSeconds: 10
# Allow 2 failures before restarting
failureThreshold: 2

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 75
targetMemoryUtilizationPercentage: 80
behavior:
scaleDown:
# 300s: shorter-lived fuzzing tasks can tolerate faster scale-down
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 25
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Pods
value: 2
periodSeconds: 60
2 changes: 2 additions & 0 deletions deployment/k8s/charts/patcher/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: patcher
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: patcher
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/patcher/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
13 changes: 13 additions & 0 deletions deployment/k8s/charts/patcher/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ resources:
requests:
cpu: 200m
memory: 256Mi

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 70
behavior:
scaleDown:
# 600s: LLM-powered patching tasks are long-running and should not be interrupted
stabilizationWindowSeconds: 600
scaleUp:
stabilizationWindowSeconds: 120
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ kind: Deployment
metadata:
name: {{ .Release.Name }}-pov-reproducer
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: pov-reproducer
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/pov-reproducer/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
18 changes: 18 additions & 0 deletions deployment/k8s/charts/pov-reproducer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,21 @@ resources:
povReproducer:
sleepTime: 5.0
maxRetries: 100000

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 8
targetCPUUtilizationPercentage: 70
targetMemoryUtilizationPercentage: 75
behavior:
scaleDown:
# 300s: POV reproduction tasks are relatively short-lived
stabilizationWindowSeconds: 300
scaleUp:
stabilizationWindowSeconds: 90
policies:
- type: Pods
value: 2
periodSeconds: 60
2 changes: 2 additions & 0 deletions deployment/k8s/charts/seed-gen/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: seed-gen
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: seed-gen
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/seed-gen/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
13 changes: 13 additions & 0 deletions deployment/k8s/charts/seed-gen/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@ healthCheck:
timeoutSeconds: 10
# Allow 2 failures before restarting
failureThreshold: 2

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 4
targetCPUUtilizationPercentage: 75
behavior:
scaleDown:
# 300s: seed generation tasks are relatively short-lived
stabilizationWindowSeconds: 300
scaleUp:
stabilizationWindowSeconds: 120
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ kind: Deployment
metadata:
name: {{ .Release.Name }}-task-downloader
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: task-downloader
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/task-downloader/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
13 changes: 13 additions & 0 deletions deployment/k8s/charts/task-downloader/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ resources:
requests:
cpu: 100m
memory: 256Mi

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 3
targetCPUUtilizationPercentage: 80
behavior:
scaleDown:
# 300s: download tasks are short-lived and can tolerate faster scale-down
stabilizationWindowSeconds: 300
scaleUp:
stabilizationWindowSeconds: 180
2 changes: 2 additions & 0 deletions deployment/k8s/charts/tracer-bot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ metadata:
labels:
app: tracer-bot
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
app: tracer-bot
Expand Down
1 change: 1 addition & 0 deletions deployment/k8s/charts/tracer-bot/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "buttercup.hpa" . }}
14 changes: 14 additions & 0 deletions deployment/k8s/charts/tracer-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ healthCheck:
timeoutSeconds: 10
# Allow 2 failures before restarting
failureThreshold: 2

# Autoscaling configuration
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 6
targetCPUUtilizationPercentage: 75
targetMemoryUtilizationPercentage: 80
behavior:
scaleDown:
# 600s: long-running trace analysis should not be interrupted by premature scale-down
stabilizationWindowSeconds: 600
scaleUp:
stabilizationWindowSeconds: 120
42 changes: 42 additions & 0 deletions deployment/k8s/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,45 @@ Usage: {{- include "buttercup.apiKeySecretVolume" (dict "secretName" "litellm-ap
secret:
secretName: {{ .secretName }}
{{- end -}}

{{/*
Define a shared HorizontalPodAutoscaler template for all services.
Uses .Chart.Name to dynamically resolve the service name from each subchart.
Usage (in subchart's hpa.yaml): {{ include "buttercup.hpa" . }}
*/}}
{{- define "buttercup.hpa" -}}
{{- if and .Values.enabled .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-{{ .Chart.Name }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
12 changes: 12 additions & 0 deletions deployment/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ volumes:
size: "1Gi"
accessMode: ReadWriteOnce

# Autoscaling Configuration
# Each service can enable HPA by setting autoscaling.enabled=true in its values
# Example:
# fuzzer-bot:
# autoscaling:
# enabled: true
# minReplicas: 1
# maxReplicas: 10
# Prerequisites:
# - metrics-server must be installed in the cluster
# - For Minikube: minikube addons enable metrics-server
# - For AKS: metrics-server is pre-installed

# Dind daemon chart configuration
dind-daemon:
Expand Down