diff --git a/internal/dag/builder_test.go b/internal/dag/builder_test.go index 70f9ee3ed0f..882ae4588d7 100644 --- a/internal/dag/builder_test.go +++ b/internal/dag/builder_test.go @@ -266,6 +266,14 @@ func TestDAGInsertGatewayAPI(t *testing.T) { }, }}, }, + Status: gatewayapi_v1.GatewayStatus{ + Addresses: []gatewayapi_v1.GatewayStatusAddress{ + { + Type: ptr.To(gatewayapi_v1.IPAddressType), + Value: "1.2.3.5", + }, + }, + }, } gatewayTLSPassthroughAllNamespaces := &gatewayapi_v1.Gateway{ diff --git a/internal/dag/gatewayapi_processor.go b/internal/dag/gatewayapi_processor.go index 96bc3c61103..64a80ce4757 100644 --- a/internal/dag/gatewayapi_processor.go +++ b/internal/dag/gatewayapi_processor.go @@ -413,7 +413,9 @@ func (l *listenerInfo) AllowsKind(kind gatewayapi_v1.Kind) bool { // isAddressAssigned returns true if either there are no addresses requested in specAddresses, // or if at least one address from specAddresses appears in statusAddresses. func isAddressAssigned(specAddresses []gatewayapi_v1.GatewayAddress, statusAddresses []gatewayapi_v1.GatewayStatusAddress) bool { - if len(specAddresses) == 0 { + // 1. no addresses requested in specAddresses + // 2. at least one address in specAddresses but no address in statusAddresses at the moment. + if len(specAddresses) == 0 || len(statusAddresses) == 0 { return true } diff --git a/internal/dag/status_test.go b/internal/dag/status_test.go index cefc5a79836..6878f675719 100644 --- a/internal/dag/status_test.go +++ b/internal/dag/status_test.go @@ -8576,6 +8576,13 @@ func TestGatewayAPIHTTPRouteDAGStatus(t *testing.T) { }, }}, }, + Status: gatewayapi_v1.GatewayStatus{ + Addresses: []gatewayapi_v1.GatewayStatusAddress{ + { + Value: "1.2.3.5", + }, + }, + }, }, wantGatewayStatusUpdate: []*status.GatewayStatusUpdate{{ FullName: types.NamespacedName{Namespace: "projectcontour", Name: "contour"},