From 49e3dcc426c1736de053fea7fab4030022ae825f Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Thu, 13 Jan 2022 15:22:09 -0700 Subject: [PATCH] update Gateway API to v0.4.1 (#4268) Signed-off-by: Steve Kriss --- changelogs/unreleased/4268-skriss-small.md | 1 + examples/gateway/00-crds.yaml | 7 ++++--- examples/render/contour-gateway.yaml | 7 ++++--- go.mod | 2 +- go.sum | 2 ++ internal/dag/builder_test.go | 4 ++-- internal/gatewayapi/helpers.go | 5 +++++ test/e2e/gateway/request_redirect_test.go | 4 ++-- 8 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 changelogs/unreleased/4268-skriss-small.md diff --git a/changelogs/unreleased/4268-skriss-small.md b/changelogs/unreleased/4268-skriss-small.md new file mode 100644 index 00000000000..dc5109e2980 --- /dev/null +++ b/changelogs/unreleased/4268-skriss-small.md @@ -0,0 +1 @@ +Update Gateway API to v0.4.1 diff --git a/examples/gateway/00-crds.yaml b/examples/gateway/00-crds.yaml index ec60cff530c..89b2dc85604 100644 --- a/examples/gateway/00-crds.yaml +++ b/examples/gateway/00-crds.yaml @@ -19,7 +19,7 @@ spec: scope: Cluster versions: - additionalPrinterColumns: - - jsonPath: .spec.controller + - jsonPath: .spec.controllerName name: Controller type: string - jsonPath: .metadata.creationTimestamp @@ -1391,7 +1391,7 @@ spec: of the request is used. \n Support: Core" maxLength: 253 minLength: 1 - pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string port: description: "Port is the port to be used in @@ -1764,7 +1764,7 @@ spec: \n Support: Core" maxLength: 253 minLength: 1 - pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string port: description: "Port is the port to be used in the value @@ -2310,6 +2310,7 @@ spec: required: - group - kind + - namespace type: object maxItems: 16 minItems: 1 diff --git a/examples/render/contour-gateway.yaml b/examples/render/contour-gateway.yaml index 7a03422b264..ce204dc3ca6 100644 --- a/examples/render/contour-gateway.yaml +++ b/examples/render/contour-gateway.yaml @@ -5318,7 +5318,7 @@ spec: scope: Cluster versions: - additionalPrinterColumns: - - jsonPath: .spec.controller + - jsonPath: .spec.controllerName name: Controller type: string - jsonPath: .metadata.creationTimestamp @@ -6690,7 +6690,7 @@ spec: of the request is used. \n Support: Core" maxLength: 253 minLength: 1 - pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string port: description: "Port is the port to be used in @@ -7063,7 +7063,7 @@ spec: \n Support: Core" maxLength: 253 minLength: 1 - pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string port: description: "Port is the port to be used in the value @@ -7609,6 +7609,7 @@ spec: required: - group - kind + - namespace type: object maxItems: 16 minItems: 1 diff --git a/go.mod b/go.mod index a0f42b106d2..289e67e6a39 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,6 @@ require ( k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b sigs.k8s.io/controller-runtime v0.11.0 sigs.k8s.io/controller-tools v0.6.2 - sigs.k8s.io/gateway-api v0.4.0 + sigs.k8s.io/gateway-api v0.4.1 sigs.k8s.io/kustomize/kyaml v0.10.17 ) diff --git a/go.sum b/go.sum index 6527082e342..112284f8cd3 100644 --- a/go.sum +++ b/go.sum @@ -1746,6 +1746,8 @@ sigs.k8s.io/controller-tools v0.6.2/go.mod h1:oaeGpjXn6+ZSEIQkUe/+3I40PNiDYp9aea sigs.k8s.io/gateway-api v0.3.0/go.mod h1:Wb8bx7QhGVZxOSEU3i9vw/JqTB5Nlai9MLMYVZeDmRQ= sigs.k8s.io/gateway-api v0.4.0 h1:07IJkTt21NetZTHtPKJk2I4XIgDN4BAlTIq1wK7V11o= sigs.k8s.io/gateway-api v0.4.0/go.mod h1:r3eiNP+0el+NTLwaTfOrCNXy8TukC+dIM3ggc+fbNWk= +sigs.k8s.io/gateway-api v0.4.1 h1:Tof9/PNSZXyfDuTTe1XFvaTlvBRE6bKq1kmV6jj6rQE= +sigs.k8s.io/gateway-api v0.4.1/go.mod h1:r3eiNP+0el+NTLwaTfOrCNXy8TukC+dIM3ggc+fbNWk= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/kustomize/api v0.8.5/go.mod h1:M377apnKT5ZHJS++6H4rQoCHmWtt6qTpp3mbe7p6OLY= diff --git a/internal/dag/builder_test.go b/internal/dag/builder_test.go index b3ce1576d4e..e847c5ae6e7 100644 --- a/internal/dag/builder_test.go +++ b/internal/dag/builder_test.go @@ -2938,7 +2938,7 @@ func TestDAGInsertGatewayAPI(t *testing.T) { Type: gatewayapi_v1alpha2.HTTPRouteFilterRequestRedirect, RequestRedirect: &gatewayapi_v1alpha2.HTTPRequestRedirectFilter{ Scheme: pointer.String("https"), - Hostname: gatewayapi.ListenerHostname("envoyproxy.io"), + Hostname: gatewayapi.PreciseHostname("envoyproxy.io"), Port: gatewayapi.PortNumPtr(443), StatusCode: pointer.Int(301), }, @@ -2991,7 +2991,7 @@ func TestDAGInsertGatewayAPI(t *testing.T) { Type: gatewayapi_v1alpha2.HTTPRouteFilterRequestRedirect, RequestRedirect: &gatewayapi_v1alpha2.HTTPRequestRedirectFilter{ Scheme: pointer.String("https"), - Hostname: gatewayapi.ListenerHostname("envoyproxy.io"), + Hostname: gatewayapi.PreciseHostname("envoyproxy.io"), Port: gatewayapi.PortNumPtr(443), StatusCode: pointer.Int(301), }, diff --git a/internal/gatewayapi/helpers.go b/internal/gatewayapi/helpers.go index 12d19ae3f48..9b922142456 100644 --- a/internal/gatewayapi/helpers.go +++ b/internal/gatewayapi/helpers.go @@ -57,6 +57,11 @@ func ListenerHostname(host string) *gatewayapi_v1alpha2.Hostname { return &h } +func PreciseHostname(host string) *gatewayapi_v1alpha2.PreciseHostname { + h := gatewayapi_v1alpha2.PreciseHostname(host) + return &h +} + func CertificateRef(name, namespace string) *gatewayapi_v1alpha2.SecretObjectReference { ref := &gatewayapi_v1alpha2.SecretObjectReference{ Group: GroupPtr(""), diff --git a/test/e2e/gateway/request_redirect_test.go b/test/e2e/gateway/request_redirect_test.go index fc017285a7a..921547ebe2d 100644 --- a/test/e2e/gateway/request_redirect_test.go +++ b/test/e2e/gateway/request_redirect_test.go @@ -54,7 +54,7 @@ func testRequestRedirectRule(namespace string) { { Type: gatewayapi_v1alpha2.HTTPRouteFilterRequestRedirect, RequestRedirect: &gatewayapi_v1alpha2.HTTPRequestRedirectFilter{ - Hostname: gatewayapi.ListenerHostname("projectcontour.io"), + Hostname: gatewayapi.PreciseHostname("projectcontour.io"), }, }, }, @@ -66,7 +66,7 @@ func testRequestRedirectRule(namespace string) { { Type: gatewayapi_v1alpha2.HTTPRouteFilterRequestRedirect, RequestRedirect: &gatewayapi_v1alpha2.HTTPRequestRedirectFilter{ - Hostname: gatewayapi.ListenerHostname("envoyproxy.io"), + Hostname: gatewayapi.PreciseHostname("envoyproxy.io"), StatusCode: pointer.Int(301), Scheme: pointer.String("https"), Port: gatewayapi.PortNumPtr(8080),