From 95c8edbcbfedeb53aa09757f54588a887ed3c576 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Fri, 29 Mar 2024 20:47:29 +0100 Subject: [PATCH 1/4] fix: duplicate port translation for merged gateways Signed-off-by: Karol Szwaj --- internal/gatewayapi/listener.go | 86 +++++++++++-------- .../testdata/conflicting-policies.out.yaml | 7 -- .../merge-valid-multiple-gateways.in.yaml | 8 +- .../merge-valid-multiple-gateways.out.yaml | 52 +++++++++-- 4 files changed, 100 insertions(+), 53 deletions(-) diff --git a/internal/gatewayapi/listener.go b/internal/gatewayapi/listener.go index 4702d2a4e26..b05d8fd18eb 100644 --- a/internal/gatewayapi/listener.go +++ b/internal/gatewayapi/listener.go @@ -24,6 +24,8 @@ type ListenersTranslator interface { } func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources) { + // Infra IR proxy ports must be unique across merged gateways. + var mergedGatewayPorts []*protocolPort t.validateConflictedLayer7Listeners(gateways) t.validateConflictedLayer4Listeners(gateways, gwapiv1.TCPProtocolType, gwapiv1.TLSProtocolType) t.validateConflictedLayer4Listeners(gateways, gwapiv1.UDPProtocolType) @@ -36,7 +38,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap // to the Xds IR. for _, gateway := range gateways { // Infra IR proxy ports must be unique. - var foundPorts []*protocolPort + var gatewayPorts []*protocolPort irKey := t.getIRKey(gateway.Gateway) if resources.EnvoyProxy != nil { @@ -93,7 +95,6 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap if !isReady { continue } - // Add the listener to the Xds IR servicePort := &protocolPort{protocol: listener.Protocol, port: int32(listener.Port)} containerPort := servicePortToContainerPort(servicePort.port) @@ -120,44 +121,57 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap xdsIR[irKey].HTTP = append(xdsIR[irKey].HTTP, irListener) } - // Add the listener to the Infra IR. Infra IR ports must have a unique port number per layer-4 protocol - // (TCP or UDP). - if !containsPort(foundPorts, servicePort) { - foundPorts = append(foundPorts, servicePort) - var proto ir.ProtocolType - switch listener.Protocol { - case gwapiv1.HTTPProtocolType: - proto = ir.HTTPProtocolType - case gwapiv1.HTTPSProtocolType: - proto = ir.HTTPSProtocolType - case gwapiv1.TLSProtocolType: - proto = ir.TLSProtocolType - case gwapiv1.TCPProtocolType: - proto = ir.TCPProtocolType - case gwapiv1.UDPProtocolType: - proto = ir.UDPProtocolType - } + conflictedPorts := t.processPorts(servicePort, gatewayPorts, mergedGatewayPorts) + if !conflictedPorts { + t.processInfraIRListener(listener, infraIR, irKey, servicePort) + gatewayPorts = append(gatewayPorts, servicePort) + mergedGatewayPorts = append(mergedGatewayPorts, servicePort) + } + } + } +} +func (t *Translator) processInfraIRListener(listener *ListenerContext, infraIR InfraIRMap, irKey string, servicePort *protocolPort) { + // Add the listener to the Infra IR. Infra IR ports must have a unique port number per layer-4 protocol + // (TCP or UDP). + var proto ir.ProtocolType + switch listener.Protocol { + case gwapiv1.HTTPProtocolType: + proto = ir.HTTPProtocolType + case gwapiv1.HTTPSProtocolType: + proto = ir.HTTPSProtocolType + case gwapiv1.TLSProtocolType: + proto = ir.TLSProtocolType + case gwapiv1.TCPProtocolType: + proto = ir.TCPProtocolType + case gwapiv1.UDPProtocolType: + proto = ir.UDPProtocolType + } - infraPortName := string(listener.Name) - if t.MergeGateways { - infraPortName = irHTTPListenerName(listener) - } - infraPort := ir.ListenerPort{ - Name: infraPortName, - Protocol: proto, - ServicePort: servicePort.port, - ContainerPort: containerPort, - } + infraPortName := string(listener.Name) + if t.MergeGateways { + infraPortName = irHTTPListenerName(listener) + } + infraPort := ir.ListenerPort{ + Name: infraPortName, + Protocol: proto, + ServicePort: servicePort.port, + ContainerPort: servicePortToContainerPort(servicePort.port), + } - proxyListener := &ir.ProxyListener{ - Name: irHTTPListenerName(listener), - Ports: []ir.ListenerPort{infraPort}, - } + proxyListener := &ir.ProxyListener{ + Name: irHTTPListenerName(listener), + Ports: []ir.ListenerPort{infraPort}, + } - infraIR[irKey].Proxy.Listeners = append(infraIR[irKey].Proxy.Listeners, proxyListener) - } - } + infraIR[irKey].Proxy.Listeners = append(infraIR[irKey].Proxy.Listeners, proxyListener) +} + +func (t *Translator) processPorts(servicePort *protocolPort, gatewayPorts, mergedGatewayPorts []*protocolPort) bool { + conflictedPorts := containsPort(gatewayPorts, servicePort) + if t.MergeGateways { + conflictedPorts = containsPort(mergedGatewayPorts, servicePort) } + return conflictedPorts } func processAccessLog(envoyproxy *egv1a1.EnvoyProxy) *ir.AccessLog { diff --git a/internal/gatewayapi/testdata/conflicting-policies.out.yaml b/internal/gatewayapi/testdata/conflicting-policies.out.yaml index f8afcaee6da..d8b882d368a 100644 --- a/internal/gatewayapi/testdata/conflicting-policies.out.yaml +++ b/internal/gatewayapi/testdata/conflicting-policies.out.yaml @@ -218,13 +218,6 @@ infraIR: name: default/gateway-1/http protocol: HTTP servicePort: 80 - - address: null - name: default/mfqjpuycbgjrtdww/http - ports: - - containerPort: 10080 - name: default/mfqjpuycbgjrtdww/http - protocol: HTTP - servicePort: 80 metadata: labels: gateway.envoyproxy.io/owning-gatewayclass: envoy-gateway-class diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml index aad24f222ea..81e8ae3c976 100644 --- a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml @@ -21,6 +21,10 @@ gateways: allowedRoutes: namespaces: from: Same + - name: http-2 + hostname: company.com + port: 8888 + protocol: HTTP - apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway metadata: @@ -29,13 +33,13 @@ gateways: spec: gatewayClassName: envoy-gateway-class listeners: - - name: http-2 + - name: http-3 port: 8888 protocol: HTTP allowedRoutes: namespaces: from: Same - - name: http-3 + - name: http-4 hostname: example.com port: 8888 protocol: HTTP diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml index 1346f408115..94ab094ec2e 100644 --- a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml @@ -14,6 +14,10 @@ gateways: name: http port: 80 protocol: HTTP + - hostname: company.com + name: http-2 + port: 8888 + protocol: HTTP status: listeners: - attachedRoutes: 0 @@ -39,6 +43,29 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute + - attachedRoutes: 0 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http-2 + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute - apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway metadata: @@ -51,11 +78,11 @@ gateways: - allowedRoutes: namespaces: from: Same - name: http-2 + name: http-3 port: 8888 protocol: HTTP - hostname: example.com - name: http-3 + name: http-4 port: 8888 protocol: HTTP status: @@ -77,7 +104,7 @@ gateways: reason: ResolvedRefs status: "True" type: ResolvedRefs - name: http-2 + name: http-3 supportedKinds: - group: gateway.networking.k8s.io kind: HTTPRoute @@ -100,7 +127,7 @@ gateways: reason: ResolvedRefs status: "True" type: ResolvedRefs - name: http-3 + name: http-4 supportedKinds: - group: gateway.networking.k8s.io kind: HTTPRoute @@ -129,10 +156,10 @@ infraIR: protocol: HTTP servicePort: 80 - address: null - name: envoy-gateway/gateway-2/http-2 + name: envoy-gateway/gateway-1/http-2 ports: - containerPort: 8888 - name: envoy-gateway/gateway-2/http-2 + name: envoy-gateway/gateway-1/http-2 protocol: HTTP servicePort: 8888 metadata: @@ -154,11 +181,20 @@ xdsIR: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true port: 10080 + - address: 0.0.0.0 + hostnames: + - company.com + isHTTP2: false + name: envoy-gateway/gateway-1/http-2 + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 8888 - address: 0.0.0.0 hostnames: - '*' isHTTP2: false - name: envoy-gateway/gateway-2/http-2 + name: envoy-gateway/gateway-2/http-3 path: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true @@ -167,7 +203,7 @@ xdsIR: hostnames: - example.com isHTTP2: false - name: envoy-gateway/gateway-2/http-3 + name: envoy-gateway/gateway-2/http-4 path: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true From 81d5899f239ffd4dcb9de8b734ff473a6105c866 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Fri, 29 Mar 2024 21:46:59 +0100 Subject: [PATCH 2/4] refactor to map Signed-off-by: Karol Szwaj --- internal/gatewayapi/listener.go | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/internal/gatewayapi/listener.go b/internal/gatewayapi/listener.go index b05d8fd18eb..b41953e3183 100644 --- a/internal/gatewayapi/listener.go +++ b/internal/gatewayapi/listener.go @@ -24,8 +24,8 @@ type ListenersTranslator interface { } func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources) { - // Infra IR proxy ports must be unique across merged gateways. - var mergedGatewayPorts []*protocolPort + // Infra IR proxy ports must be unique. + mergedGatewayPorts := make(map[string][]*protocolPort) t.validateConflictedLayer7Listeners(gateways) t.validateConflictedLayer4Listeners(gateways, gwapiv1.TCPProtocolType, gwapiv1.TLSProtocolType) t.validateConflictedLayer4Listeners(gateways, gwapiv1.UDPProtocolType) @@ -37,8 +37,6 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap // and compute status for each, and add valid ones // to the Xds IR. for _, gateway := range gateways { - // Infra IR proxy ports must be unique. - var gatewayPorts []*protocolPort irKey := t.getIRKey(gateway.Gateway) if resources.EnvoyProxy != nil { @@ -121,18 +119,17 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap xdsIR[irKey].HTTP = append(xdsIR[irKey].HTTP, irListener) } - conflictedPorts := t.processPorts(servicePort, gatewayPorts, mergedGatewayPorts) - if !conflictedPorts { + // Add the listener to the Infra IR. Infra IR ports must have a unique port number per layer-4 protocol + // (TCP or UDP). + if !containsPort(mergedGatewayPorts[irKey], servicePort) { t.processInfraIRListener(listener, infraIR, irKey, servicePort) - gatewayPorts = append(gatewayPorts, servicePort) - mergedGatewayPorts = append(mergedGatewayPorts, servicePort) + mergedGatewayPorts[irKey] = append(mergedGatewayPorts[irKey], servicePort) } } } } + func (t *Translator) processInfraIRListener(listener *ListenerContext, infraIR InfraIRMap, irKey string, servicePort *protocolPort) { - // Add the listener to the Infra IR. Infra IR ports must have a unique port number per layer-4 protocol - // (TCP or UDP). var proto ir.ProtocolType switch listener.Protocol { case gwapiv1.HTTPProtocolType: @@ -166,14 +163,6 @@ func (t *Translator) processInfraIRListener(listener *ListenerContext, infraIR I infraIR[irKey].Proxy.Listeners = append(infraIR[irKey].Proxy.Listeners, proxyListener) } -func (t *Translator) processPorts(servicePort *protocolPort, gatewayPorts, mergedGatewayPorts []*protocolPort) bool { - conflictedPorts := containsPort(gatewayPorts, servicePort) - if t.MergeGateways { - conflictedPorts = containsPort(mergedGatewayPorts, servicePort) - } - return conflictedPorts -} - func processAccessLog(envoyproxy *egv1a1.EnvoyProxy) *ir.AccessLog { if envoyproxy == nil || envoyproxy.Spec.Telemetry == nil || From 4e7736065799cc9791a4fa442abaed44fb284d43 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Tue, 2 Apr 2024 13:38:21 +0200 Subject: [PATCH 3/4] rename map Signed-off-by: Karol Szwaj --- internal/gatewayapi/listener.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/gatewayapi/listener.go b/internal/gatewayapi/listener.go index b41953e3183..de94aaf27e9 100644 --- a/internal/gatewayapi/listener.go +++ b/internal/gatewayapi/listener.go @@ -25,7 +25,7 @@ type ListenersTranslator interface { func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources) { // Infra IR proxy ports must be unique. - mergedGatewayPorts := make(map[string][]*protocolPort) + foundPorts := make(map[string][]*protocolPort) t.validateConflictedLayer7Listeners(gateways) t.validateConflictedLayer4Listeners(gateways, gwapiv1.TCPProtocolType, gwapiv1.TLSProtocolType) t.validateConflictedLayer4Listeners(gateways, gwapiv1.UDPProtocolType) @@ -121,9 +121,9 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap // Add the listener to the Infra IR. Infra IR ports must have a unique port number per layer-4 protocol // (TCP or UDP). - if !containsPort(mergedGatewayPorts[irKey], servicePort) { + if !containsPort(foundPorts[irKey], servicePort) { t.processInfraIRListener(listener, infraIR, irKey, servicePort) - mergedGatewayPorts[irKey] = append(mergedGatewayPorts[irKey], servicePort) + foundPorts[irKey] = append(foundPorts[irKey], servicePort) } } } From 450dfa514ec372bfd5c13fe33fcff351bdaeb235 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Tue, 2 Apr 2024 14:41:04 +0200 Subject: [PATCH 4/4] add seperate testcase Signed-off-by: Karol Szwaj --- ...ways-multiple-listeners-same-ports.in.yaml | 45 ++++ ...ays-multiple-listeners-same-ports.out.yaml | 210 ++++++++++++++++++ .../merge-valid-multiple-gateways.in.yaml | 8 +- .../merge-valid-multiple-gateways.out.yaml | 52 +---- 4 files changed, 265 insertions(+), 50 deletions(-) create mode 100644 internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.in.yaml create mode 100755 internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.out.yaml diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.in.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.in.yaml new file mode 100644 index 00000000000..81e8ae3c976 --- /dev/null +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.in.yaml @@ -0,0 +1,45 @@ +envoyproxy: + apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: EnvoyProxy + metadata: + namespace: envoy-gateway-system + name: test + spec: + mergeGateways: true +gateways: + - apiVersion: gateway.networking.k8s.io/v1beta1 + kind: Gateway + metadata: + name: gateway-1 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http + port: 80 + protocol: HTTP + allowedRoutes: + namespaces: + from: Same + - name: http-2 + hostname: company.com + port: 8888 + protocol: HTTP + - apiVersion: gateway.networking.k8s.io/v1beta1 + kind: Gateway + metadata: + name: gateway-2 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http-3 + port: 8888 + protocol: HTTP + allowedRoutes: + namespaces: + from: Same + - name: http-4 + hostname: example.com + port: 8888 + protocol: HTTP diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.out.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.out.yaml new file mode 100755 index 00000000000..94ab094ec2e --- /dev/null +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways-multiple-listeners-same-ports.out.yaml @@ -0,0 +1,210 @@ +gateways: +- apiVersion: gateway.networking.k8s.io/v1beta1 + kind: Gateway + metadata: + creationTimestamp: null + name: gateway-1 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - allowedRoutes: + namespaces: + from: Same + name: http + port: 80 + protocol: HTTP + - hostname: company.com + name: http-2 + port: 8888 + protocol: HTTP + status: + listeners: + - attachedRoutes: 0 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute + - attachedRoutes: 0 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http-2 + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute +- apiVersion: gateway.networking.k8s.io/v1beta1 + kind: Gateway + metadata: + creationTimestamp: null + name: gateway-2 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - allowedRoutes: + namespaces: + from: Same + name: http-3 + port: 8888 + protocol: HTTP + - hostname: example.com + name: http-4 + port: 8888 + protocol: HTTP + status: + listeners: + - attachedRoutes: 0 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http-3 + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute + - attachedRoutes: 0 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http-4 + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute +infraIR: + envoy-gateway-class: + proxy: + config: + apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: EnvoyProxy + metadata: + creationTimestamp: null + name: test + namespace: envoy-gateway-system + spec: + logging: {} + mergeGateways: true + status: {} + listeners: + - address: null + name: envoy-gateway/gateway-1/http + ports: + - containerPort: 10080 + name: envoy-gateway/gateway-1/http + protocol: HTTP + servicePort: 80 + - address: null + name: envoy-gateway/gateway-1/http-2 + ports: + - containerPort: 8888 + name: envoy-gateway/gateway-1/http-2 + protocol: HTTP + servicePort: 8888 + metadata: + labels: + gateway.envoyproxy.io/owning-gatewayclass: envoy-gateway-class + name: envoy-gateway-class +xdsIR: + envoy-gateway-class: + accessLog: + text: + - path: /dev/stdout + http: + - address: 0.0.0.0 + hostnames: + - '*' + isHTTP2: false + name: envoy-gateway/gateway-1/http + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 10080 + - address: 0.0.0.0 + hostnames: + - company.com + isHTTP2: false + name: envoy-gateway/gateway-1/http-2 + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 8888 + - address: 0.0.0.0 + hostnames: + - '*' + isHTTP2: false + name: envoy-gateway/gateway-2/http-3 + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 8888 + - address: 0.0.0.0 + hostnames: + - example.com + isHTTP2: false + name: envoy-gateway/gateway-2/http-4 + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 8888 diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml index 81e8ae3c976..aad24f222ea 100644 --- a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.in.yaml @@ -21,10 +21,6 @@ gateways: allowedRoutes: namespaces: from: Same - - name: http-2 - hostname: company.com - port: 8888 - protocol: HTTP - apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway metadata: @@ -33,13 +29,13 @@ gateways: spec: gatewayClassName: envoy-gateway-class listeners: - - name: http-3 + - name: http-2 port: 8888 protocol: HTTP allowedRoutes: namespaces: from: Same - - name: http-4 + - name: http-3 hostname: example.com port: 8888 protocol: HTTP diff --git a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml index 94ab094ec2e..1346f408115 100644 --- a/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml +++ b/internal/gatewayapi/testdata/merge-valid-multiple-gateways.out.yaml @@ -14,10 +14,6 @@ gateways: name: http port: 80 protocol: HTTP - - hostname: company.com - name: http-2 - port: 8888 - protocol: HTTP status: listeners: - attachedRoutes: 0 @@ -43,29 +39,6 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - - attachedRoutes: 0 - conditions: - - lastTransitionTime: null - message: Sending translated listener configuration to the data plane - reason: Programmed - status: "True" - type: Programmed - - lastTransitionTime: null - message: Listener has been successfully translated - reason: Accepted - status: "True" - type: Accepted - - lastTransitionTime: null - message: Listener references have been resolved - reason: ResolvedRefs - status: "True" - type: ResolvedRefs - name: http-2 - supportedKinds: - - group: gateway.networking.k8s.io - kind: HTTPRoute - - group: gateway.networking.k8s.io - kind: GRPCRoute - apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway metadata: @@ -78,11 +51,11 @@ gateways: - allowedRoutes: namespaces: from: Same - name: http-3 + name: http-2 port: 8888 protocol: HTTP - hostname: example.com - name: http-4 + name: http-3 port: 8888 protocol: HTTP status: @@ -104,7 +77,7 @@ gateways: reason: ResolvedRefs status: "True" type: ResolvedRefs - name: http-3 + name: http-2 supportedKinds: - group: gateway.networking.k8s.io kind: HTTPRoute @@ -127,7 +100,7 @@ gateways: reason: ResolvedRefs status: "True" type: ResolvedRefs - name: http-4 + name: http-3 supportedKinds: - group: gateway.networking.k8s.io kind: HTTPRoute @@ -156,10 +129,10 @@ infraIR: protocol: HTTP servicePort: 80 - address: null - name: envoy-gateway/gateway-1/http-2 + name: envoy-gateway/gateway-2/http-2 ports: - containerPort: 8888 - name: envoy-gateway/gateway-1/http-2 + name: envoy-gateway/gateway-2/http-2 protocol: HTTP servicePort: 8888 metadata: @@ -181,20 +154,11 @@ xdsIR: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true port: 10080 - - address: 0.0.0.0 - hostnames: - - company.com - isHTTP2: false - name: envoy-gateway/gateway-1/http-2 - path: - escapedSlashesAction: UnescapeAndRedirect - mergeSlashes: true - port: 8888 - address: 0.0.0.0 hostnames: - '*' isHTTP2: false - name: envoy-gateway/gateway-2/http-3 + name: envoy-gateway/gateway-2/http-2 path: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true @@ -203,7 +167,7 @@ xdsIR: hostnames: - example.com isHTTP2: false - name: envoy-gateway/gateway-2/http-4 + name: envoy-gateway/gateway-2/http-3 path: escapedSlashesAction: UnescapeAndRedirect mergeSlashes: true