From 737dcc3f2ff8d6f27c783631456bad2c248c587b Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Mon, 13 Feb 2023 09:51:29 -0800 Subject: [PATCH 01/14] Merge pull request #1714 from skriss/pr-fix-1705 conformance: check reason in HTTPRouteInvalidCrossNamespaceParentRef test --- ...tproute-invalid-cross-namespace-parent-ref.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go index 3fcd6433eb..39c001d769 100644 --- a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go +++ b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go @@ -19,8 +19,10 @@ package tests import ( "testing" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/gateway-api/apis/v1beta1" "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" "sigs.k8s.io/gateway-api/conformance/utils/suite" ) @@ -37,6 +39,20 @@ var HTTPRouteInvalidCrossNamespaceParentRef = suite.ConformanceTest{ gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} routeNN := types.NamespacedName{Name: "invalid-cross-namespace-parent-ref", Namespace: "gateway-conformance-web-backend"} + // When running conformance tests, implementations are expected to have visibility across all namespaces, and + // must be setting this condition on routes that are not allowed. However, outside of conformance testing, + // it's also valid for implementations to run in modes where they only have access to a limited subset of + // namespaces, in which case they are not obligated to populate this condition on routes they cannot access. + t.Run("HTTPRoute should have an Accepted: false condition with reason NotAllowedByListeners", func(t *testing.T) { + acceptedCond := metav1.Condition{ + Type: string(v1beta1.RouteConditionAccepted), + Status: metav1.ConditionFalse, + Reason: string(v1beta1.RouteReasonNotAllowedByListeners), + } + + kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, acceptedCond) + }) + t.Run("Route should not have Parents set in status", func(t *testing.T) { kubernetes.HTTPRouteMustHaveNoAcceptedParents(t, suite.Client, suite.TimeoutConfig, routeNN) }) From 4977a5d25f049447fd3a38390f16e1929db20cc5 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Thu, 16 Feb 2023 05:15:38 -0800 Subject: [PATCH 02/14] Merge pull request #1730 from zaunist/main test: add not matching sectioName test --- ...lid-parentref-not-matching-section-name.go | 61 +++++++++++++++++++ ...d-parentref-not-matching-section-name.yaml | 17 ++++++ 2 files changed, 78 insertions(+) create mode 100644 conformance/tests/httproute-invalid-parentref-not-matching-section-name.go create mode 100644 conformance/tests/httproute-invalid-parentref-not-matching-section-name.yaml diff --git a/conformance/tests/httproute-invalid-parentref-not-matching-section-name.go b/conformance/tests/httproute-invalid-parentref-not-matching-section-name.go new file mode 100644 index 0000000000..30f9896cd8 --- /dev/null +++ b/conformance/tests/httproute-invalid-parentref-not-matching-section-name.go @@ -0,0 +1,61 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tests + +import ( + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + + "sigs.k8s.io/gateway-api/apis/v1beta1" + "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" + "sigs.k8s.io/gateway-api/conformance/utils/suite" +) + +func init() { + ConformanceTests = append(ConformanceTests, HTTPRouteInvalidParentRefNotMatchingSectionName) +} + +var HTTPRouteInvalidParentRefNotMatchingSectionName = suite.ConformanceTest{ + ShortName: "HTTPRouteInvalidParentRefNotMatchingSectionName", + Description: "A single HTTPRoute in the gateway-conformance-infra namespace should set the Accepted status to False with reason NoMatchingParent when attempting to bind to a Gateway that does not have a matching SectionName.", + Manifests: []string{"tests/httproute-invalid-parentref-not-matching-section-name.yaml"}, + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { + routeNN := types.NamespacedName{Name: "httproute-listener-not-matching-section-name", Namespace: "gateway-conformance-infra"} + gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} + + // The Route must have an Accepted Condition with a NoMatchingParent Reason. + t.Run("HTTPRoute with no matching sectionName in ParentRef has an Accepted Condition with status False and Reason NoMatchingParent", func(t *testing.T) { + resolvedRefsCond := metav1.Condition{ + Type: string(v1beta1.RouteConditionAccepted), + Status: metav1.ConditionFalse, + Reason: string(v1beta1.RouteReasonNoMatchingParent), + } + + kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, resolvedRefsCond) + }) + + t.Run("Route should not have Parents accepted in status", func(t *testing.T) { + kubernetes.HTTPRouteMustHaveNoAcceptedParents(t, suite.Client, suite.TimeoutConfig, routeNN) + }) + + t.Run("Gateway should have 0 Routes attached", func(t *testing.T) { + kubernetes.GatewayMustHaveZeroRoutes(t, suite.Client, suite.TimeoutConfig, gwNN) + }) + }, +} diff --git a/conformance/tests/httproute-invalid-parentref-not-matching-section-name.yaml b/conformance/tests/httproute-invalid-parentref-not-matching-section-name.yaml new file mode 100644 index 0000000000..b449965d98 --- /dev/null +++ b/conformance/tests/httproute-invalid-parentref-not-matching-section-name.yaml @@ -0,0 +1,17 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: httproute-listener-not-matching-section-name + namespace: gateway-conformance-infra +spec: + parentRefs: + - name: same-namespace + namespace: gateway-conformance-infra + port: 80 + # mismatched sectionName here (http1 is not an available gateway listener) triggers NoMatchingParent reason + sectionName: http1 + rules: + - backendRefs: + - name: infra-backend-v1 + kind: Service + port: 8080 From e45b4f000365bd86382e796eb01d4fa9760feb36 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Thu, 16 Feb 2023 10:45:39 -0800 Subject: [PATCH 03/14] Merge pull request #1736 from shaneutt/shaneutt/replace-k8s.gcr.io-registry chore: replace usage of the deprecated k8s.gcr.io registry --- config/webhook/certificate_config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/webhook/certificate_config.yaml b/config/webhook/certificate_config.yaml index 9ee7450a93..910206a905 100644 --- a/config/webhook/certificate_config.yaml +++ b/config/webhook/certificate_config.yaml @@ -88,7 +88,7 @@ spec: spec: containers: - name: create - image: k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1 + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.1.1 imagePullPolicy: IfNotPresent args: - create @@ -122,7 +122,7 @@ spec: spec: containers: - name: patch - image: k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1 + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.1.1 imagePullPolicy: IfNotPresent args: - patch From 4fa8fc558ea302dab69c44980a08dc4d7b5d2591 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Tue, 21 Feb 2023 10:21:55 -0800 Subject: [PATCH 04/14] Merge pull request #1745 from mlavacca/cleanup-not-found-error chore: cleanup err check in conformance tests --- conformance/utils/kubernetes/apply.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/conformance/utils/kubernetes/apply.go b/conformance/utils/kubernetes/apply.go index da1f5bfe6f..2c3b40caac 100644 --- a/conformance/utils/kubernetes/apply.go +++ b/conformance/utils/kubernetes/apply.go @@ -218,7 +218,9 @@ func (a Applier) MustApplyWithCleanup(t *testing.T, c client.Client, timeoutConf defer cancel() t.Logf("Deleting %s %s", uObj.GetName(), uObj.GetKind()) err = c.Delete(ctx, uObj) - require.NoErrorf(t, err, "error deleting resource") + if !apierrors.IsNotFound(err) { + require.NoErrorf(t, err, "error deleting resource") + } }) } continue @@ -234,7 +236,9 @@ func (a Applier) MustApplyWithCleanup(t *testing.T, c client.Client, timeoutConf defer cancel() t.Logf("Deleting %s %s", uObj.GetName(), uObj.GetKind()) err = c.Delete(ctx, uObj) - require.NoErrorf(t, err, "error deleting resource") + if !apierrors.IsNotFound(err) { + require.NoErrorf(t, err, "error deleting resource") + } }) } require.NoErrorf(t, err, "error updating resource") From de7949505df7aa89f0d069452723b2a52f9b5a11 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Mon, 27 Feb 2023 12:15:58 -0800 Subject: [PATCH 05/14] Merge pull request #1761 from briantkennedy/gen Log Generation / Observed generation. --- conformance/utils/kubernetes/helpers.go | 5 +- conformance/utils/kubernetes/helpers_test.go | 112 +++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/conformance/utils/kubernetes/helpers.go b/conformance/utils/kubernetes/helpers.go index f0294663f9..093cc7dbda 100644 --- a/conformance/utils/kubernetes/helpers.go +++ b/conformance/utils/kubernetes/helpers.go @@ -147,13 +147,14 @@ func ConditionsHaveLatestObservedGeneration(obj metav1.Object, conditions []meta return nil } + wantGeneration := obj.GetGeneration() var b strings.Builder - fmt.Fprint(&b, "expected observedGeneration to be updated for all conditions") + fmt.Fprintf(&b, "expected observedGeneration to be updated to %d for all conditions", wantGeneration) fmt.Fprintf(&b, ", only %d/%d were updated.", len(conditions)-len(staleConditions), len(conditions)) fmt.Fprintf(&b, " stale conditions are: ") for i, c := range staleConditions { - fmt.Fprintf(&b, c.Type) + fmt.Fprintf(&b, "%s (generation %d)", c.Type, c.ObservedGeneration) if i != len(staleConditions)-1 { fmt.Fprintf(&b, ", ") } diff --git a/conformance/utils/kubernetes/helpers_test.go b/conformance/utils/kubernetes/helpers_test.go index dc7812b265..3e1158db89 100644 --- a/conformance/utils/kubernetes/helpers_test.go +++ b/conformance/utils/kubernetes/helpers_test.go @@ -17,14 +17,126 @@ limitations under the License. package kubernetes import ( + "fmt" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/gateway-api/apis/v1alpha2" "sigs.k8s.io/gateway-api/apis/v1beta1" ) +// ----------------------------------------------------------------------------- +// Test - Public Functions +// ----------------------------------------------------------------------------- + +func TestNewGatewayRef(t *testing.T) { + tests := []struct { + name string + nsn types.NamespacedName + listenerNames []string + }{ + { + name: "verifying the contents of a GatewayRef with no provided listeners", + nsn: types.NamespacedName{Namespace: corev1.NamespaceDefault, Name: "fake-gateway"}, + }, + { + name: "verifying the contents of a GatewayRef listeners with one listener provided", + nsn: types.NamespacedName{Namespace: corev1.NamespaceDefault, Name: "fake-gateway"}, + listenerNames: []string{"fake-listener-1"}, + }, + { + name: "verifying the contents of a GatewayRef listeners with multiple listeners provided", + nsn: types.NamespacedName{Namespace: corev1.NamespaceDefault, Name: "fake-gateway"}, + listenerNames: []string{ + "fake-listener-1", + "fake-listener-2", + "fake-listener-3", + }, + }, + } + + for i := 0; i < len(tests); i++ { + test := tests[i] + t.Run(test.name, func(t *testing.T) { + ref := NewGatewayRef(test.nsn, test.listenerNames...) + require.IsType(t, GatewayRef{}, ref) + if test.listenerNames == nil { + require.Len(t, ref.listenerNames, 1) + assert.Equal(t, "", string(*ref.listenerNames[0])) + } else { + require.Len(t, ref.listenerNames, len(test.listenerNames)) + for i := 0; i < len(ref.listenerNames); i++ { + assert.Equal(t, test.listenerNames[i], string(*ref.listenerNames[i])) + } + } + assert.Equal(t, test.nsn, ref.NamespacedName) + }) + } +} + +func TestVerifyConditionsMatchGeneration(t *testing.T) { + tests := []struct { + name string + obj metav1.Object + conditions []metav1.Condition + expected error + }{ + {}, + { + name: "if no conditions are provided this technically passes verification", + }, + { + name: "conditions where all match the generation pass verification", + obj: &v1beta1.Gateway{ObjectMeta: metav1.ObjectMeta{Name: "fake-gateway", Generation: 20}}, + conditions: []metav1.Condition{ + {Type: "FakeCondition1", ObservedGeneration: 20}, + {Type: "FakeCondition2", ObservedGeneration: 20}, + {Type: "FakeCondition3", ObservedGeneration: 20}, + }, + }, + { + name: "conditions where one does not match the generation fail verification", + obj: &v1beta1.Gateway{ObjectMeta: metav1.ObjectMeta{Name: "fake-gateway", Generation: 20}}, + conditions: []metav1.Condition{ + {Type: "FakeCondition1", ObservedGeneration: 20}, + {Type: "FakeCondition2", ObservedGeneration: 19}, + {Type: "FakeCondition3", ObservedGeneration: 20}, + }, + expected: fmt.Errorf("expected observedGeneration to be updated to 20 for all conditions, only 2/3 were updated. stale conditions are: FakeCondition2 (generation 19)"), + }, + { + name: "conditions where most do not match the generation fail verification", + obj: &v1beta1.Gateway{ObjectMeta: metav1.ObjectMeta{Name: "fake-gateway", Generation: 20}}, + conditions: []metav1.Condition{ + {Type: "FakeCondition1", ObservedGeneration: 18}, + {Type: "FakeCondition2", ObservedGeneration: 18}, + {Type: "FakeCondition3", ObservedGeneration: 14}, + {Type: "FakeCondition4", ObservedGeneration: 20}, + {Type: "FakeCondition5", ObservedGeneration: 16}, + {Type: "FakeCondition6", ObservedGeneration: 15}, + }, + expected: fmt.Errorf("expected observedGeneration to be updated to 20 for all conditions, only 1/6 were updated. stale conditions are: FakeCondition1 (generation 18), FakeCondition2 (generation 18), FakeCondition3 (generation 14), FakeCondition5 (generation 16), FakeCondition6 (generation 15)"), + }, + } + + for i := 0; i < len(tests); i++ { + test := tests[i] + t.Run(test.name, func(t *testing.T) { + err := ConditionsHaveLatestObservedGeneration(test.obj, test.conditions) + assert.Equal(t, test.expected, err) + }) + } +} + +// ----------------------------------------------------------------------------- +// Test - Private Functions +// ----------------------------------------------------------------------------- + func Test_listenersMatch(t *testing.T) { tests := []struct { name string From 71d74003d827ddc4a38d8a58a0363c3324a8fa4d Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Mon, 27 Feb 2023 12:25:26 -0800 Subject: [PATCH 06/14] Merge pull request #1763 from briantkennedy/gw Improve conformance test log message. --- conformance/utils/kubernetes/helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conformance/utils/kubernetes/helpers.go b/conformance/utils/kubernetes/helpers.go index 093cc7dbda..e79542fedc 100644 --- a/conformance/utils/kubernetes/helpers.go +++ b/conformance/utils/kubernetes/helpers.go @@ -195,7 +195,7 @@ func NamespacesMustBeAccepted(t *testing.T, c client.Client, timeoutConfig confi gw := gw if err = ConditionsHaveLatestObservedGeneration(&gw, gw.Status.Conditions); err != nil { - t.Log(err) + t.Logf("Gateway %s/%s %v", ns, gw.Name, err) return false, nil } From 09a11aebc76bcde8e3c32befb580d26645f2764d Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Wed, 8 Mar 2023 10:49:14 -0800 Subject: [PATCH 07/14] Merge pull request #1760 from michaelbeaumont/fix/conformance_observed_gen conformance: use Patch to make ObservedGeneration tests robust against conflicts --- conformance/tests/gateway-observed-generation-bump.go | 5 +++-- conformance/tests/gatewayclass-observed-generation-bump.go | 5 +++-- conformance/tests/httproute-observed-generation-bump.go | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/conformance/tests/gateway-observed-generation-bump.go b/conformance/tests/gateway-observed-generation-bump.go index d7b5d87bda..12f46d2358 100644 --- a/conformance/tests/gateway-observed-generation-bump.go +++ b/conformance/tests/gateway-observed-generation-bump.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/gateway-api/apis/v1beta1" "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" @@ -69,8 +70,8 @@ var GatewayObservedGenerationBump = suite.ConformanceTest{ }, }) - err = s.Client.Update(ctx, mutate) - require.NoErrorf(t, err, "error updating the Gateway: %v", err) + err = s.Client.Patch(ctx, mutate, client.MergeFrom(original)) + require.NoErrorf(t, err, "error patching the Gateway: %v", err) // Ensure the generation and observedGeneration sync up kubernetes.NamespacesMustBeAccepted(t, s.Client, s.TimeoutConfig, namespaces) diff --git a/conformance/tests/gatewayclass-observed-generation-bump.go b/conformance/tests/gatewayclass-observed-generation-bump.go index 0a699ff514..e1e556b590 100644 --- a/conformance/tests/gatewayclass-observed-generation-bump.go +++ b/conformance/tests/gatewayclass-observed-generation-bump.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/gateway-api/apis/v1beta1" "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" @@ -58,8 +59,8 @@ var GatewayClassObservedGenerationBump = suite.ConformanceTest{ desc := "new" mutate.Spec.Description = &desc - err = s.Client.Update(ctx, mutate) - require.NoErrorf(t, err, "error updating the GatewayClass: %v", err) + err = s.Client.Patch(ctx, mutate, client.MergeFrom(original)) + require.NoErrorf(t, err, "error patching the GatewayClass: %v", err) // Ensure the generation and observedGeneration sync up kubernetes.GWCMustHaveAcceptedConditionAny(t, s.Client, s.TimeoutConfig, gwc.Name) diff --git a/conformance/tests/httproute-observed-generation-bump.go b/conformance/tests/httproute-observed-generation-bump.go index 590dcc6fed..c7571856bc 100644 --- a/conformance/tests/httproute-observed-generation-bump.go +++ b/conformance/tests/httproute-observed-generation-bump.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/gateway-api/apis/v1beta1" "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" @@ -65,8 +66,8 @@ var HTTPRouteObservedGenerationBump = suite.ConformanceTest{ mutate := original.DeepCopy() mutate.Spec.Rules[0].BackendRefs[0].Name = "infra-backend-v2" - err = s.Client.Update(ctx, mutate) - require.NoErrorf(t, err, "error updating the HTTPRoute: %v", err) + err = s.Client.Patch(ctx, mutate, client.MergeFrom(original)) + require.NoErrorf(t, err, "error patching the HTTPRoute: %v", err) kubernetes.HTTPRouteMustHaveCondition(t, s.Client, s.TimeoutConfig, routeNN, gwNN, acceptedCondition) From e8d355805f71486d5e8c76474f77f05547dd46b5 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Wed, 8 Mar 2023 10:49:21 -0800 Subject: [PATCH 08/14] Merge pull request #1787 from Xunzhuo/fix-redirect-examples fix: remove invalid redirect examples --- .../http-redirect-rewrite/httproute-redirect-full.yaml | 4 ---- .../http-redirect-rewrite/httproute-redirect-https.yaml | 4 ---- .../http-redirect-rewrite/httproute-redirect-prefix.yaml | 4 ---- 3 files changed, 12 deletions(-) diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml b/examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml index 3b97f2f52b..6fe2544e2e 100644 --- a/examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml +++ b/examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml @@ -19,7 +19,3 @@ spec: type: ReplaceFullPath replaceFullPath: /paprika statusCode: 302 - backendRefs: - - name: example-svc - weight: 1 - port: 80 diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml b/examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml index 3729f67d47..ce2d16b2ca 100644 --- a/examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml +++ b/examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml @@ -13,7 +13,3 @@ spec: requestRedirect: scheme: https statusCode: 301 - backendRefs: - - name: example-svc - weight: 1 - port: 80 diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml b/examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml index 5c04bca224..3e2729fd44 100644 --- a/examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml +++ b/examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml @@ -19,7 +19,3 @@ spec: type: ReplacePrefixMatch replacePrefixMatch: /paprika statusCode: 302 - backendRefs: - - name: example-svc - weight: 1 - port: 80 From 4c4c0d52175b297e8373037baadd23cbb15ff52e Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Wed, 8 Mar 2023 11:01:14 -0800 Subject: [PATCH 09/14] Merge pull request #1624 from ChaningHwang/addAttachedRoutes conformance: add attachedRoutes to conformance tests --- .../tests/gateway-invalid-route-kind.go | 2 + .../gateway-invalid-tls-certificateref.go | 1 + .../gateway-secret-invalid-reference-grant.go | 1 + .../gateway-secret-missing-reference-grant.go | 1 + ...secret-reference-grant-all-in-namespace.go | 1 + ...gateway-secret-reference-grant-specific.go | 1 + .../tests/gateway-with-attached-routes.go | 77 ++++++++++++++++ .../tests/gateway-with-attached-routes.yaml | 88 +++++++++++++++++++ 8 files changed, 172 insertions(+) create mode 100644 conformance/tests/gateway-with-attached-routes.go create mode 100644 conformance/tests/gateway-with-attached-routes.yaml diff --git a/conformance/tests/gateway-invalid-route-kind.go b/conformance/tests/gateway-invalid-route-kind.go index 33777ea453..46c934a92d 100644 --- a/conformance/tests/gateway-invalid-route-kind.go +++ b/conformance/tests/gateway-invalid-route-kind.go @@ -46,6 +46,7 @@ var GatewayInvalidRouteKind = suite.ConformanceTest{ Status: metav1.ConditionFalse, Reason: string(v1beta1.ListenerReasonInvalidRouteKinds), }}, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) @@ -64,6 +65,7 @@ var GatewayInvalidRouteKind = suite.ConformanceTest{ Status: metav1.ConditionFalse, Reason: string(v1beta1.ListenerReasonInvalidRouteKinds), }}, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) diff --git a/conformance/tests/gateway-invalid-tls-certificateref.go b/conformance/tests/gateway-invalid-tls-certificateref.go index dad35605a0..c572dcfde3 100644 --- a/conformance/tests/gateway-invalid-tls-certificateref.go +++ b/conformance/tests/gateway-invalid-tls-certificateref.go @@ -47,6 +47,7 @@ var GatewayInvalidTLSConfiguration = suite.ConformanceTest{ Status: metav1.ConditionFalse, Reason: string(v1beta1.ListenerReasonInvalidCertificateRef), }}, + AttachedRoutes: 0, }} testCases := []struct { diff --git a/conformance/tests/gateway-secret-invalid-reference-grant.go b/conformance/tests/gateway-secret-invalid-reference-grant.go index 4ae38fd55f..cef8f5bf8f 100644 --- a/conformance/tests/gateway-secret-invalid-reference-grant.go +++ b/conformance/tests/gateway-secret-invalid-reference-grant.go @@ -51,6 +51,7 @@ var GatewaySecretInvalidReferenceGrant = suite.ConformanceTest{ Status: metav1.ConditionFalse, Reason: string(v1beta1.ListenerReasonRefNotPermitted), }}, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) diff --git a/conformance/tests/gateway-secret-missing-reference-grant.go b/conformance/tests/gateway-secret-missing-reference-grant.go index d9c3254fa9..25806acfe4 100644 --- a/conformance/tests/gateway-secret-missing-reference-grant.go +++ b/conformance/tests/gateway-secret-missing-reference-grant.go @@ -51,6 +51,7 @@ var GatewaySecretMissingReferenceGrant = suite.ConformanceTest{ Status: metav1.ConditionFalse, Reason: string(v1beta1.ListenerReasonRefNotPermitted), }}, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) diff --git a/conformance/tests/gateway-secret-reference-grant-all-in-namespace.go b/conformance/tests/gateway-secret-reference-grant-all-in-namespace.go index c91344a7f8..e710c67979 100644 --- a/conformance/tests/gateway-secret-reference-grant-all-in-namespace.go +++ b/conformance/tests/gateway-secret-reference-grant-all-in-namespace.go @@ -53,6 +53,7 @@ var GatewaySecretReferenceGrantAllInNamespace = suite.ConformanceTest{ Reason: string(v1beta1.ListenerConditionProgrammed), }, }, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) diff --git a/conformance/tests/gateway-secret-reference-grant-specific.go b/conformance/tests/gateway-secret-reference-grant-specific.go index 649d17e4db..54cc9b804f 100644 --- a/conformance/tests/gateway-secret-reference-grant-specific.go +++ b/conformance/tests/gateway-secret-reference-grant-specific.go @@ -53,6 +53,7 @@ var GatewaySecretReferenceGrantSpecific = suite.ConformanceTest{ Reason: string(v1beta1.ListenerReasonProgrammed), }, }, + AttachedRoutes: 0, }} kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) diff --git a/conformance/tests/gateway-with-attached-routes.go b/conformance/tests/gateway-with-attached-routes.go new file mode 100644 index 0000000000..1f552ff233 --- /dev/null +++ b/conformance/tests/gateway-with-attached-routes.go @@ -0,0 +1,77 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package tests + +import ( + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + + "sigs.k8s.io/gateway-api/apis/v1beta1" + "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" + "sigs.k8s.io/gateway-api/conformance/utils/suite" +) + +func init() { + ConformanceTests = append(ConformanceTests, GatewayWithAttachedRoutes) +} + +var GatewayWithAttachedRoutes = suite.ConformanceTest{ + ShortName: "GatewayWithAttachedRoutes", + Description: "A Gateway in the gateway-conformance-infra namespace should be attached to routes.", + Manifests: []string{"tests/gateway-with-attached-routes.yaml"}, + Test: func(t *testing.T, s *suite.ConformanceTestSuite) { + t.Run("Gateway listener should have one valid http routes attached", func(t *testing.T) { + gwNN := types.NamespacedName{Name: "gateway-with-one-attached-route", Namespace: "gateway-conformance-infra"} + listeners := []v1beta1.ListenerStatus{{ + Name: v1beta1.SectionName("http"), + SupportedKinds: []v1beta1.RouteGroupKind{{ + Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group), + Kind: v1beta1.Kind("HTTPRoute"), + }}, + Conditions: []metav1.Condition{{ + Type: string(v1beta1.RouteConditionAccepted), + Status: metav1.ConditionTrue, + Reason: "", //any reason + }}, + AttachedRoutes: 1, + }} + + kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) + }) + + t.Run("Gateway listener should have two valid http routes attached", func(t *testing.T) { + gwNN := types.NamespacedName{Name: "gateway-with-two-attached-routes", Namespace: "gateway-conformance-infra"} + listeners := []v1beta1.ListenerStatus{{ + Name: v1beta1.SectionName("http"), + SupportedKinds: []v1beta1.RouteGroupKind{{ + Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group), + Kind: v1beta1.Kind("HTTPRoute"), + }}, + Conditions: []metav1.Condition{{ + Type: string(v1beta1.RouteConditionAccepted), + Status: metav1.ConditionTrue, + Reason: "", //any reason + }}, + AttachedRoutes: 2, + }} + + kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners) + }) + }, +} diff --git a/conformance/tests/gateway-with-attached-routes.yaml b/conformance/tests/gateway-with-attached-routes.yaml new file mode 100644 index 0000000000..4fa5f78711 --- /dev/null +++ b/conformance/tests/gateway-with-attached-routes.yaml @@ -0,0 +1,88 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: gateway-with-one-attached-route + namespace: gateway-conformance-infra +spec: + gatewayClassName: "{GATEWAY_CLASS_NAME}" + listeners: + - name: http + port: 80 + protocol: HTTP + allowedRoutes: + kinds: + - kind: HTTPRoute + namespaces: + from: Selector + selector: + matchLabels: + # This label is added automatically as of K8s 1.22 + # to all namespaces + kubernetes.io/metadata.name: gateway-conformance-infra +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-route-1 + namespace: gateway-conformance-infra +spec: + parentRefs: + - kind: Gateway + name: gateway-with-one-attached-route + namespace: gateway-conformance-infra + rules: + - backendRefs: + - name: foo-svc + port: 8080 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: gateway-with-two-attached-routes + namespace: gateway-conformance-infra +spec: + gatewayClassName: "{GATEWAY_CLASS_NAME}" + listeners: + - name: http + port: 80 + protocol: HTTP + allowedRoutes: + kinds: + - kind: HTTPRoute + namespaces: + from: Selector + selector: + matchLabels: + # This label is added automatically as of K8s 1.22 + # to all namespaces + kubernetes.io/metadata.name: gateway-conformance-infra +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-route-2 + namespace: gateway-conformance-infra +spec: + parentRefs: + - kind: Gateway + name: gateway-with-two-attached-routes + namespace: gateway-conformance-infra + rules: + - backendRefs: + - name: foo-svc + port: 8080 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-route-3 + namespace: gateway-conformance-infra +spec: + parentRefs: + - kind: Gateway + name: gateway-with-two-attached-routes + namespace: gateway-conformance-infra + rules: + - backendRefs: + - name: foo-svc + port: 8080 \ No newline at end of file From c1a1ae8774443994b1f53ce91ff60290741021d4 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Mon, 13 Mar 2023 13:24:48 -0700 Subject: [PATCH 10/14] Merge pull request #1668 from mlavacca/conformance-resolvedrefs-httproute conformance: HTTPRoute resolvedRefs condition always checked --- .../tests/httproute-cross-namespace.go | 1 + .../tests/httproute-disallowed-kind.go | 1 + .../tests/httproute-exact-path-matching.go | 1 + .../tests/httproute-header-matching.go | 1 + .../tests/httproute-hostname-intersection.go | 3 +++ .../httproute-listener-hostname-matching.go | 20 +++++++++------- .../tests/httproute-matching-across-routes.go | 2 ++ conformance/tests/httproute-matching.go | 1 + .../tests/httproute-method-matching.go | 1 + .../httproute-observed-generation-bump.go | 24 +++++++++---------- .../tests/httproute-query-param-matching.go | 11 ++++----- .../httproute-redirect-host-and-status.go | 1 + conformance/tests/httproute-redirect-path.go | 1 + conformance/tests/httproute-redirect-port.go | 1 + .../tests/httproute-redirect-scheme.go | 1 + .../tests/httproute-reference-grant.go | 7 +++--- .../httproute-request-header-modifier.go | 1 + .../httproute-response-header-modifier.go | 1 + conformance/tests/httproute-rewrite-host.go | 1 + conformance/tests/httproute-rewrite-path.go | 1 + .../tests/httproute-simple-same-namespace.go | 1 + conformance/utils/kubernetes/helpers.go | 10 ++++++++ 22 files changed, 61 insertions(+), 31 deletions(-) diff --git a/conformance/tests/httproute-cross-namespace.go b/conformance/tests/httproute-cross-namespace.go index db6ff61109..fbf58645b0 100644 --- a/conformance/tests/httproute-cross-namespace.go +++ b/conformance/tests/httproute-cross-namespace.go @@ -38,6 +38,7 @@ var HTTPRouteCrossNamespace = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "cross-namespace", Namespace: "gateway-conformance-web-backend"} gwNN := types.NamespacedName{Name: "backend-namespaces", Namespace: "gateway-conformance-infra"} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) { http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{ diff --git a/conformance/tests/httproute-disallowed-kind.go b/conformance/tests/httproute-disallowed-kind.go index d072c8b9e9..bfd3b6446c 100644 --- a/conformance/tests/httproute-disallowed-kind.go +++ b/conformance/tests/httproute-disallowed-kind.go @@ -43,6 +43,7 @@ var HTTPRouteDisallowedKind = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "disallowed-kind", Namespace: "gateway-conformance-infra"} gwNN := types.NamespacedName{Name: "tlsroutes-only", Namespace: "gateway-conformance-infra"} + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) t.Run("Route should not have been accepted with reason NotAllowedByListeners", func(t *testing.T) { kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{ diff --git a/conformance/tests/httproute-exact-path-matching.go b/conformance/tests/httproute-exact-path-matching.go index a543834aa5..fdc032e58a 100644 --- a/conformance/tests/httproute-exact-path-matching.go +++ b/conformance/tests/httproute-exact-path-matching.go @@ -39,6 +39,7 @@ var HTTPExactPathMatching = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "exact-matching", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{ { diff --git a/conformance/tests/httproute-header-matching.go b/conformance/tests/httproute-header-matching.go index 51349f5018..3208bf2e06 100644 --- a/conformance/tests/httproute-header-matching.go +++ b/conformance/tests/httproute-header-matching.go @@ -39,6 +39,7 @@ var HTTPRouteHeaderMatching = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "header-matching", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{Path: "/", Headers: map[string]string{"Version": "one"}}, diff --git a/conformance/tests/httproute-hostname-intersection.go b/conformance/tests/httproute-hostname-intersection.go index cd52d4fede..974f30c9ff 100644 --- a/conformance/tests/httproute-hostname-intersection.go +++ b/conformance/tests/httproute-hostname-intersection.go @@ -52,6 +52,9 @@ var HTTPRouteHostnameIntersection = suite.ConformanceTest{ {Namespace: ns, Name: "wildcard-host-matches-listener-wildcard-host"}, } gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routes...) + for _, routeNN := range routes { + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) + } var testCases []http.ExpectedResponse diff --git a/conformance/tests/httproute-listener-hostname-matching.go b/conformance/tests/httproute-listener-hostname-matching.go index 9ab780b64e..8e87106b59 100644 --- a/conformance/tests/httproute-listener-hostname-matching.go +++ b/conformance/tests/httproute-listener-hostname-matching.go @@ -41,17 +41,19 @@ var HTTPRouteListenerHostnameMatching = suite.ConformanceTest{ // namespace so we have to wait for it to be ready. kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, []string{ns}) + routeNN1 := types.NamespacedName{Name: "backend-v1", Namespace: ns} + routeNN2 := types.NamespacedName{Name: "backend-v2", Namespace: ns} + routeNN3 := types.NamespacedName{Name: "backend-v3", Namespace: ns} gwNN := types.NamespacedName{Name: "httproute-listener-hostname-matching", Namespace: ns} - _ = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-1"), - types.NamespacedName{Namespace: ns, Name: "backend-v1"}, - ) - _ = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-2"), - types.NamespacedName{Namespace: ns, Name: "backend-v2"}, - ) - gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-3", "listener-4"), - types.NamespacedName{Namespace: ns, Name: "backend-v3"}, - ) + kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-1"), routeNN1) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN) + + kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-2"), routeNN2) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN) + + gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-3", "listener-4"), routeNN3) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN3, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{Host: "bar.com", Path: "/"}, diff --git a/conformance/tests/httproute-matching-across-routes.go b/conformance/tests/httproute-matching-across-routes.go index 4ab46a3d92..baedd9f338 100644 --- a/conformance/tests/httproute-matching-across-routes.go +++ b/conformance/tests/httproute-matching-across-routes.go @@ -40,6 +40,8 @@ var HTTPRouteMatchingAcrossRoutes = suite.ConformanceTest{ routeNN2 := types.NamespacedName{Name: "matching-part2", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN1, routeNN2) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-matching.go b/conformance/tests/httproute-matching.go index 596f04cbf5..3d5122a83c 100644 --- a/conformance/tests/httproute-matching.go +++ b/conformance/tests/httproute-matching.go @@ -39,6 +39,7 @@ var HTTPRouteMatching = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "matching", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{Path: "/"}, diff --git a/conformance/tests/httproute-method-matching.go b/conformance/tests/httproute-method-matching.go index dc136cc4a0..fb9491c06a 100644 --- a/conformance/tests/httproute-method-matching.go +++ b/conformance/tests/httproute-method-matching.go @@ -40,6 +40,7 @@ var HTTPRouteMethodMatching = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "method-matching", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{ { diff --git a/conformance/tests/httproute-observed-generation-bump.go b/conformance/tests/httproute-observed-generation-bump.go index c7571856bc..9a5306457d 100644 --- a/conformance/tests/httproute-observed-generation-bump.go +++ b/conformance/tests/httproute-observed-generation-bump.go @@ -39,26 +39,19 @@ var HTTPRouteObservedGenerationBump = suite.ConformanceTest{ ShortName: "HTTPRouteObservedGenerationBump", Description: "A HTTPRoute in the gateway-conformance-infra namespace should update the observedGeneration in all of it's Status.Conditions after an update to the spec", Manifests: []string{"tests/httproute-observed-generation-bump.yaml"}, - Test: func(t *testing.T, s *suite.ConformanceTestSuite) { - + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { routeNN := types.NamespacedName{Name: "observed-generation-bump", Namespace: "gateway-conformance-infra"} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} - acceptedCondition := metav1.Condition{ - Type: string(v1beta1.RouteConditionAccepted), - Status: metav1.ConditionTrue, - Reason: "", // any reason - } - t.Run("observedGeneration should increment", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() namespaces := []string{"gateway-conformance-infra"} - kubernetes.NamespacesMustBeAccepted(t, s.Client, s.TimeoutConfig, namespaces) + kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, namespaces) original := &v1beta1.HTTPRoute{} - err := s.Client.Get(ctx, routeNN, original) + err := suite.Client.Get(ctx, routeNN, original) require.NoErrorf(t, err, "error getting HTTPRoute: %v", err) // Sanity check @@ -66,13 +59,18 @@ var HTTPRouteObservedGenerationBump = suite.ConformanceTest{ mutate := original.DeepCopy() mutate.Spec.Rules[0].BackendRefs[0].Name = "infra-backend-v2" - err = s.Client.Patch(ctx, mutate, client.MergeFrom(original)) + err = suite.Client.Patch(ctx, mutate, client.MergeFrom(original)) require.NoErrorf(t, err, "error patching the HTTPRoute: %v", err) - kubernetes.HTTPRouteMustHaveCondition(t, s.Client, s.TimeoutConfig, routeNN, gwNN, acceptedCondition) + kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{ + Type: string(v1beta1.RouteConditionAccepted), + Status: metav1.ConditionTrue, + Reason: "", // any reason + }) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) updated := &v1beta1.HTTPRoute{} - err = s.Client.Get(ctx, routeNN, updated) + err = suite.Client.Get(ctx, routeNN, updated) require.NoErrorf(t, err, "error getting Gateway: %v", err) // Sanity check diff --git a/conformance/tests/httproute-query-param-matching.go b/conformance/tests/httproute-query-param-matching.go index e5a513150e..bd981888c4 100644 --- a/conformance/tests/httproute-query-param-matching.go +++ b/conformance/tests/httproute-query-param-matching.go @@ -36,12 +36,11 @@ var HTTPRouteQueryParamMatching = suite.ConformanceTest{ Manifests: []string{"tests/httproute-query-param-matching.yaml"}, Features: []suite.SupportedFeature{suite.SupportHTTPRouteQueryParamMatching}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { - var ( - ns = "gateway-conformance-infra" - routeNN = types.NamespacedName{Namespace: ns, Name: "query-param-matching"} - gwNN = types.NamespacedName{Namespace: ns, Name: "same-namespace"} - gwAddr = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) - ) + ns := "gateway-conformance-infra" + routeNN := types.NamespacedName{Namespace: ns, Name: "query-param-matching"} + gwNN := types.NamespacedName{Namespace: ns, Name: "same-namespace"} + gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{Path: "/?animal=whale"}, diff --git a/conformance/tests/httproute-redirect-host-and-status.go b/conformance/tests/httproute-redirect-host-and-status.go index d360abb28f..c57fc08eaf 100644 --- a/conformance/tests/httproute-redirect-host-and-status.go +++ b/conformance/tests/httproute-redirect-host-and-status.go @@ -40,6 +40,7 @@ var HTTPRouteRedirectHostAndStatus = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "redirect-host-and-status", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-redirect-path.go b/conformance/tests/httproute-redirect-path.go index 880fb053ea..0ae24fc73a 100644 --- a/conformance/tests/httproute-redirect-path.go +++ b/conformance/tests/httproute-redirect-path.go @@ -41,6 +41,7 @@ var HTTPRouteRedirectPath = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "redirect-path", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-redirect-port.go b/conformance/tests/httproute-redirect-port.go index 58d4fd6b12..9ceeade802 100644 --- a/conformance/tests/httproute-redirect-port.go +++ b/conformance/tests/httproute-redirect-port.go @@ -41,6 +41,7 @@ var HTTPRouteRedirectPort = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "redirect-port", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-redirect-scheme.go b/conformance/tests/httproute-redirect-scheme.go index d2cc34f251..0ef63a4f01 100644 --- a/conformance/tests/httproute-redirect-scheme.go +++ b/conformance/tests/httproute-redirect-scheme.go @@ -41,6 +41,7 @@ var HTTPRouteRedirectScheme = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "redirect-scheme", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-reference-grant.go b/conformance/tests/httproute-reference-grant.go index ae096ecadf..dd48076a86 100644 --- a/conformance/tests/httproute-reference-grant.go +++ b/conformance/tests/httproute-reference-grant.go @@ -35,13 +35,14 @@ var HTTPRouteReferenceGrant = suite.ConformanceTest{ Description: "A single HTTPRoute in the gateway-conformance-infra namespace, with a backendRef in the gateway-conformance-web-backend namespace, should attach to Gateway in the gateway-conformance-infra namespace", Features: []suite.SupportedFeature{suite.SupportReferenceGrant}, Manifests: []string{"tests/httproute-reference-grant.yaml"}, - Test: func(t *testing.T, s *suite.ConformanceTestSuite) { + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { routeNN := types.NamespacedName{Name: "reference-grant", Namespace: "gateway-conformance-infra"} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} - gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, s.Client, s.TimeoutConfig, s.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) { - http.MakeRequestAndExpectEventuallyConsistentResponse(t, s.RoundTripper, s.TimeoutConfig, gwAddr, http.ExpectedResponse{ + http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{ Request: http.Request{ Method: "GET", Path: "/", diff --git a/conformance/tests/httproute-request-header-modifier.go b/conformance/tests/httproute-request-header-modifier.go index 14220b3442..8b4c77fcbd 100644 --- a/conformance/tests/httproute-request-header-modifier.go +++ b/conformance/tests/httproute-request-header-modifier.go @@ -39,6 +39,7 @@ var HTTPRouteRequestHeaderModifier = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "request-header-modifier", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-response-header-modifier.go b/conformance/tests/httproute-response-header-modifier.go index dd6323545c..1f2c8f4a34 100644 --- a/conformance/tests/httproute-response-header-modifier.go +++ b/conformance/tests/httproute-response-header-modifier.go @@ -40,6 +40,7 @@ var HTTPRouteResponseHeaderModifier = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "response-header-modifier", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{{ Request: http.Request{ diff --git a/conformance/tests/httproute-rewrite-host.go b/conformance/tests/httproute-rewrite-host.go index 59a392874e..fb3a96e3f8 100644 --- a/conformance/tests/httproute-rewrite-host.go +++ b/conformance/tests/httproute-rewrite-host.go @@ -40,6 +40,7 @@ var HTTPRouteRewriteHost = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "rewrite-host", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{ { diff --git a/conformance/tests/httproute-rewrite-path.go b/conformance/tests/httproute-rewrite-path.go index 2e8539e9e7..12adefdeae 100644 --- a/conformance/tests/httproute-rewrite-path.go +++ b/conformance/tests/httproute-rewrite-path.go @@ -40,6 +40,7 @@ var HTTPRouteRewritePath = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "rewrite-path", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) testCases := []http.ExpectedResponse{ { diff --git a/conformance/tests/httproute-simple-same-namespace.go b/conformance/tests/httproute-simple-same-namespace.go index 910b901d52..22080e1c83 100644 --- a/conformance/tests/httproute-simple-same-namespace.go +++ b/conformance/tests/httproute-simple-same-namespace.go @@ -40,6 +40,7 @@ var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{ routeNN := types.NamespacedName{Name: "gateway-conformance-infra-test", Namespace: string(ns)} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: string(ns)} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) { http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{ diff --git a/conformance/utils/kubernetes/helpers.go b/conformance/utils/kubernetes/helpers.go index e79542fedc..ddab6fb226 100644 --- a/conformance/utils/kubernetes/helpers.go +++ b/conformance/utils/kubernetes/helpers.go @@ -556,6 +556,16 @@ func HTTPRouteMustHaveCondition(t *testing.T, client client.Client, timeoutConfi require.NoErrorf(t, waitErr, "error waiting for HTTPRoute status to have a Condition matching expectations") } +// HTTPRouteMustHaveResolvedRefsConditionsTrue checks that the supplied HTTPRoute has the resolvedRefsCondition +// set to true. +func HTTPRouteMustHaveResolvedRefsConditionsTrue(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeNN types.NamespacedName, gwNN types.NamespacedName) { + HTTPRouteMustHaveCondition(t, client, timeoutConfig, routeNN, gwNN, metav1.Condition{ + Type: string(v1beta1.RouteConditionResolvedRefs), + Status: metav1.ConditionTrue, + Reason: string(v1beta1.RouteReasonResolvedRefs), + }) +} + func parentRefToString(p v1beta1.ParentReference) string { if p.Namespace != nil && *p.Namespace != "" { return fmt.Sprintf("%v/%v", p.Namespace, p.Name) From 49fc7c65562b77586fe6858ec941c7fd86818162 Mon Sep 17 00:00:00 2001 From: Shane Utt Date: Tue, 14 Mar 2023 11:10:26 -0400 Subject: [PATCH 11/14] chore: update release to v0.6.2 Signed-off-by: Shane Utt --- .../experimental/gateway.networking.k8s.io_gatewayclasses.yaml | 2 +- config/crd/experimental/gateway.networking.k8s.io_gateways.yaml | 2 +- .../crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml | 2 +- .../crd/experimental/gateway.networking.k8s.io_httproutes.yaml | 2 +- .../experimental/gateway.networking.k8s.io_referencegrants.yaml | 2 +- .../crd/experimental/gateway.networking.k8s.io_tcproutes.yaml | 2 +- .../crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml | 2 +- .../crd/experimental/gateway.networking.k8s.io_udproutes.yaml | 2 +- .../crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml | 2 +- config/crd/standard/gateway.networking.k8s.io_gateways.yaml | 2 +- config/crd/standard/gateway.networking.k8s.io_httproutes.yaml | 2 +- .../crd/standard/gateway.networking.k8s.io_referencegrants.yaml | 2 +- config/webhook/admission_webhook.yaml | 2 +- hack/verify-examples-kind.sh | 2 +- pkg/generator/main.go | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml b/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml index ec036fad3b..9f518de794 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: gatewayclasses.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml b/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml index ed5e32d92c..4439ed0139 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: gateways.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml index 388f5b9d5c..34b4b310c1 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: grpcroutes.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml index 29aa0a4719..6425d31fd2 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: httproutes.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml b/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml index da6b472415..8ae9b12415 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_referencegrants.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: referencegrants.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml index af2fbd5aae..7d3e0c7e81 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: tcproutes.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml index aceddb9dd2..162d6589de 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: tlsroutes.gateway.networking.k8s.io diff --git a/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml index 857518c9b4..a27b23c223 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: experimental creationTimestamp: null name: udproutes.gateway.networking.k8s.io diff --git a/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml b/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml index 5503969e26..0af1bf3421 100644 --- a/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: standard creationTimestamp: null name: gatewayclasses.gateway.networking.k8s.io diff --git a/config/crd/standard/gateway.networking.k8s.io_gateways.yaml b/config/crd/standard/gateway.networking.k8s.io_gateways.yaml index 2cf3f1e51f..6572db7830 100644 --- a/config/crd/standard/gateway.networking.k8s.io_gateways.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_gateways.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: standard creationTimestamp: null name: gateways.gateway.networking.k8s.io diff --git a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml index 05dc074b69..4fc5272a3f 100644 --- a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: standard creationTimestamp: null name: httproutes.gateway.networking.k8s.io diff --git a/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml b/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml index 44595d02fb..7eb99d2265 100644 --- a/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1538 - gateway.networking.k8s.io/bundle-version: v0.6.1 + gateway.networking.k8s.io/bundle-version: v0.6.2 gateway.networking.k8s.io/channel: standard creationTimestamp: null name: referencegrants.gateway.networking.k8s.io diff --git a/config/webhook/admission_webhook.yaml b/config/webhook/admission_webhook.yaml index 3906036e1d..2a65e16795 100644 --- a/config/webhook/admission_webhook.yaml +++ b/config/webhook/admission_webhook.yaml @@ -56,7 +56,7 @@ spec: spec: containers: - name: webhook - image: gcr.io/k8s-staging-gateway-api/admission-server:v0.6.1 + image: gcr.io/k8s-staging-gateway-api/admission-server:v0.6.2 imagePullPolicy: Always args: - -logtostderr diff --git a/hack/verify-examples-kind.sh b/hack/verify-examples-kind.sh index 294efd2100..bae8703eb8 100755 --- a/hack/verify-examples-kind.sh +++ b/hack/verify-examples-kind.sh @@ -22,7 +22,7 @@ readonly GO111MODULE="on" readonly GOFLAGS="-mod=readonly" readonly GOPATH="$(mktemp -d)" readonly CLUSTER_NAME="verify-gateway-api" -readonly ADMISSION_WEBHOOK_VERSION="v0.6.1" +readonly ADMISSION_WEBHOOK_VERSION="v0.6.2" export KUBECONFIG="${GOPATH}/.kubeconfig" export GOFLAGS GO111MODULE GOPATH diff --git a/pkg/generator/main.go b/pkg/generator/main.go index ec5d383a5f..3a6b4d0f9b 100644 --- a/pkg/generator/main.go +++ b/pkg/generator/main.go @@ -35,7 +35,7 @@ const ( channelAnnotation = "gateway.networking.k8s.io/channel" // These values must be updated during the release process - bundleVersion = "v0.6.1" + bundleVersion = "v0.6.2" approvalLink = "https://github.com/kubernetes-sigs/gateway-api/pull/1538" ) From 2324c2c78efa5fe85e52d0d4a8180127b06b0227 Mon Sep 17 00:00:00 2001 From: Shane Utt Date: Tue, 14 Mar 2023 11:24:32 -0400 Subject: [PATCH 12/14] docs: add CHANGELOG entry for v0.6.2 --- CHANGELOG.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15070f5477..ad864a4b95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Table of Contents +- [v0.6.2](#v062) - [v0.6.1](#v061) - [v0.6.0](#v060) - [v0.6.0-rc2](#v060-rc2) @@ -22,6 +23,55 @@ - [v0.1.0-rc2](#v010-rc2) - [v0.1.0-rc1](#v010-rc1) +# v0.6.2 + +This is a patch release that predominantly includes updated conformance tests +for implementations to implement. + +For all major changes since the `v0.5.x` release series, please see the +[v0.6.0](/#v060) release notes. + +## Maintenance + +- As per [changes in upstream to container image registries] we replaced all + usage of the k8s.gcr.io registry with registry.k8s.io. + (#1736, @shaneutt) + +[changes in upstream to container image registries]:https://github.com/kubernetes/k8s.io/issues/4738 + +## Bug Fixes + +- Fix invalid HTTP redirect/rewrite examples. + (#1787, @Xunzhuo) + +## Conformance Test Updates + +- The `HTTPRouteInvalidCrossNamespaceParentRef` conformance test now checks for + the `NotAllowedByListeners` reason on the `HTTPRoute`'s `Accepted: false` + condition to better indicate why the route was note accepted. + (#1714, @skriss) +- A conformance test was added for `HTTPRoute` to cover the behavior of a + non-matching `SectionName` similar to what was already present for + `ListenerPort`. + (#1719, @zaunist) +- Fixed an issue where tests may fail erroneously on the removal of resources + that are already removed. + (#1745, @mlavacca) +- Logging in conformance utilities related to resource's `ObservedGeneration` + has been improved to emit the `ObservedGenerations that are found for the + purpose of making it easier to debug test failures and be more verbose about + the objects in question. + (#1761, @briantkennedy) + (#1763, @briantkennedy) +- Patch instead of update in some places in conformance tests to reduce noise + in logs. + (#1760, @michaelbeaumont) +- Added `AttachedRoutes` testing to conformance tests. + (#1624, @ChaningHwang) +- The conformance tests always check that the HTTPRoute ResolvedRefs condition + is enforced, even when the status is true. + (#1668, @mlavacca) + # v0.6.1 This is a patch release that predominantly includes updated conformance tests From b9d5351349d0ce76ab13b872e03fc5d847b1f859 Mon Sep 17 00:00:00 2001 From: Shane Utt Date: Tue, 14 Mar 2023 13:59:40 -0400 Subject: [PATCH 13/14] fix: use ListenerConditionAccepted for listener conds instead of RouteConditionAccepted --- conformance/tests/gateway-with-attached-routes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conformance/tests/gateway-with-attached-routes.go b/conformance/tests/gateway-with-attached-routes.go index 1f552ff233..14ca1d711b 100644 --- a/conformance/tests/gateway-with-attached-routes.go +++ b/conformance/tests/gateway-with-attached-routes.go @@ -45,7 +45,7 @@ var GatewayWithAttachedRoutes = suite.ConformanceTest{ Kind: v1beta1.Kind("HTTPRoute"), }}, Conditions: []metav1.Condition{{ - Type: string(v1beta1.RouteConditionAccepted), + Type: string(v1beta1.ListenerConditionAccepted), Status: metav1.ConditionTrue, Reason: "", //any reason }}, @@ -64,7 +64,7 @@ var GatewayWithAttachedRoutes = suite.ConformanceTest{ Kind: v1beta1.Kind("HTTPRoute"), }}, Conditions: []metav1.Condition{{ - Type: string(v1beta1.RouteConditionAccepted), + Type: string(v1beta1.ListenerConditionAccepted), Status: metav1.ConditionTrue, Reason: "", //any reason }}, From abdc042057572a1a85919629a7a3a564cb367b9a Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Wed, 15 Mar 2023 07:32:16 -0700 Subject: [PATCH 14/14] Merge pull request #1819 from mlavacca/resolvedrefs-condition-fix resolvedRefs condition additional checks --- .../tests/httproute-invalid-cross-namespace-parent-ref.go | 1 + .../tests/httproute-invalid-cross-namespace-parent-ref.yaml | 1 + ...httproute-invalid-parentref-not-matching-listener-port.go | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go index 39c001d769..316cc8aaf9 100644 --- a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go +++ b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.go @@ -38,6 +38,7 @@ var HTTPRouteInvalidCrossNamespaceParentRef = suite.ConformanceTest{ Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} routeNN := types.NamespacedName{Name: "invalid-cross-namespace-parent-ref", Namespace: "gateway-conformance-web-backend"} + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) // When running conformance tests, implementations are expected to have visibility across all namespaces, and // must be setting this condition on routes that are not allowed. However, outside of conformance testing, diff --git a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.yaml b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.yaml index 7e5810b3ff..aed587f2e1 100644 --- a/conformance/tests/httproute-invalid-cross-namespace-parent-ref.yaml +++ b/conformance/tests/httproute-invalid-cross-namespace-parent-ref.yaml @@ -6,6 +6,7 @@ metadata: spec: parentRefs: - name: same-namespace + namespace: gateway-conformance-infra rules: - backendRefs: - name: web-backend diff --git a/conformance/tests/httproute-invalid-parentref-not-matching-listener-port.go b/conformance/tests/httproute-invalid-parentref-not-matching-listener-port.go index 9b9ddb95cb..ccb8c4f2a4 100644 --- a/conformance/tests/httproute-invalid-parentref-not-matching-listener-port.go +++ b/conformance/tests/httproute-invalid-parentref-not-matching-listener-port.go @@ -39,16 +39,17 @@ var HTTPRouteInvalidParentRefNotMatchingListenerPort = suite.ConformanceTest{ Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { routeNN := types.NamespacedName{Name: "httproute-listener-not-matching-route-port", Namespace: "gateway-conformance-infra"} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"} + kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN) // The Route must have an Accepted Condition with a NoMatchingParent Reason. t.Run("HTTPRoute with no matching port in ParentRef has an Accepted Condition with status False and Reason NoMatchingParent", func(t *testing.T) { - resolvedRefsCond := metav1.Condition{ + acceptedCond := metav1.Condition{ Type: string(v1beta1.RouteConditionAccepted), Status: metav1.ConditionFalse, Reason: string(v1beta1.RouteReasonNoMatchingParent), } - kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, resolvedRefsCond) + kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, acceptedCond) }) t.Run("Route should not have Parents accepted in status", func(t *testing.T) {