Skip to content

implement gateway health check - #3000

Merged
Krishanx92 merged 1 commit into
wso2:mainfrom
tharindu1st:health-check
Jul 30, 2026
Merged

implement gateway health check#3000
Krishanx92 merged 1 commit into
wso2:mainfrom
tharindu1st:health-check

Conversation

@tharindu1st

Copy link
Copy Markdown
Contributor

implement gateway health check

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tharindu1st, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c9b2c367-d507-4ff8-95fa-40671d543c71

📥 Commits

Reviewing files that changed from the base of the PR and between 05b18ad and 4fea1ce.

📒 Files selected for processing (10)
  • gateway/gateway-controller/pkg/config/api_validator.go
  • gateway/gateway-controller/pkg/config/api_validator_test.go
  • gateway/gateway-controller/pkg/config/llm_validator.go
  • gateway/gateway-controller/pkg/config/llm_validator_test.go
  • gateway/gateway-controller/pkg/config/mcp_validator.go
  • gateway/gateway-controller/pkg/config/mcp_validator_test.go
  • gateway/gateway-controller/pkg/config/validator.go
  • gateway/gateway-controller/pkg/constants/constants.go
  • gateway/gateway-controller/pkg/xds/translator.go
  • gateway/gateway-controller/pkg/xds/translator_test.go
📝 Walkthrough

Walkthrough

Gateway health endpoints are defined, exposed as Envoy direct-response routes, and protected from API and LLM configuration conflicts. Path normalization and validation tests were added, and four gateway policy manifest versions were updated.

Changes

Gateway health endpoints

Layer / File(s) Summary
Reserved health path contract and validation
gateway/gateway-controller/pkg/constants/constants.go, gateway/gateway-controller/pkg/config/{validator.go,api_validator.go,llm_validator.go}
Defines reserved health paths and validates API operation routes and LLM contexts against the reserved namespace.
Reserved path validation coverage
gateway/gateway-controller/pkg/config/{api_validator_test.go,llm_validator_test.go}
Adds cases for reserved, combined, unrelated, nil, and dot-segment contexts.
Envoy health route translation and path normalization
gateway/gateway-controller/pkg/xds/{translator.go,translator_test.go}
Adds ready and healthy direct-response routes to every virtual host, disables policy processing for them, enables canonical request paths, and verifies route ordering and listener settings.

Policy manifest versions

Layer / File(s) Summary
Gateway policy version updates
gateway/build-manifest.yaml
Updates versions for four gateway policies while retaining their gomodule references.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GatewayController
  participant Envoy
  participant HealthClient
  GatewayController->>Envoy: Configure normalized routing and health direct-response routes
  HealthClient->>Envoy: Request gateway health path
  Envoy-->>HealthClient: Return static JSON health response
Loading

Possibly related PRs

  • wso2/api-platform#2822: Adds overlapping HTTP connection manager path normalization and escaped-slash handling.

Suggested reviewers: renuka-fernando, malinthaprasan, piumal1999, induwara04, krishanx92

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only a one-line summary and misses all required template sections like Purpose, Goals, Approach, and tests. Expand the description to fill the required template sections, including purpose, goals, approach, tests, security checks, and related links.
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change and matches the implemented gateway health 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.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch health-check
🧪 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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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 `@gateway/gateway-controller/pkg/config/validator.go`:
- Around line 44-51: Update validateNotReservedHealthPath to canonicalize
resourcePath, or reject dot-segment paths, before comparing it with
constants.GatewayHealthPathPrefix so paths such as /foo/../_gateway-health/ready
are detected. Ensure every generated Envoy HttpConnectionManager sets
NormalizePath: true, and add regression coverage for both REST and LLM routes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fa7e727d-1249-40fc-a652-74c1c2815912

📥 Commits

Reviewing files that changed from the base of the PR and between 41672fe and 0e2d5a7.

📒 Files selected for processing (9)
  • gateway/build-manifest.yaml
  • gateway/gateway-controller/pkg/config/api_validator.go
  • gateway/gateway-controller/pkg/config/api_validator_test.go
  • gateway/gateway-controller/pkg/config/llm_validator.go
  • gateway/gateway-controller/pkg/config/llm_validator_test.go
  • gateway/gateway-controller/pkg/config/validator.go
  • gateway/gateway-controller/pkg/constants/constants.go
  • gateway/gateway-controller/pkg/xds/translator.go
  • gateway/gateway-controller/pkg/xds/translator_test.go

Comment thread gateway/gateway-controller/pkg/config/validator.go
Krishanx92
Krishanx92 previously approved these changes Jul 30, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

🤖 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 `@gateway/build-manifest.yaml`:
- Line 49: Update every affected policies[].version entry in the manifest,
including the entries near the visible version and the additional referenced
entries, to use major-only versions such as v1 instead of full semver values.
Preserve the existing policy mappings and change only the version format
required by gateway-controller.

In `@gateway/gateway-controller/pkg/config/validator.go`:
- Around line 45-63: Update validateNotReservedHealthPath so the reserved-prefix
comparison is path-boundary safe: reject only canonical paths equal to
constants.GatewayHealthPathPrefix or beginning with that prefix followed by “/”.
Continue allowing similarly named paths such as “/_gateway-healthy” and
“/_gateway-health-metrics”, and add a regression test for one such sibling path.
- Around line 37-44: Update MCP validation to call validateNotReservedHealthPath
for spec.context, matching the existing REST and LLM validation paths. Ensure
contexts under constants.GatewayHealthPathPrefix are rejected before they are
joined with route matchers, while preserving existing MCP validation behavior
for non-reserved contexts.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 32b939cd-6ec9-470b-af72-936d5b97552c

📥 Commits

Reviewing files that changed from the base of the PR and between 0e2d5a7 and 05b18ad.

📒 Files selected for processing (9)
  • gateway/build-manifest.yaml
  • gateway/gateway-controller/pkg/config/api_validator.go
  • gateway/gateway-controller/pkg/config/api_validator_test.go
  • gateway/gateway-controller/pkg/config/llm_validator.go
  • gateway/gateway-controller/pkg/config/llm_validator_test.go
  • gateway/gateway-controller/pkg/config/validator.go
  • gateway/gateway-controller/pkg/constants/constants.go
  • gateway/gateway-controller/pkg/xds/translator.go
  • gateway/gateway-controller/pkg/xds/translator_test.go

Comment thread gateway/gateway-controller/pkg/config/validator.go
Comment thread gateway/gateway-controller/pkg/config/validator.go

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

🤖 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 `@gateway/build-manifest.yaml`:
- Line 49: Update every affected policies[].version entry in the manifest,
including the entries near the visible version and the additional referenced
entries, to use major-only versions such as v1 instead of full semver values.
Preserve the existing policy mappings and change only the version format
required by gateway-controller.

In `@gateway/gateway-controller/pkg/config/validator.go`:
- Around line 45-63: Update validateNotReservedHealthPath so the reserved-prefix
comparison is path-boundary safe: reject only canonical paths equal to
constants.GatewayHealthPathPrefix or beginning with that prefix followed by “/”.
Continue allowing similarly named paths such as “/_gateway-healthy” and
“/_gateway-health-metrics”, and add a regression test for one such sibling path.
- Around line 37-44: Update MCP validation to call validateNotReservedHealthPath
for spec.context, matching the existing REST and LLM validation paths. Ensure
contexts under constants.GatewayHealthPathPrefix are rejected before they are
joined with route matchers, while preserving existing MCP validation behavior
for non-reserved contexts.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 32b939cd-6ec9-470b-af72-936d5b97552c

📥 Commits

Reviewing files that changed from the base of the PR and between 0e2d5a7 and 05b18ad.

📒 Files selected for processing (9)
  • gateway/build-manifest.yaml
  • gateway/gateway-controller/pkg/config/api_validator.go
  • gateway/gateway-controller/pkg/config/api_validator_test.go
  • gateway/gateway-controller/pkg/config/llm_validator.go
  • gateway/gateway-controller/pkg/config/llm_validator_test.go
  • gateway/gateway-controller/pkg/config/validator.go
  • gateway/gateway-controller/pkg/constants/constants.go
  • gateway/gateway-controller/pkg/xds/translator.go
  • gateway/gateway-controller/pkg/xds/translator_test.go
🛑 Comments failed to post (1)
gateway/build-manifest.yaml (1)

49-49: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use major-only policy versions in the manifest.

These updated entries still use full semver (v1.0.3/v1.1.0), but gateway-controller requires policies[].version to be major-only (for example, v1) and rejects full semver during policy resolution.

Proposed fix
-      version: v1.0.3
+      version: v1
...
-      version: v1.1.0
+      version: v1
...
-      version: v1.1.0
+      version: v1
...
-      version: v1.1.0
+      version: v1

Also applies to: 55-55, 79-79, 82-82

🤖 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 `@gateway/build-manifest.yaml` at line 49, Update every affected
policies[].version entry in the manifest, including the entries near the visible
version and the additional referenced entries, to use major-only versions such
as v1 instead of full semver values. Preserve the existing policy mappings and
change only the version format required by gateway-controller.

@Krishanx92
Krishanx92 merged commit c00df54 into wso2:main Jul 30, 2026
12 checks passed
This was referenced Jul 31, 2026
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