Skip to content

Commit b19880e

Browse files
committed
chore: fix globalResources in GNM (envoyproxy#6701)
Signed-off-by: zirain <[email protected]>
1 parent d8b27ab commit b19880e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

internal/gatewayapi/testdata/gateway-namespace-mode-infra-httproute.out.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,16 @@ xdsIR:
398398
accessLog:
399399
json:
400400
- path: /dev/stdout
401+
globalResources:
402+
proxyServiceCluster:
403+
name: test-ns/gateway-3
404+
settings:
405+
- metadata:
406+
name: gateway-3
407+
namespace: test-ns
408+
sectionName: "8080"
409+
name: test-ns/gateway-3
410+
protocol: TCP
401411
http:
402412
- address: 0.0.0.0
403413
externalPort: 80

internal/gatewayapi/translator_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,15 @@ func TestTranslate(t *testing.T) {
373373
} else {
374374
for _, g := range resources.Gateways {
375375
gSvc := svc
376-
// Matches proxy.ExpectedResourceHashedName()
377-
gSvc.Name = fmt.Sprintf("%s-%s", config.EnvoyPrefix, utils.GetHashedName(fmt.Sprintf("%s/%s", g.Namespace, g.Name), 48))
376+
if gatewayNamespaceMode {
377+
// In gateway namespace mode, the service name is the same as the gateway name
378+
// and the namespace is the gateway namespace.
379+
gSvc.Name = g.Name
380+
gSvc.Namespace = g.Namespace
381+
} else {
382+
gSvc.Name = fmt.Sprintf("%s-%s", config.EnvoyPrefix, utils.GetHashedName(fmt.Sprintf("%s/%s", g.Namespace, g.Name), 48))
383+
}
384+
378385
gSvc.Labels[OwningGatewayNameLabel] = g.Name
379386
gSvc.Labels[OwningGatewayNamespaceLabel] = g.Namespace
380387
gEndPtSlice := endPtSlice

0 commit comments

Comments
 (0)