diff --git a/README.md b/README.md index b894abcf49..556b50f27a 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The following table lists the software versions NGINX Kubernetes Gateway support | NGINX Kubernetes Gateway | Gateway API | Kubernetes | NGINX OSS | |-|-|-|-| -| Edge | 0.6.2 | 1.21+ | 1.21.x *| +| Edge | 0.7.0 | 1.21+ | 1.21.x *| | 0.3.0 | 0.6.2 | 1.21+ | 1.21.x *| | 0.2.0 | 0.5.1 | 1.21+ | 1.21.x *| | 0.1.0 | 0.5.0 | 1.19+ | 1.21.3 | diff --git a/cmd/gateway/setup.go b/cmd/gateway/setup.go index a7b553c262..4507c4f9d4 100644 --- a/cmd/gateway/setup.go +++ b/cmd/gateway/setup.go @@ -17,7 +17,7 @@ import ( const ( errTmpl = "failed validation - flag: '--%s' reason: '%s'\n" // nolint:lll - // Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v0.6.2/apis/v1beta1/shared_types.go#L495 + // Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v0.7.0/apis/v1beta1/shared_types.go#L495 controllerNameRegex = `^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` //nolint:lll ) diff --git a/docs/installation.md b/docs/installation.md index 104f055d2e..1889c68a53 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -20,7 +20,7 @@ This guide walks you through how to install NGINX Kubernetes Gateway on a generi 1. Install the Gateway API resources from the standard channel (the CRDs and the validating webhook): ``` - kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.6.2/standard-install.yaml + kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.7.0/standard-install.yaml ``` 1. Create the nginx-gateway Namespace: diff --git a/go.mod b/go.mod index ebba1efe95..5e544ddec0 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( k8s.io/apimachinery v0.26.3 k8s.io/client-go v0.26.3 sigs.k8s.io/controller-runtime v0.14.6 - sigs.k8s.io/gateway-api v0.6.2 + sigs.k8s.io/gateway-api v0.7.0 ) require ( @@ -66,9 +66,9 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.26.1 // indirect - k8s.io/component-base v0.26.1 // indirect - k8s.io/klog/v2 v2.80.1 // indirect + k8s.io/apiextensions-apiserver v0.26.3 // indirect + k8s.io/component-base v0.26.3 // indirect + k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect diff --git a/go.sum b/go.sum index ff360857b8..8f87d32108 100644 --- a/go.sum +++ b/go.sum @@ -271,7 +271,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -605,16 +605,16 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU= k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE= -k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= -k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= +k8s.io/apiextensions-apiserver v0.26.3 h1:5PGMm3oEzdB1W/FTMgGIDmm100vn7IaUP5er36dB+YE= +k8s.io/apiextensions-apiserver v0.26.3/go.mod h1:jdA5MdjNWGP+njw1EKMZc64xAT5fIhN6VJrElV3sfpQ= k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k= k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= k8s.io/client-go v0.26.3 h1:k1UY+KXfkxV2ScEL3gilKcF7761xkYsSD6BC9szIu8s= k8s.io/client-go v0.26.3/go.mod h1:ZPNu9lm8/dbRIPAgteN30RSXea6vrCpFvq+MateTUuQ= -k8s.io/component-base v0.26.1 h1:4ahudpeQXHZL5kko+iDHqLj/FSGAEUnSVO0EBbgDd+4= -k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/component-base v0.26.3 h1:oC0WMK/ggcbGDTkdcqefI4wIZRYdK3JySx9/HADpV0g= +k8s.io/component-base v0.26.3/go.mod h1:5kj1kZYwSC6ZstHJN7oHBqcJC6yyn41eR+Sqa/mQc8E= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= @@ -624,8 +624,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= -sigs.k8s.io/gateway-api v0.6.2 h1:583XHiX2M2bKEA0SAdkoxL1nY73W1+/M+IAm8LJvbEA= -sigs.k8s.io/gateway-api v0.6.2/go.mod h1:EYJT+jlPWTeNskjV0JTki/03WX1cyAnBhwBJfYHpV/0= +sigs.k8s.io/gateway-api v0.7.0 h1:/mG8yyJNBifqvuVLW5gwlI4CQs0NR/5q4BKUlf1bVdY= +sigs.k8s.io/gateway-api v0.7.0/go.mod h1:Xv0+ZMxX0lu1nSSDIIPEfbVztgNZ+3cfiYrJsa2Ooso= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= diff --git a/internal/nginx/config/servers.go b/internal/nginx/config/servers.go index 0a46489ce0..98ecb5907e 100644 --- a/internal/nginx/config/servers.go +++ b/internal/nginx/config/servers.go @@ -277,7 +277,7 @@ func createHTTPMatch(match v1beta1.HTTPRouteMatch, redirectPath string) httpMatc // The name and values are delimited by "=". A name and value can always be recovered using strings.SplitN(arg,"=", 2). // Query Parameters are case-sensitive so case is preserved. func createQueryParamKeyValString(p v1beta1.HTTPQueryParamMatch) string { - return p.Name + "=" + p.Value + return string(p.Name) + "=" + p.Value } // The name and values are delimited by ":". A name and value can always be recovered using strings.Split(arg, ":"). diff --git a/internal/state/change_processor.go b/internal/state/change_processor.go index 911d8061fa..c556af935d 100644 --- a/internal/state/change_processor.go +++ b/internal/state/change_processor.go @@ -146,10 +146,10 @@ func NewChangeProcessorImpl(cfg ChangeProcessorConfig) *ChangeProcessorImpl { var err error switch o := obj.(type) { - // We don't validate GatewayClass, because as of 0.6.2, the webhook doesn't validate it (it only + // We don't validate GatewayClass, because as of 0.7.0, the webhook doesn't validate it (it only // validates an update that requires the previous version of the resource, // which NKG cannot reliably provide - for example, after NKG restarts). - // https://github.com/kubernetes-sigs/gateway-api/blob/v0.6.2/apis/v1beta1/validation/gatewayclass.go#L28 + // https://github.com/kubernetes-sigs/gateway-api/blob/v0.7.0/apis/v1beta1/validation/gatewayclass.go#L28 case *v1beta1.Gateway: err = gwapivalidation.ValidateGateway(o).ToAggregate() case *v1beta1.HTTPRoute: diff --git a/internal/state/conditions/conditions.go b/internal/state/conditions/conditions.go index 82fa772ef2..c610dcb7c0 100644 --- a/internal/state/conditions/conditions.go +++ b/internal/state/conditions/conditions.go @@ -220,16 +220,6 @@ func NewListenerConflictedHostname(msg string) []Condition { } } -// NewListenerUnsupportedAddress returns a Condition that indicates that the address of a Listener is unsupported. -func NewListenerUnsupportedAddress(msg string) Condition { - return Condition{ - Type: string(v1beta1.ListenerConditionAccepted), - Status: metav1.ConditionFalse, - Reason: string(v1beta1.ListenerReasonUnsupportedAddress), - Message: msg, - } -} - // NewListenerUnsupportedProtocol returns a Condition that indicates that the protocol of a Listener is unsupported. func NewListenerUnsupportedProtocol(msg string) Condition { return Condition{ diff --git a/internal/state/graph/gateway_listener.go b/internal/state/graph/gateway_listener.go index f55da62768..c359d6c0a7 100644 --- a/internal/state/graph/gateway_listener.go +++ b/internal/state/graph/gateway_listener.go @@ -197,7 +197,7 @@ func createAddressesValidator(gw *v1beta1.Gateway) listenerValidator { if len(gw.Spec.Addresses) > 0 { path := field.NewPath("spec", "addresses") valErr := field.Forbidden(path, "addresses are not supported") - return []conditions.Condition{conditions.NewListenerUnsupportedAddress(valErr.Error())} + return []conditions.Condition{conditions.NewListenerUnsupportedValue(valErr.Error())} } return nil } diff --git a/internal/state/graph/gateway_test.go b/internal/state/graph/gateway_test.go index 75f9232d03..00e2a314fb 100644 --- a/internal/state/graph/gateway_test.go +++ b/internal/state/graph/gateway_test.go @@ -353,7 +353,9 @@ func TestBuildGateway(t *testing.T) { Source: listener805, Valid: false, Conditions: []conditions.Condition{ - conditions.NewListenerPortUnavailable(`port: Unsupported value: 81: supported values: "80"`), + conditions.NewListenerPortUnavailable( + `port: Unsupported value: 81: supported values: "80"`, + ), }, }, }, @@ -370,7 +372,9 @@ func TestBuildGateway(t *testing.T) { Source: listener4436, Valid: false, Conditions: []conditions.Condition{ - conditions.NewListenerPortUnavailable(`port: Unsupported value: 444: supported values: "443"`), + conditions.NewListenerPortUnavailable( + `port: Unsupported value: 444: supported values: "443"`, + ), }, }, }, @@ -515,7 +519,7 @@ func TestBuildGateway(t *testing.T) { Source: listener801, Valid: false, Conditions: []conditions.Condition{ - conditions.NewListenerUnsupportedAddress( + conditions.NewListenerUnsupportedValue( "spec.addresses: Forbidden: addresses are not supported", ), }, @@ -525,7 +529,7 @@ func TestBuildGateway(t *testing.T) { Valid: false, SecretPath: "", Conditions: []conditions.Condition{ - conditions.NewListenerUnsupportedAddress( + conditions.NewListenerUnsupportedValue( "spec.addresses: Forbidden: addresses are not supported", ), }, diff --git a/internal/state/graph/httproute.go b/internal/state/graph/httproute.go index 08249882e2..dd10882996 100644 --- a/internal/state/graph/httproute.go +++ b/internal/state/graph/httproute.go @@ -439,7 +439,7 @@ func validateQueryParamMatch( allErrs = append(allErrs, valErr) } - if err := validator.ValidateQueryParamNameInMatch(q.Name); err != nil { + if err := validator.ValidateQueryParamNameInMatch(string(q.Name)); err != nil { valErr := field.Invalid(queryParamPath.Child("name"), q.Name, err.Error()) allErrs = append(allErrs, valErr) }