diff --git a/internal/e2e/cds_test.go b/internal/e2e/cds_test.go index b73708785ab..069f49a346d 100644 --- a/internal/e2e/cds_test.go +++ b/internal/e2e/cds_test.go @@ -63,12 +63,10 @@ func TestClusterLongServiceName(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kbujbkuh-c83ceb/8080/da39a3ee5e", "default/kbujbkuhdod66gjdmwmijz8xzgsx1nkfbrloezdjiulquzk4x3p0nnvpzi8r", "default_kbujbkuhdod66gjdmwmijz8xzgsx1nkfbrloezdjiulquzk4x3p0nnvpzi8r_8080")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -125,12 +123,10 @@ func TestClusterAddUpdateDelete(t *testing.T) { rh.OnAdd(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // s2 is the same as s2, but the service port has a name @@ -146,12 +142,10 @@ func TestClusterAddUpdateDelete(t *testing.T) { // check that we get two CDS records because the port is now named. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard/http", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // s3 is like s2, but has a second named port. The k8s spec @@ -177,13 +171,11 @@ func TestClusterAddUpdateDelete(t *testing.T) { // check that we get four CDS records. Order is important // because the CDS cache is sorted. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/443/da39a3ee5e", "default/kuard/https", "default_kuard_443")), any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard/http", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // s4 is s3 with the http port removed. @@ -202,12 +194,10 @@ func TestClusterAddUpdateDelete(t *testing.T) { // check that we get two CDS records only, and that the 80 and http // records have been removed even though the service object remains. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/443/da39a3ee5e", "default/kuard/https", "default_kuard_443")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -262,13 +252,11 @@ func TestClusterRenameUpdateDelete(t *testing.T) { rh.OnAdd(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/443/da39a3ee5e", "default/kuard/https", "default_kuard_443")), any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard/http", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // s2 removes the name on port 80, moves it to port 443 and deletes the https port @@ -282,33 +270,27 @@ func TestClusterRenameUpdateDelete(t *testing.T) { rh.OnUpdate(s1, s2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/443/da39a3ee5e", "default/kuard", "default_kuard_443")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // now replace s2 with s1 to check it works in the other direction. rh.OnUpdate(s2, s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/443/da39a3ee5e", "default/kuard/https", "default_kuard_443")), any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard/http", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // cleanup and check rh.OnDelete(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: clusterType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: clusterType, }, streamCDS(t, cc)) } @@ -341,12 +323,10 @@ func TestIssue243(t *testing.T) { ) rh.OnAdd(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) }) } @@ -384,12 +364,10 @@ func TestIssue247(t *testing.T) { ) rh.OnAdd(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } func TestCDSResourceFiltering(t *testing.T) { @@ -443,32 +421,26 @@ func TestCDSResourceFiltering(t *testing.T) { ) rh.OnAdd(s2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ // note, resources are sorted by Cluster.Name any(t, cluster("default/httpbin/8080/da39a3ee5e", "default/httpbin", "default_httpbin_8080")), any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // assert we can filter on one resource assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc, "default/kuard/80/da39a3ee5e")) // assert a non matching filter returns no results // note: streamCDS would stall at this point. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - TypeUrl: clusterType, - Nonce: "0", + TypeUrl: clusterType, }, streamCDS(t, cc, "default/httpbin/9000")) } @@ -509,7 +481,6 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Cluster{ Name: "default/kuard/8080/da39a3ee5e", @@ -533,7 +504,6 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { }), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) // update s1 with slightly weird values @@ -555,7 +525,6 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Cluster{ Name: "default/kuard/8080/da39a3ee5e", @@ -576,7 +545,6 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { }), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -626,12 +594,10 @@ func TestClusterPerServiceParameters(t *testing.T) { }) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, cluster("default/kuard/80/da39a3ee5e", "default/kuard", "default_kuard_80")), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -681,7 +647,6 @@ func TestClusterLoadBalancerStrategyPerRoute(t *testing.T) { }) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Cluster{ Name: "default/kuard/80/58d888c08a", @@ -709,7 +674,6 @@ func TestClusterLoadBalancerStrategyPerRoute(t *testing.T) { }), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -753,12 +717,10 @@ func TestClusterWithHealthChecks(t *testing.T) { }) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, clusterWithHealthCheck("default/kuard/80/bc862a33ca", "default/kuard", "default_kuard_80", "/healthz", true)), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } @@ -804,12 +766,10 @@ func TestClusterServiceTLSBackend(t *testing.T) { want := tlscluster("default/kuard/443/da39a3ee5e", "default/kuard/securebackend", "default_kuard_443") assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, want), }, TypeUrl: clusterType, - Nonce: "0", }, streamCDS(t, cc)) } diff --git a/internal/e2e/eds_test.go b/internal/e2e/eds_test.go index 0b17d8cfbd3..392fcc78156 100644 --- a/internal/e2e/eds_test.go +++ b/internal/e2e/eds_test.go @@ -57,7 +57,6 @@ func TestAddRemoveEndpoints(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, clusterloadassignment( "super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/http", @@ -71,17 +70,14 @@ func TestAddRemoveEndpoints(t *testing.T) { )), }, TypeUrl: endpointType, - Nonce: "0", }, streamEDS(t, cc)) // remove e1 and check that the EDS cache is now empty. rh.OnDelete(e1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: endpointType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: endpointType, }, streamEDS(t, cc)) } @@ -139,7 +135,6 @@ func TestAddEndpointComplicated(t *testing.T) { rh.OnAdd(e1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, clusterloadassignment( "default/kuard/admin", @@ -153,7 +148,6 @@ func TestAddEndpointComplicated(t *testing.T) { )), }, TypeUrl: endpointType, - Nonce: "0", }, streamEDS(t, cc)) } @@ -199,7 +193,6 @@ func TestEndpointFilter(t *testing.T) { rh.OnAdd(e1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, clusterloadassignment( "default/kuard/foo", @@ -208,13 +201,10 @@ func TestEndpointFilter(t *testing.T) { )), }, TypeUrl: endpointType, - Nonce: "0", }, streamEDS(t, cc, "default/kuard/foo")) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - TypeUrl: endpointType, - Nonce: "0", + TypeUrl: endpointType, }, streamEDS(t, cc, "default/kuard/bar")) } @@ -235,12 +225,10 @@ func TestIssue602(t *testing.T) { // Assert endpoint was added assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, clusterloadassignment("default/simple", envoy.LBEndpoint("192.168.183.24", 8080))), }, TypeUrl: endpointType, - Nonce: "0", }, streamEDS(t, cc)) // e2 is the same as e1, but without endpoint subsets @@ -248,10 +236,8 @@ func TestIssue602(t *testing.T) { rh.OnUpdate(e1, e2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: endpointType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: endpointType, }, streamEDS(t, cc)) } diff --git a/internal/e2e/lds_test.go b/internal/e2e/lds_test.go index bf837f74522..7616d25a34d 100644 --- a/internal/e2e/lds_test.go +++ b/internal/e2e/lds_test.go @@ -47,10 +47,8 @@ func TestNonTLSListener(t *testing.T) { // assert that without any ingress objects registered // there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // i1 is a simple ingress, no hostname, no tls. @@ -67,7 +65,6 @@ func TestNonTLSListener(t *testing.T) { // add it and assert that we now have a ingress_http listener rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -76,7 +73,6 @@ func TestNonTLSListener(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // i2 is the same as i1 but has the kubernetes.io/ingress.allow-http: "false" annotation @@ -96,10 +92,8 @@ func TestNonTLSListener(t *testing.T) { // update i1 to i2 and verify that ingress_http has gone. rh.OnUpdate(i1, i2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // i3 is similar to i2, but uses the ingress.kubernetes.io/force-ssl-redirect: "true" annotation @@ -120,7 +114,6 @@ func TestNonTLSListener(t *testing.T) { // update i2 to i3 and check that ingress_http has returned rh.OnUpdate(i2, i3) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -129,7 +122,6 @@ func TestNonTLSListener(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -169,16 +161,13 @@ func TestTLSListener(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // add ingress and assert the existence of ingress_http and ingres_https rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -195,7 +184,6 @@ func TestTLSListener(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // i2 is the same as i1 but has the kubernetes.io/ingress.allow-http: "false" annotation @@ -219,7 +207,6 @@ func TestTLSListener(t *testing.T) { // update i1 to i2 and verify that ingress_http has gone. rh.OnUpdate(i1, i2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_https", @@ -231,16 +218,13 @@ func TestTLSListener(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // delete secret and assert that ingress_https is removed rh.OnDelete(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) } @@ -313,10 +297,8 @@ func TestIngressRouteTLSListener(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) l1 := &v2.Listener{ @@ -333,7 +315,6 @@ func TestIngressRouteTLSListener(t *testing.T) { // add ingress and assert the existence of ingress_http and ingres_https rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -343,13 +324,11 @@ func TestIngressRouteTLSListener(t *testing.T) { any(t, l1), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // delete secret and assert that ingress_https is removed rh.OnDelete(s1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -358,7 +337,6 @@ func TestIngressRouteTLSListener(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) rh.OnDelete(i1) @@ -378,7 +356,6 @@ func TestIngressRouteTLSListener(t *testing.T) { // add ingress and assert the existence of ingress_http and ingres_https rh.OnAdd(i2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -388,7 +365,6 @@ func TestIngressRouteTLSListener(t *testing.T) { any(t, l2), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -429,7 +405,6 @@ func TestLDSFilter(t *testing.T) { // add ingress and fetch ingress_https rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_https", @@ -441,12 +416,10 @@ func TestLDSFilter(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc, "ingress_https")) // fetch ingress_http assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ @@ -456,13 +429,11 @@ func TestLDSFilter(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc, "ingress_http")) // fetch something non existent. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - TypeUrl: listenerType, Nonce: "0", + TypeUrl: listenerType, }, streamLDS(t, cc, "HTTP")) } @@ -472,8 +443,7 @@ func TestLDSStreamEmpty(t *testing.T) { // assert that streaming LDS with no ingresses does not stall. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - TypeUrl: listenerType, Nonce: "0", + TypeUrl: listenerType, }, streamLDS(t, cc, "HTTP")) } @@ -514,7 +484,6 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { // add ingress and fetch ingress_https rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_https", @@ -526,7 +495,6 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc, "ingress_https")) i2 := &v1beta1.Ingress{ @@ -561,12 +529,10 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { l1.FilterChains[0].TlsContext.CommonTlsContext.TlsParams.TlsMinimumProtocolVersion = auth.TlsParameters_TLSv1_3 assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, l1), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc, "ingress_https")) } @@ -579,10 +545,8 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { // assert that without any ingress objects registered // there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // i1 is a simple ingress, no hostname, no tls. @@ -600,7 +564,6 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { // the proxy protocol (the true param to filterchain) rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -612,7 +575,6 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -654,10 +616,8 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // add ingress and assert the existence of ingress_http and ingres_https and both @@ -674,7 +634,6 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { FilterChains: filterchaintls("kuard.example.com", envoy.HTTPConnectionManager("ingress_https", "/dev/stdout"), "h2", "http/1.1"), } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -687,7 +646,6 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { any(t, ingress_https), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -732,10 +690,8 @@ func TestLDSCustomAddressAndPort(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // add ingress and assert the existence of ingress_http and ingres_https and both @@ -756,13 +712,11 @@ func TestLDSCustomAddressAndPort(t *testing.T) { FilterChains: filterchaintls("kuard.example.com", envoy.HTTPConnectionManager("ingress_https", "/dev/stdout"), "h2", "http/1.1"), } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), any(t, ingress_https), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -805,10 +759,8 @@ func TestLDSCustomAccessLogPaths(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) rh.OnAdd(i1) @@ -827,13 +779,11 @@ func TestLDSCustomAccessLogPaths(t *testing.T) { FilterChains: filterchaintls("kuard.example.com", envoy.HTTPConnectionManager("ingress_https", "/tmp/https_access.log"), "h2", "http/1.1"), } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), any(t, ingress_https), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -848,10 +798,8 @@ func TestLDSIngressRouteInsideRootNamespaces(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // ir1 is an ingressroute that is in the root namespace @@ -877,7 +825,6 @@ func TestLDSIngressRouteInsideRootNamespaces(t *testing.T) { // assert there is an active listener assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.Listener{ Name: "ingress_http", @@ -886,7 +833,6 @@ func TestLDSIngressRouteInsideRootNamespaces(t *testing.T) { }), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -901,10 +847,8 @@ func TestLDSIngressRouteOutsideRootNamespaces(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // ir1 is an ingressroute that is not in the root namespaces @@ -930,10 +874,8 @@ func TestLDSIngressRouteOutsideRootNamespaces(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) } @@ -948,10 +890,8 @@ func TestIngressRouteHTTPS(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // s1 is a tls secret @@ -1010,13 +950,11 @@ func TestIngressRouteHTTPS(t *testing.T) { FilterChains: filterchaintls("example.com", envoy.HTTPConnectionManager("ingress_https", "/dev/stdout"), "h2", "http/1.1"), } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingressHTTP), any(t, ingressHTTPS), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -1079,12 +1017,10 @@ func TestLDSIngressRouteTCPProxyTLSPassthrough(t *testing.T) { } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingressHTTPS), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -1150,12 +1086,10 @@ func TestLDSIngressRouteTCPForward(t *testing.T) { } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingressHTTPS), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } @@ -1166,10 +1100,8 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { // assert that there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", - Resources: []types.Any{}, - TypeUrl: listenerType, - Nonce: "0", + Resources: []types.Any{}, + TypeUrl: listenerType, }, streamLDS(t, cc)) // add a secret object secret/wildcard. @@ -1215,12 +1147,10 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { // assert there is no ingress_https because there is no matching secret. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // t1 is a TLSCertificateDelegation that permits default to access secret/wildcard @@ -1250,13 +1180,11 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { } assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), any(t, ingress_https), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // t2 is a TLSCertificateDelegation that permits access to secret/wildcard from all namespaces. @@ -1277,13 +1205,11 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { rh.OnUpdate(t1, t2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), any(t, ingress_https), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // t3 is a TLSCertificateDelegation that permits access to secret/different all namespaces. @@ -1304,12 +1230,10 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { rh.OnUpdate(t2, t3) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) // t4 is a TLSCertificateDelegation that permits access to secret/wildcard from the kube-secret namespace. @@ -1330,12 +1254,10 @@ func TestIngressRouteTLSCertificateDelegation(t *testing.T) { rh.OnUpdate(t3, t4) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, ingress_http), }, TypeUrl: listenerType, - Nonce: "0", }, streamLDS(t, cc)) } diff --git a/internal/e2e/rds_test.go b/internal/e2e/rds_test.go index 6078fa91df6..797a86a093f 100644 --- a/internal/e2e/rds_test.go +++ b/internal/e2e/rds_test.go @@ -99,7 +99,6 @@ func TestEditIngress(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -117,7 +116,6 @@ func TestEditIngress(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) // update old to new @@ -142,7 +140,6 @@ func TestEditIngress(t *testing.T) { // check that ingress_http has been updated. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -160,7 +157,6 @@ func TestEditIngress(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } @@ -221,7 +217,6 @@ func TestIngressPathRouteWithoutHost(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -239,7 +234,6 @@ func TestIngressPathRouteWithoutHost(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } @@ -301,7 +295,6 @@ func TestEditIngressInPlace(t *testing.T) { rh.OnAdd(s2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -319,7 +312,6 @@ func TestEditIngressInPlace(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) // i2 is like i1 but adds a second route @@ -350,7 +342,6 @@ func TestEditIngressInPlace(t *testing.T) { } rh.OnUpdate(i1, i2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -371,7 +362,6 @@ func TestEditIngressInPlace(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) // i3 is like i2, but adds the ingress.kubernetes.io/force-ssl-redirect: "true" annotation @@ -407,7 +397,6 @@ func TestEditIngressInPlace(t *testing.T) { } rh.OnUpdate(i2, i3) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -425,7 +414,6 @@ func TestEditIngressInPlace(t *testing.T) { any(t, &v2.RouteConfiguration{Name: "ingress_https"}), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) rh.OnAdd(&v1.Secret{ @@ -477,7 +465,6 @@ func TestEditIngressInPlace(t *testing.T) { } rh.OnUpdate(i3, i4) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -507,7 +494,6 @@ func TestEditIngressInPlace(t *testing.T) { }}}), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } @@ -956,7 +942,6 @@ func TestRDSFilter(t *testing.T) { rh.OnAdd(s2) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -974,11 +959,9 @@ func TestRDSFilter(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc, "ingress_http")) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_https", @@ -996,7 +979,6 @@ func TestRDSFilter(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc, "ingress_https")) } @@ -1264,7 +1246,6 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { }) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -1289,7 +1270,6 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc, "ingress_http")) } @@ -1338,7 +1318,6 @@ func TestRDSIngressRouteInsideRootNamespaces(t *testing.T) { rh.OnAdd(ir1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -1353,7 +1332,6 @@ func TestRDSIngressRouteInsideRootNamespaces(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc, "ingress_http")) } @@ -1402,14 +1380,12 @@ func TestRDSIngressRouteOutsideRootNamespaces(t *testing.T) { rh.OnAdd(ir1) assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc, "ingress_http")) } @@ -1991,7 +1967,6 @@ func TestRouteWithTLS(t *testing.T) { // check that ingress_http has been updated. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -2015,7 +1990,6 @@ func TestRouteWithTLS(t *testing.T) { }}}), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } func TestRouteWithTLS_InsecurePaths(t *testing.T) { @@ -2094,7 +2068,6 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { // check that ingress_http has been updated. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -2128,7 +2101,6 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { }}}), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } @@ -2317,7 +2289,6 @@ func TestBuilderExternalPort(t *testing.T) { // check that it's been translated correctly. assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -2343,14 +2314,12 @@ func TestBuilderExternalPort(t *testing.T) { }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } func assertRDS(t *testing.T, cc *grpc.ClientConn, ingress_http, ingress_https []route.VirtualHost) { t.Helper() assertEqual(t, &v2.DiscoveryResponse{ - VersionInfo: "0", Resources: []types.Any{ any(t, &v2.RouteConfiguration{ Name: "ingress_http", @@ -2362,7 +2331,6 @@ func assertRDS(t *testing.T, cc *grpc.ClientConn, ingress_http, ingress_https [] }), }, TypeUrl: routeType, - Nonce: "0", }, streamRDS(t, cc)) } diff --git a/internal/grpc/xds.go b/internal/grpc/xds.go index 9718d5d6fd4..c14f594205a 100644 --- a/internal/grpc/xds.go +++ b/internal/grpc/xds.go @@ -40,10 +40,10 @@ func (xh *xdsHandler) fetch(req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, er } resources, err := toAny(r, toFilter(req.ResourceNames)) return &v2.DiscoveryResponse{ - VersionInfo: "0", + VersionInfo: req.VersionInfo, Resources: resources, TypeUrl: r.TypeURL(), - Nonce: "0", + Nonce: req.ResponseNonce, }, err } @@ -117,10 +117,10 @@ func (xh *xdsHandler) stream(st grpcStream) (err error) { } resp := &v2.DiscoveryResponse{ - VersionInfo: "0", + VersionInfo: req.VersionInfo, Resources: resources, TypeUrl: r.TypeURL(), - Nonce: "0", + Nonce: req.ResponseNonce, } if err := st.Send(resp); err != nil { return err