Draft: Fail when section ClientTrafficPolicies target shared HTTP listeners
What does this MR do?
The Webservice and KAS charts render section-scoped ClientTrafficPolicy resources when global.hosts.https is true. The Geo policy renders regardless of it. The listener protocol, however, comes from gatewayApiResources.gateway.protocol. With TLS terminated upstream of the Gateway (global.hosts.https: true and protocol: HTTP), these policies target HTTP listeners that share port 80, and Envoy Gateway rejects them:
ClientTrafficPolicy is being applied to multiple http (non https) listeners (gitlab/gitlab-gw/registry-web, gitlab/gitlab-gw/kas-web) on the same port, which is not allowed.As a result, none of their settings apply (escapedSlashesAction: KeepUnchanged, stripTrailingHostDot, HTTP/2 windows). Worse, the rejected policy still overrides the gateway-wide policy on its listener. All HTTP listeners on a port share one HTTP connection manager, so when the overridden listener comes first on the port, the gateway-wide policy applies to none of them. That happens, for example, when configureCertmanager: false removes the http-default listener. Users can't fix this today, because the Webservice policies have no opt-out.
This MR:
- Adds a
checkConfigthat reads the rendered Gateway (include (print $.Template.BasePath "/gateway.yaml")). It fails when a chart-rendered section-scoped policy (Webservicemain, Webservicegeo, KAS) targets an HTTP listener that shares its port with another HTTP listener, and the error names each affected policy and the fix. A lone HTTP listener on its port, or a Gateway not managed by the chart (gatewayRef), doesn't trigger it. - Lets
gitlab.webservice.clientTrafficPolicy.main.specand.geo.specbe set tonullto skip the policy, asgitlab.kas.clientTrafficPolicy.specalready allows. - Documents the "TLS terminated upstream of the Gateway" setup.
Upgrade impact: installs that render this configuration today will fail helm upgrade with the new error until they apply the documented values. Those installs already have rejected policies (Accepted=False), so escaped slashes are not kept and, depending on listener order, the gateway-wide policy does not apply either. Documented HTTP-only mode (hosts.https: false) is unaffected unless Geo is configured, whose policy was never gated on HTTPS. Reviewers: please weigh whether failing is preferable to a warning here.
The companion MR !5485 (merged) makes stripTrailingHostDot the gateway-wide default. The two MRs are independent and merge cleanly in either order. With both applied, the opt-out alone is enough, since the gateway-wide default then covers the trailing dot.
Related issues
Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/629584
E2E validation
GKE 1.36 (3 × e2-standard-4) with the bundled Envoy Gateway 1.9.1, global.hosts.https: true, gatewayApiResources.gateway.protocol: HTTP and global.gatewayApi.configureCertmanager: false (no http-default listener). Requests came from outside the cluster. Each was matched to Envoy's access log by user agent to read response_code_details. Expected status without a dot: gitlab 200, registry 401, kas 426.
| Build | Policies | gitlab. |
registry. |
kas. |
|---|---|---|---|---|
master |
webservice/kas CTP Accepted=False |
404 route_not_found | 404 | 404 |
master plus companion MR (gateway-wide default) |
same, gateway-wide Overridden=True |
404 route_not_found | 404 | 404 |
| This MR | helm upgrade refused with the new error; release revision unchanged |
n/a | n/a | n/a |
| This MR with documented opt-out values | only gateway-wide, Accepted=True |
200 | 401 | 426 |
| Both MRs, opt-out only (no gateway-wide values) | only gateway-wide, Accepted=True |
200 | 401 | 426 |
With configureCertmanager: true, the http-default listener comes first on port 80, and the gateway-wide policy then applies to the whole port despite the rejected section policies. That is the order dependency described above. The section policies are rejected in both cases.
Specs: spec/configuration gives the same result as master locally. The only failures are Gitaly and GitLab Shell specs, which fail identically on master because gomplate is missing on the workstation.
Author checklist
For general guidance, please follow our Contributing guide.
Required
For anything in this list which will not be completed, please provide a reason in the MR discussion.
- Merge Request Title and Description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- MR has a green pipeline.
- Documentation created/updated.
- Tests added/updated.
- Have you validated that your change works end-to-end on a real cluster deployment?
- Describe how you did it in a comment.
- Equivalent MR/issue for omnibus-gitlab opened.
- When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.
Reviewers checklist
- As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
- MR has a green pipeline on https://gitlab.com/gitlab-org/charts/gitlab.
- Consider downstream impact to the Operator, as per evaluating impact from changes to GitLab chart.