Skip to content

Add Horizontal Pod Autoscaler and Pod Disruption Budget support for gateway and gateway runtime in Helm chart#1991

Merged
Thushani-Jayasekera merged 2 commits into
wso2:mainfrom
Thushani-Jayasekera:documentation
May 20, 2026
Merged

Add Horizontal Pod Autoscaler and Pod Disruption Budget support for gateway and gateway runtime in Helm chart#1991
Thushani-Jayasekera merged 2 commits into
wso2:mainfrom
Thushani-Jayasekera:documentation

Conversation

@Thushani-Jayasekera
Copy link
Copy Markdown
Contributor

@Thushani-Jayasekera Thushani-Jayasekera commented May 20, 2026

Purpose

$subject

#1987

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

Warning

Rate limit exceeded

@Thushani-Jayasekera has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 33 minutes and 26 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc64e49c-04f2-45ad-8f62-40d3a578d5a2

📥 Commits

Reviewing files that changed from the base of the PR and between 0558dbb and b040c0d.

📒 Files selected for processing (4)
  • kubernetes/helm/gateway-helm-chart/templates/gateway/controller/hpa.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/controller/pdb.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/hpa.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/pdb.yaml
📝 Walkthrough

Walkthrough

This 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 spec.replicas field in their deployment manifests when HPA is enabled, delegating replica management to the autoscaler.

Suggested reviewers

  • RakhithaRR
  • Tharsanan1
  • VirajSalaka
  • tharindu1st
  • malinthaprasan
  • AnuGayan
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required sections including Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment. Complete the pull request description following the template: add Goals, Approach, User stories, Documentation links, test coverage details, security verification, and test environment information.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main changes: adding HPA and PDB support for gateway and gateway-runtime components in the Helm chart.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 76b4fa4 and 0558dbb.

📒 Files selected for processing (7)
  • kubernetes/helm/gateway-helm-chart/templates/gateway/controller/deployment.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/controller/hpa.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/controller/pdb.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/deployment.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/hpa.yaml
  • kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/pdb.yaml
  • kubernetes/helm/gateway-helm-chart/values.yaml

@Thushani-Jayasekera Thushani-Jayasekera merged commit 4d93f0a into wso2:main May 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants