Skip to content

fix(gateway): support clusterIP and LoadBalancer nodePorts - #446

Open
ruanweihong-aaa wants to merge 2 commits into
api7:mainfrom
ruanweihong-aaa:fix/gateway-service-addressing
Open

ruanweihong-aaa wants to merge 2 commits into
api7:mainfrom
ruanweihong-aaa:fix/gateway-service-addressing

Conversation

@ruanweihong-aaa

@ruanweihong-aaa ruanweihong-aaa commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Mirrors apache/apisix-helm-chart#1074 for the API7 gateway chart.

  • Add optional gateway.clusterIP for ClusterIP, NodePort and LoadBalancer Services. Empty/null values retain Kubernetes allocation; None is limited to headless ClusterIP Services.
  • Honor the gateway's existing nodePort settings on LoadBalancer, including HTTP/TLS, additional listeners, PROXY Protocol, metrics and TCP/UDP. Reuse the same predicate throughout and retain stream autoAssignNodePort behavior.

Validation: 24 rendering cases pass on Helm 3.22.1 and 4.3.2; the default Service matches the base apart from its chart version label; gateway helm lint, flake8 7.3.0 --isolated, and git diff --check pass. All chart READMEs were regenerated with the Go-built helm-docs v1.13.1; only gateway documentation changes.

Cover all existing gateway listeners and stream nodePort settings.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Pre-merge checks: Passed 1 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
E2e Test Quality Review Warning Summary: The PR adds one new test file, .github/scripts/check-gateway-service.py, and wires it into the Helm chart job in .github/workflows/ci.yaml (line 67). The test is a unit-level render… Add an E2E test for the gateway Service. Required changes: 1. Install the gateway chart into the kind cluster in CI. Set gateway.type to NodePort and to LoadBalancer, and set gateway.clusterIP and fixed nodePorts. Then assert the li…
Passed Passed checks: 1 passed

Check name Status Explanation
Security Check Passed PR #446 (author ruanweihong-aaa, base main, head fix/gateway-service-addressing) changes only Helm chart templating for the gateway Service. I diffed HEAD (a8306ec) against main (f…
Full details: Security Check

Explanation

PR #446 (author ruanweihong-aaa, base main, head fix/gateway-service-addressing) changes only Helm chart templating for the gateway Service. I diffed HEAD (a8306ec) against main (f13b8ab). The changed files are charts/gateway/templates/service-gateway.yaml, charts/gateway/values.yaml, charts/gateway/Chart.yaml, charts/gateway/README.md, .github/scripts/check-gateway-service.py (a new render test), and .github/workflows/ci.yaml (one added CI step). The template adds an optional spec.clusterIP and extends the existing nodePort conditional from NodePort to NodePort or LoadBalancer. It also adds a fail when clusterIP is "None" on NodePort or LoadBalancer. The change does not touch application code, logging, serialization, credential handling, persistence, authorization, ownership checks, TLS verification, or secret references. Category review: 1. Sensitive data exposure in logs and responses: No issues found. The only new error text is a fixed string about clusterIP. 2. Secrets stored unencrypted: No issues found. No models, migrations, or persisted secrets are changed. 3. Authorization and permission bypass: No issues found. No handlers or permission checks are changed. 4. Cross-resource access and ownership: No issues found. No API resource lookups are changed. 5. TLS and cryptographic configuration: No issues found. No TLS or certificate settings are changed. 6. Resource isolation and shared resources: No issues found. No shared-resource or cascade logic is changed. 7. Secret reference resolution: No issues found. No $env:// or $secret:// fields are changed. Exposing LoadBalancer and NodePort ports is a networking behavior change. It is not one of the listed security categories, so it does not trigger a failure under this check.

Full details: E2e Test Quality Review

Explanation

Summary: The PR adds one new test file, .github/scripts/check-gateway-service.py, and wires it into the Helm chart job in .github/workflows/ci.yaml (line 67). The test is a unit-level render check. It is not an E2E test. This triggers the blocking E2E completeness criterion. Evidence: - The script defines GatewayServiceTest(unittest.TestCase). Its render() helper runs helm template on charts/gateway with --show-only templates/service-gateway.yaml and parses the output YAML (lines 43–57). - Its four tests (test_cluster_ip, test_node_ports, test_stream_auto_assignment, test_headless_service) assert on the rendered spec only (lines 59–97). None of them deploys the Service, sends traffic to a NodePort or LoadBalancer port, or reaches the gateway or etcd. The flow stops at the Helm template output. - The existing kind-based ct install jobs (ci.yaml lines 98–126) install the gateway chart. They do not exercise the new clusterIP or nodePort predicates. The PR does not modify those jobs, and no new E2E step covers the changed behavior. - No test-like files outside .github/scripts/check-gateway-service.py changed in the PR diff (f13b8ab..a8306ec touches 6 files). The PR description cites "24 rendering cases", which matches render-only validation. Criterion results: 1. E2E completeness (Blocking): FAIL. The new tests are unit-level render tests. Per the check, unit tests alone are not sufficient. 2. Scenario coverage (Important): Major gaps. Covered: None, empty, IPv4, and IPv6 clusterIP values; fixed versus auto nodePorts; headless-service error. Not covered: out-of-range or conflicting nodePort values, invalid clusterIP strings, and any runtime failure or load case. 3. Readability (Minor): Test names are short and undocumented. Dense inline dict literals (lines 25–42) have no explanatory comments. 4. Test relationships: No shared state or ordering dependency found. Pass. 5. Assertion readability: Assertions are simple assertEqual calls. Pass. 6. Real services vs mocking: The test does not mock. It uses real helm rendering. Pass. 7. Error handling: render() checks returncode and asserts stderr. Pass. 8. PR scope: The changes address the stated clusterIP and nodePort goal. No unrelated code found. Pass. 9. Concurrency: Not applicable. Pass. Note on the prior failure: The prior FAIL explanation is unavailable. This verdict rests on the current tree and diff, not on the prior run.

Resolution

Add an E2E test for the gateway Service. Required changes: 1. Install the gateway chart into the kind cluster in CI. Set gateway.type to NodePort and to LoadBalancer, and set gateway.clusterIP and fixed nodePorts. Then assert the live Service spec with kubectl get svc -o json. 2. Send traffic to at least one fixed nodePort, or verify the connection path, to confirm the Service reaches the gateway. 3. Add scenario coverage for invalid or boundary inputs. Examples: an invalid clusterIP string, a nodePort outside the valid range, and a port collision. 4. Add comments that state the purpose of each render case. Rename tests so each title states the scenario and the expected result.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@ruanweihong-aaa
ruanweihong-aaa marked this pull request as ready for review December 2, 2026 05:10

This branch has not been deployed

No deployments
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.

1 participant