Add Horizontal Pod Autoscaler and Pod Disruption Budget support for gateway and gateway runtime in Helm chart#1991
Conversation
…ateway and gateway runtime in Helm chart
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis pull request adds horizontal pod autoscaling and pod disruption budget support to the gateway Helm chart for both the controller and gateway-runtime components. Configuration values for HPA settings (replica bounds, CPU/memory utilization targets, optional custom metrics, and behavior) and PDB settings (minAvailable/maxUnavailable) are defined. The controller HPA template includes validation to require postgres storage, preventing multi-replica scaling with SQLite. Both components conditionally suppress the Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with 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.
Inline comments:
In `@kubernetes/helm/gateway-helm-chart/templates/gateway/controller/hpa.yaml`:
- Around line 20-39: Wrap the entire metrics block so it only renders when at
least one metric source is present: add a guard that checks if
$hpa.targetCPUUtilizationPercentage or $hpa.targetMemoryUtilizationPercentage or
$hpa.customMetrics is set before emitting the top-level "metrics:" and its
contents; update both HPA templates that currently emit an unconditional
"metrics:" line and conditional entries (referencing the existing
$hpa.targetCPUUtilizationPercentage, $hpa.targetMemoryUtilizationPercentage, and
$hpa.customMetrics symbols) so the "metrics:" key is omitted entirely when none
of those are provided.
In `@kubernetes/helm/gateway-helm-chart/templates/gateway/controller/pdb.yaml`:
- Around line 14-18: The PDB template currently prefers minAvailable when both
$pdb.minAvailable and $pdb.maxUnavailable are set and allows neither, producing
invalid manifests; add a Helm validation block before emitting the field that
uses the fail function to reject configurations where both are set or both are
empty (e.g. if and $pdb.minAvailable $pdb.maxUnavailable then fail "only one of
minAvailable or maxUnavailable may be set", and if not (or $pdb.minAvailable
$pdb.maxUnavailable) then fail "one of minAvailable or maxUnavailable must be
set"); keep the existing conditional rendering of minAvailable/maxUnavailable
but add the same validation to the other PDB template (the gateway-runtime pdb)
so both templates enforce exactly one field.
In
`@kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/hpa.yaml`:
- Around line 17-36: The template always emits an empty "metrics:" key; wrap the
whole metrics block in a conditional that only renders when at least one metric
is configured (check $hpa.targetCPUUtilizationPercentage,
$hpa.targetMemoryUtilizationPercentage, or $hpa.customMetrics). Replace the
current unguarded "metrics:" and its contents with an outer Helm conditional
(e.g. {{- if or $hpa.targetCPUUtilizationPercentage
$hpa.targetMemoryUtilizationPercentage $hpa.customMetrics }} ... {{- end }}) so
the "metrics:" key is omitted entirely when none of those values are provided.
In
`@kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/pdb.yaml`:
- Around line 14-18: The PodDisruptionBudget template uses a conditional that
silently prefers minAvailable over maxUnavailable and allows neither, which can
yield invalid PDBs; update the template logic around the $pdb object to enforce
one-of semantics: add explicit checks that fail template rendering (using the
Helm fail function or required/requiredIf pattern) when both $pdb.minAvailable
and $pdb.maxUnavailable are set or when neither is set, and only render
minAvailable or maxUnavailable when exactly one is provided; apply the identical
change to the controller PDB template that uses the same $pdb.minAvailable /
$pdb.maxUnavailable variables.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c352ac1f-96a0-43f0-8938-b503675c2753
📒 Files selected for processing (7)
kubernetes/helm/gateway-helm-chart/templates/gateway/controller/deployment.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/hpa.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/pdb.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/deployment.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/hpa.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/pdb.yamlkubernetes/helm/gateway-helm-chart/values.yaml
…untime Helm charts
Purpose
$subject
#1987