fix(gateway): copy allowed routes for the edge listener (#4167)

## What this PR does

Fixes #4118. The `edge` listener retained the renderer's local
`edgeAllowedRoutes` value, while `edge-apex` and child listeners already
received independent copies. Give `edge` its own `DeepCopy()` as well,
so later changes to the local value cannot reach the rendered listener.
The rendered Gateway configuration is unchanged.

The change is confined to that one assignment. Current main already
creates independent allowed-routes values for HTTPS and TLS-passthrough
listeners.

Validation: `go test ./internal/controller/tenantgateway -count=1`
passes. No new test is added, as accepted in the maintainer's review.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

The diff changes only ownership of a local allowed-routes value; API
fields, namespace selectors, route kinds, package layout and rendered
resources stay the same, so it reaches none of the downstream trigger
map's contracts.

### Release note

```release-note
fix(gateway): give the edge TenantGateway listener its own allowed-routes copy; rendered Gateway configuration is unchanged
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Fixed edge-mode gateway listeners so each retains its own
allowed-routes configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 2af1e21299
This commit is contained in:
Myasnikov Daniil committed 2026-11-25 10:49:45 +00:00
commit e13f9c6cba
1 file changed
+1 -1
@@ -1432,7 +1432,7 @@ func (r *Reconciler) renderGateway(tgw *gatewayv1alpha1.TenantGateway, dynHostna
Port: 80,
Protocol: gatewayv1.HTTPProtocolType,
Hostname: &wildcardHost,
AllowedRoutes: edgeAllowedRoutes,
AllowedRoutes: edgeAllowedRoutes.DeepCopy(),
},
gatewayv1.Listener{
Name: "edge-apex",