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
18 changes: 18 additions & 0 deletions helm/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.pdb.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "app.fullname" . }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- else }}
minAvailable: {{ .Values.pdb.minAvailable | default 1 }}
Comment on lines +10 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve explicit zero values in PDB configuration.

Helm treats numeric 0 as false/empty here, so maxUnavailable: 0 falls through to minAvailable, while minAvailable: 0 is replaced by the default 1. Both are valid Kubernetes settings and have different disruption semantics. Use key-presence/null checks instead of truthiness and default for these fields. (kubernetes.io)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/templates/pdb.yaml` around lines 10 - 13, Update the PDB template’s
maxUnavailable/minAvailable selection to use explicit key-presence or null
checks rather than truthiness and the default function, so configured zero
values are preserved and only an absent value falls back to minAvailable’s
intended default.

{{- end }}
selector:
matchLabels:
{{- include "app.selectorLabels" . | nindent 6 }}
{{- end }}
18 changes: 18 additions & 0 deletions helm/templates/scaling-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.keda.enabled }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ include "app.fullname" . }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
scaleTargetRef:
name: {{ include "app.fullname" . }}
minReplicaCount: {{ .Values.keda.minReplicaCount }}
maxReplicaCount: {{ .Values.keda.maxReplicaCount }}
pollingInterval: {{ .Values.keda.pollingInterval }}
cooldownPeriod: {{ .Values.keda.cooldownPeriod }}
triggers:
{{- toYaml .Values.keda.triggers | nindent 4 }}
{{- end }}
18 changes: 18 additions & 0 deletions helm/values-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Production-specific value overrides.

pdb:
enabled: true
minAvailable: 1

keda:
enabled: true
# LLM hub proxy — CPU under-reads long inference calls
minReplicaCount: 2
maxReplicaCount: 10
pollingInterval: 15
cooldownPeriod: 600
triggers:
- type: cpu
metricType: Utilization
metadata:
value: "70"
14 changes: 14 additions & 0 deletions helm/values-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Staging-specific value overrides.

keda:
enabled: true
# LLM hub proxy — CPU under-reads long inference calls
minReplicaCount: 1
maxReplicaCount: 4
pollingInterval: 30
cooldownPeriod: 300
triggers:
- type: cpu
metricType: Utilization
metadata:
value: "70"
Comment on lines +5 to +14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== files ==\n'
git ls-files helm | sed -n '1,120p'

printf '\n== ast outline values-staging.yaml ==\n'
ast-grep outline helm/values-staging.yaml --view expanded || true

printf '\n== ast outline values-production.yaml ==\n'
ast-grep outline helm/values-production.yaml --view expanded || true

printf '\n== relevant autoscaling references ==\n'
rg -n "minReplicaCount|maxReplicaCount|pollingInterval|cooldownPeriod|triggers|type: cpu|metricType: Utilization|ScaledObject|autoscal" helm -S

Repository: traceloop/hub

Length of output: 2045


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== helm/values.yaml relevant section ==\n'
sed -n '60,110p' helm/values.yaml | cat -n

printf '\n== helm/templates/scaling-object.yaml ==\n'
sed -n '1,80p' helm/templates/scaling-object.yaml | cat -n

printf '\n== staging values ==\n'
sed -n '1,40p' helm/values-staging.yaml | cat -n

printf '\n== production values ==\n'
sed -n '1,50p' helm/values-production.yaml | cat -n

Repository: traceloop/hub

Length of output: 3377


Use a demand-based KEDA trigger instead of CPU-only scaling.

Both helm/values-staging.yaml and helm/values-production.yaml enable KEDA with only a CPU utilization trigger, but the config itself notes that CPU under-reads long inference calls. Add a request/queue/concurrency metric, or document why CPU alone is sufficient.

📍 Affects 2 files
  • helm/values-staging.yaml#L5-L14 (this comment)
  • helm/values-production.yaml#L9-L18
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/values-staging.yaml` around lines 5 - 14, Replace the CPU-only KEDA
triggers with demand-based scaling by adding an appropriate request, queue, or
concurrency metric in helm/values-staging.yaml lines 5-14 and
helm/values-production.yaml lines 9-18; retain CPU only if it remains needed,
and ensure both environments use the corresponding demand metric configuration.

10 changes: 10 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ tolerations: []

affinity: {}

# KEDA autoscaling (ScaledObject). Disabled by default; enable and configure
# per-environment via values-<environment>.yaml.
keda:
enabled: false

# PodDisruptionBudget. Disabled by default; enable per-environment in values-*.yaml.
pdb:
enabled: false
minAvailable: 1

# Environment variables to pass to the hub container
env: []
# - name: DEBUG
Expand Down
Loading