diff --git a/cmd/contour/serve.go b/cmd/contour/serve.go index a428f5f0dd5..4cb87954486 100644 --- a/cmd/contour/serve.go +++ b/cmd/contour/serve.go @@ -29,6 +29,7 @@ import ( contourv1 "github.com/projectcontour/contour/apis/projectcontour/v1" "github.com/projectcontour/contour/internal/annotation" "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" "github.com/projectcontour/contour/internal/dag" "github.com/projectcontour/contour/internal/debug" "github.com/projectcontour/contour/internal/health" @@ -246,7 +247,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { return fmt.Errorf("error parsing request timeout: %w", err) } - listenerConfig := contour.ListenerConfig{ + listenerConfig := contourv2.ListenerConfig{ UseProxyProto: ctx.useProxyProto, HTTPAddress: ctx.httpAddr, HTTPPort: ctx.httpPort, @@ -275,13 +276,13 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { // Endpoints updates are handled directly by the EndpointsTranslator // due to their high update rate and their orthogonal nature. - endpointHandler := contour.NewEndpointsTranslator(log.WithField("context", "endpointstranslator")) + endpointHandler := contourv2.NewEndpointsTranslator(log.WithField("context", "endpointstranslator")) resources := []contour.ResourceCache{ - contour.NewListenerCache(listenerConfig, ctx.statsAddr, ctx.statsPort), - &contour.SecretCache{}, - &contour.RouteCache{}, - &contour.ClusterCache{}, + contourv2.NewListenerCache(listenerConfig, ctx.statsAddr, ctx.statsPort), + &contourv2.SecretCache{}, + &contourv2.RouteCache{}, + &contourv2.ClusterCache{}, endpointHandler, } diff --git a/cmd/contour/servecontext.go b/cmd/contour/servecontext.go index e2b376439c2..b9589b4629e 100644 --- a/cmd/contour/servecontext.go +++ b/cmd/contour/servecontext.go @@ -25,7 +25,7 @@ import ( "strings" "time" - "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -166,8 +166,8 @@ func newServeContext() *serveContext { healthPort: 8000, metricsAddr: "0.0.0.0", metricsPort: 8000, - httpAccessLog: contour.DEFAULT_HTTP_ACCESS_LOG, - httpsAccessLog: contour.DEFAULT_HTTPS_ACCESS_LOG, + httpAccessLog: contourv2.DEFAULT_HTTP_ACCESS_LOG, + httpsAccessLog: contourv2.DEFAULT_HTTPS_ACCESS_LOG, httpAddr: "0.0.0.0", httpsAddr: "0.0.0.0", httpPort: 8080, diff --git a/cmd/contour/shutdownmanager.go b/cmd/contour/shutdownmanager.go index 6837d033bae..69519747f0e 100644 --- a/cmd/contour/shutdownmanager.go +++ b/cmd/contour/shutdownmanager.go @@ -21,12 +21,9 @@ import ( "os" "time" - "github.com/projectcontour/contour/internal/contour" - + contourv2 "github.com/projectcontour/contour/internal/contour/v2" "github.com/prometheus/common/expfmt" - "github.com/sirupsen/logrus" - "gopkg.in/alecthomas/kingpin.v2" ) @@ -43,7 +40,7 @@ const shutdownReadyFile = "/ok" const shutdownReadyCheckInterval = time.Second * 1 func prometheusLabels() []string { - return []string{contour.ENVOY_HTTP_LISTENER, contour.ENVOY_HTTPS_LISTENER} + return []string{contourv2.ENVOY_HTTP_LISTENER, contourv2.ENVOY_HTTPS_LISTENER} } type shutdownmanagerContext struct { diff --git a/internal/contour/cond_test.go b/internal/contour/cond_test.go index 22a61269422..8ff9d6d74f9 100644 --- a/internal/contour/cond_test.go +++ b/internal/contour/cond_test.go @@ -13,7 +13,9 @@ package contour -import "testing" +import ( + "testing" +) func TestCondRegisterBeforeNotifyShouldNotBroadcast(t *testing.T) { var c Cond diff --git a/internal/contour/example_test.go b/internal/contour/example_test.go index 34ca20c40d9..5d0a5f94916 100644 --- a/internal/contour/example_test.go +++ b/internal/contour/example_test.go @@ -11,14 +11,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour_test +package contour import ( "context" "fmt" "time" - - "github.com/projectcontour/contour/internal/contour" ) func ExampleCond() { @@ -26,7 +24,7 @@ func ExampleCond() { defer cancel() ch := make(chan int, 1) last := 0 - var c contour.Cond + var c Cond go func() { for { time.Sleep(100 * time.Millisecond) diff --git a/internal/contour/snapshot.go b/internal/contour/snapshot.go index b25bdfaee8d..b215662f6f6 100644 --- a/internal/contour/snapshot.go +++ b/internal/contour/snapshot.go @@ -18,12 +18,11 @@ import ( "reflect" "strconv" - "github.com/projectcontour/contour/internal/xds" - envoy_xds "github.com/envoyproxy/go-control-plane/pkg/cache/types" "github.com/envoyproxy/go-control-plane/pkg/cache/v2" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/projectcontour/contour/internal/dag" + "github.com/projectcontour/contour/internal/xds" "github.com/sirupsen/logrus" ) diff --git a/internal/contour/cluster.go b/internal/contour/v2/cluster.go similarity index 97% rename from internal/contour/cluster.go rename to internal/contour/v2/cluster.go index 1da40e7b565..2871b9d54d5 100644 --- a/internal/contour/cluster.go +++ b/internal/contour/v2/cluster.go @@ -11,12 +11,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "sort" "sync" + "github.com/projectcontour/contour/internal/contour" + envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/golang/protobuf/proto" @@ -31,7 +33,7 @@ import ( type ClusterCache struct { mu sync.Mutex values map[string]*envoy_api_v2.Cluster - Cond + contour.Cond } // Update replaces the contents of the cache with the supplied map. diff --git a/internal/contour/cluster_test.go b/internal/contour/v2/cluster_test.go similarity index 99% rename from internal/contour/cluster_test.go rename to internal/contour/v2/cluster_test.go index 2916b9bb8fe..073533f540f 100644 --- a/internal/contour/cluster_test.go +++ b/internal/contour/v2/cluster_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "testing" diff --git a/internal/contour/contour_test.go b/internal/contour/v2/contour_test.go similarity index 98% rename from internal/contour/contour_test.go rename to internal/contour/v2/contour_test.go index 6ba4398d420..131dc236974 100644 --- a/internal/contour/contour_test.go +++ b/internal/contour/v2/contour_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( v1 "k8s.io/api/core/v1" diff --git a/internal/contour/endpointstranslator.go b/internal/contour/v2/endpointstranslator.go similarity index 98% rename from internal/contour/endpointstranslator.go rename to internal/contour/v2/endpointstranslator.go index 1476dda7b42..44a69042a27 100644 --- a/internal/contour/endpointstranslator.go +++ b/internal/contour/v2/endpointstranslator.go @@ -11,13 +11,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "fmt" "sort" "sync" + "github.com/projectcontour/contour/internal/contour" + envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_api_v2_endpoint "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" @@ -222,7 +224,7 @@ func (c *EndpointsCache) DeleteEndpoint(ep *v1.Endpoints) { // NewEndpointsTranslator allocates a new endpoints translator. func NewEndpointsTranslator(log logrus.FieldLogger) *EndpointsTranslator { return &EndpointsTranslator{ - Cond: Cond{}, + Cond: contour.Cond{}, FieldLogger: log, entries: map[string]*envoy_api_v2.ClusterLoadAssignment{}, cache: EndpointsCache{ @@ -237,9 +239,9 @@ func NewEndpointsTranslator(log logrus.FieldLogger) *EndpointsTranslator { // ClusterLoadAssignment resources. type EndpointsTranslator struct { // Observer notifies when the endpoints cache has been updated. - Observer Observer + Observer contour.Observer - Cond + contour.Cond logrus.FieldLogger cache EndpointsCache diff --git a/internal/contour/endpointstranslator_test.go b/internal/contour/v2/endpointstranslator_test.go similarity index 99% rename from internal/contour/endpointstranslator_test.go rename to internal/contour/v2/endpointstranslator_test.go index 8add26c69ab..a4fa15d31f6 100644 --- a/internal/contour/endpointstranslator_test.go +++ b/internal/contour/v2/endpointstranslator_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "testing" diff --git a/internal/contour/listener.go b/internal/contour/v2/listener.go similarity index 99% rename from internal/contour/listener.go rename to internal/contour/v2/listener.go index a9221d1d7c6..dedcd194fcb 100644 --- a/internal/contour/listener.go +++ b/internal/contour/v2/listener.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "path" @@ -25,6 +25,7 @@ import ( http "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/golang/protobuf/proto" + "github.com/projectcontour/contour/internal/contour" "github.com/projectcontour/contour/internal/dag" "github.com/projectcontour/contour/internal/envoy" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" @@ -222,7 +223,7 @@ type ListenerCache struct { staticValues map[string]*envoy_api_v2.Listener Config ListenerConfig - Cond + contour.Cond } // NewListenerCache returns an instance of a ListenerCache diff --git a/internal/contour/listener_test.go b/internal/contour/v2/listener_test.go similarity index 99% rename from internal/contour/listener_test.go rename to internal/contour/v2/listener_test.go index e5e26fa5ef3..a2bc798226d 100644 --- a/internal/contour/listener_test.go +++ b/internal/contour/v2/listener_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "path" diff --git a/internal/contour/route.go b/internal/contour/v2/route.go similarity index 99% rename from internal/contour/route.go rename to internal/contour/v2/route.go index d5d91f867ff..fc35d45c6bb 100644 --- a/internal/contour/route.go +++ b/internal/contour/v2/route.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "path" @@ -23,6 +23,7 @@ import ( resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" + "github.com/projectcontour/contour/internal/contour" "github.com/projectcontour/contour/internal/dag" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/protobuf" @@ -33,7 +34,7 @@ import ( type RouteCache struct { mu sync.Mutex values map[string]*envoy_api_v2.RouteConfiguration - Cond + contour.Cond } // Update replaces the contents of the cache with the supplied map. diff --git a/internal/contour/route_test.go b/internal/contour/v2/route_test.go similarity index 99% rename from internal/contour/route_test.go rename to internal/contour/v2/route_test.go index 3a5be179c91..29b3e5140cf 100644 --- a/internal/contour/route_test.go +++ b/internal/contour/v2/route_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "testing" diff --git a/internal/contour/secret.go b/internal/contour/v2/secret.go similarity index 97% rename from internal/contour/secret.go rename to internal/contour/v2/secret.go index aca0257dde6..0fd57a0e4ea 100644 --- a/internal/contour/secret.go +++ b/internal/contour/v2/secret.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "sort" @@ -20,6 +20,7 @@ import ( envoy_api_v2_auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/golang/protobuf/proto" + "github.com/projectcontour/contour/internal/contour" "github.com/projectcontour/contour/internal/dag" "github.com/projectcontour/contour/internal/envoy" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" @@ -31,7 +32,7 @@ import ( type SecretCache struct { mu sync.Mutex values map[string]*envoy_api_v2_auth.Secret - Cond + contour.Cond } // Update replaces the contents of the cache with the supplied map. diff --git a/internal/contour/secret_test.go b/internal/contour/v2/secret_test.go similarity index 99% rename from internal/contour/secret_test.go rename to internal/contour/v2/secret_test.go index 3459d415616..505ebd78935 100644 --- a/internal/contour/secret_test.go +++ b/internal/contour/v2/secret_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "testing" diff --git a/internal/contour/server_test.go b/internal/contour/v2/server_test.go similarity index 95% rename from internal/contour/server_test.go rename to internal/contour/v2/server_test.go index b11c7a1d6d9..a7716e4629f 100644 --- a/internal/contour/server_test.go +++ b/internal/contour/v2/server_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "context" @@ -20,6 +20,8 @@ import ( "testing" "time" + "github.com/projectcontour/contour/internal/contour" + v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" @@ -40,7 +42,7 @@ import ( func TestGRPC(t *testing.T) { // tr and et is recreated before the start of each test. var et *EndpointsTranslator - var eh *EventHandler + var eh *contour.EventHandler tests := map[string]func(*testing.T, *grpc.ClientConn){ "StreamClusters": func(t *testing.T, cc *grpc.ClientConn) { @@ -191,7 +193,7 @@ func TestGRPC(t *testing.T) { t.Run(name, func(t *testing.T) { et = NewEndpointsTranslator(fixture.NewTestLogger(t)) - resources := []ResourceCache{ + resources := []contour.ResourceCache{ NewListenerCache(ListenerConfig{}, "", 0), &SecretCache{}, &RouteCache{}, @@ -199,12 +201,12 @@ func TestGRPC(t *testing.T) { et, } - eh = &EventHandler{ - Observer: dag.ComposeObservers(ObserversOf(resources)...), + eh = &contour.EventHandler{ + Observer: dag.ComposeObservers(contour.ObserversOf(resources)...), FieldLogger: log, } - srv := xds.RegisterServer(xds.NewContourServer(log, ResourcesOf(resources)...), nil) + srv := xds.RegisterServer(xds.NewContourServer(log, contour.ResourcesOf(resources)...), nil) l, err := net.Listen("tcp", "127.0.0.1:0") require.NoError(t, err) done := make(chan error, 1) diff --git a/internal/contour/visitor_test.go b/internal/contour/v2/visitor_test.go similarity index 99% rename from internal/contour/visitor_test.go rename to internal/contour/v2/visitor_test.go index 79e2cf31b6d..ae6490cb4d2 100644 --- a/internal/contour/visitor_test.go +++ b/internal/contour/v2/visitor_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package v2 import ( "testing" diff --git a/internal/featuretests/cluster_test.go b/internal/featuretests/cluster_test.go index e75a8078db8..618012130d8 100644 --- a/internal/featuretests/cluster_test.go +++ b/internal/featuretests/cluster_test.go @@ -19,7 +19,7 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_cluster "github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" "github.com/projectcontour/contour/internal/protobuf" v1 "k8s.io/api/core/v1" @@ -424,9 +424,9 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { DefaultCluster(&envoy_api_v2.Cluster{ Name: "default/kuard/8080/da39a3ee5e", AltStatName: "default_kuard_8080", - ClusterDiscoveryType: v2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), + ClusterDiscoveryType: envoyv2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), EdsClusterConfig: &envoy_api_v2.Cluster_EdsClusterConfig{ - EdsConfig: v2.ConfigSource("contour"), + EdsConfig: envoyv2.ConfigSource("contour"), ServiceName: "default/kuard", }, CircuitBreakers: &envoy_cluster.CircuitBreakers{ @@ -457,9 +457,9 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { DefaultCluster(&envoy_api_v2.Cluster{ Name: "default/kuard/8080/da39a3ee5e", AltStatName: "default_kuard_8080", - ClusterDiscoveryType: v2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), + ClusterDiscoveryType: envoyv2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), EdsClusterConfig: &envoy_api_v2.Cluster_EdsClusterConfig{ - EdsConfig: v2.ConfigSource("contour"), + EdsConfig: envoyv2.ConfigSource("contour"), ServiceName: "default/kuard", }, CircuitBreakers: &envoy_cluster.CircuitBreakers{ @@ -569,9 +569,9 @@ func TestClusterLoadBalancerStrategyPerRoute(t *testing.T) { DefaultCluster(&envoy_api_v2.Cluster{ Name: "default/kuard/80/58d888c08a", AltStatName: "default_kuard_80", - ClusterDiscoveryType: v2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), + ClusterDiscoveryType: envoyv2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), EdsClusterConfig: &envoy_api_v2.Cluster_EdsClusterConfig{ - EdsConfig: v2.ConfigSource("contour"), + EdsConfig: envoyv2.ConfigSource("contour"), ServiceName: "default/kuard", }, LbPolicy: envoy_api_v2.Cluster_RANDOM, @@ -579,9 +579,9 @@ func TestClusterLoadBalancerStrategyPerRoute(t *testing.T) { DefaultCluster(&envoy_api_v2.Cluster{ Name: "default/kuard/80/8bf87fefba", AltStatName: "default_kuard_80", - ClusterDiscoveryType: v2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), + ClusterDiscoveryType: envoyv2.ClusterDiscoveryType(envoy_api_v2.Cluster_EDS), EdsClusterConfig: &envoy_api_v2.Cluster_EdsClusterConfig{ - EdsConfig: v2.ConfigSource("contour"), + EdsConfig: envoyv2.ConfigSource("contour"), ServiceName: "default/kuard", }, LbPolicy: envoy_api_v2.Cluster_LEAST_REQUEST, diff --git a/internal/featuretests/endpoints_test.go b/internal/featuretests/endpoints_test.go index 13bd71e908e..26d3cb06e6e 100644 --- a/internal/featuretests/endpoints_test.go +++ b/internal/featuretests/endpoints_test.go @@ -18,7 +18,7 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" ) @@ -74,16 +74,16 @@ func TestAddRemoveEndpoints(t *testing.T) { Resources: resources(t, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/http", - Endpoints: v2.WeightedEndpoints(1, - v2.SocketAddress("172.16.0.1", 8000), // endpoints and cluster names should be sorted - v2.SocketAddress("172.16.0.2", 8000), + Endpoints: envoyv2.WeightedEndpoints(1, + envoyv2.SocketAddress("172.16.0.1", 8000), // endpoints and cluster names should be sorted + envoyv2.SocketAddress("172.16.0.2", 8000), ), }, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/https", - Endpoints: v2.WeightedEndpoints(1, - v2.SocketAddress("172.16.0.1", 8443), - v2.SocketAddress("172.16.0.2", 8443), + Endpoints: envoyv2.WeightedEndpoints(1, + envoyv2.SocketAddress("172.16.0.1", 8443), + envoyv2.SocketAddress("172.16.0.2", 8443), ), }, ), @@ -95,8 +95,8 @@ func TestAddRemoveEndpoints(t *testing.T) { c.Request(endpointType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v2.ClusterLoadAssignment("super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/http"), - v2.ClusterLoadAssignment("super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/https"), + envoyv2.ClusterLoadAssignment("super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/http"), + envoyv2.ClusterLoadAssignment("super-long-namespace-name-oh-boy/what-a-descriptive-service-name-you-must-be-so-proud/https"), ), TypeUrl: endpointType, }) @@ -166,15 +166,15 @@ func TestAddEndpointComplicated(t *testing.T) { Resources: resources(t, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "default/kuard/admin", - Endpoints: v2.WeightedEndpoints(1, - v2.SocketAddress("10.48.1.77", 9000), - v2.SocketAddress("10.48.1.78", 9000), + Endpoints: envoyv2.WeightedEndpoints(1, + envoyv2.SocketAddress("10.48.1.77", 9000), + envoyv2.SocketAddress("10.48.1.78", 9000), ), }, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "default/kuard/foo", - Endpoints: v2.WeightedEndpoints(1, - v2.SocketAddress("10.48.1.78", 8080), + Endpoints: envoyv2.WeightedEndpoints(1, + envoyv2.SocketAddress("10.48.1.78", 8080), ), }, ), @@ -234,7 +234,7 @@ func TestEndpointFilter(t *testing.T) { Resources: resources(t, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "default/kuard/foo", - Endpoints: v2.WeightedEndpoints(1, v2.SocketAddress("10.48.1.78", 8080)), + Endpoints: envoyv2.WeightedEndpoints(1, envoyv2.SocketAddress("10.48.1.78", 8080)), }, ), }) @@ -242,7 +242,7 @@ func TestEndpointFilter(t *testing.T) { c.Request(endpointType, "default/kuard/bar").Equals(&envoy_api_v2.DiscoveryResponse{ TypeUrl: endpointType, Resources: resources(t, - v2.ClusterLoadAssignment("default/kuard/bar"), + envoyv2.ClusterLoadAssignment("default/kuard/bar"), ), }) } @@ -282,7 +282,7 @@ func TestIssue602(t *testing.T) { Resources: resources(t, &envoy_api_v2.ClusterLoadAssignment{ ClusterName: "default/simple", - Endpoints: v2.WeightedEndpoints(1, v2.SocketAddress("192.168.183.24", 8080)), + Endpoints: envoyv2.WeightedEndpoints(1, envoyv2.SocketAddress("192.168.183.24", 8080)), }, ), TypeUrl: endpointType, @@ -293,7 +293,7 @@ func TestIssue602(t *testing.T) { rh.OnUpdate(e1, e2) c.Request(endpointType).Equals(&envoy_api_v2.DiscoveryResponse{ - Resources: resources(t, v2.ClusterLoadAssignment("default/simple")), + Resources: resources(t, envoyv2.ClusterLoadAssignment("default/simple")), TypeUrl: endpointType, }) } diff --git a/internal/featuretests/envoy.go b/internal/featuretests/envoy.go index 30347be1c88..3c3613b3505 100644 --- a/internal/featuretests/envoy.go +++ b/internal/featuretests/envoy.go @@ -30,7 +30,7 @@ import ( "github.com/envoyproxy/go-control-plane/pkg/wellknown" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" - "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" "github.com/projectcontour/contour/internal/dag" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/protobuf" @@ -291,8 +291,8 @@ func filterchaintlsfallback(fallbackSecret *v1.Secret, peerValidationContext *da envoyv2.Filters( envoyv2.HTTPConnectionManagerBuilder(). DefaultFilters(). - RouteConfigName(contour.ENVOY_FALLBACK_ROUTECONFIG). - MetricsPrefix(contour.ENVOY_HTTPS_LISTENER). + RouteConfigName(contourv2.ENVOY_FALLBACK_ROUTECONFIG). + MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/dev/stdout")). Get(), ), @@ -304,7 +304,7 @@ func httpsFilterFor(vhost string) *envoy_api_v2_listener.Filter { AddFilter(envoyv2.FilterMisdirectedRequests(vhost)). DefaultFilters(). RouteConfigName(path.Join("https", vhost)). - MetricsPrefix(contour.ENVOY_HTTPS_LISTENER). + MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/dev/stdout")). Get() } @@ -326,7 +326,7 @@ func authzFilterFor( }, }). RouteConfigName(path.Join("https", vhost)). - MetricsPrefix(contour.ENVOY_HTTPS_LISTENER). + MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/dev/stdout")). Get() } diff --git a/internal/featuretests/featuretests.go b/internal/featuretests/featuretests.go index 1c029d842d2..b7ef8290f59 100644 --- a/internal/featuretests/featuretests.go +++ b/internal/featuretests/featuretests.go @@ -22,13 +22,14 @@ import ( "testing" "time" - v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" resource "github.com/envoyproxy/go-control-plane/pkg/resource/v2" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" "github.com/projectcontour/contour/internal/dag" "github.com/projectcontour/contour/internal/fixture" "github.com/projectcontour/contour/internal/k8s" @@ -62,20 +63,20 @@ func setup(t *testing.T, opts ...interface{}) (cache.ResourceEventHandler, *Cont log := fixture.NewTestLogger(t) log.SetLevel(logrus.DebugLevel) - et := contour.NewEndpointsTranslator(log) + et := contourv2.NewEndpointsTranslator(log) - conf := contour.ListenerConfig{} + conf := contourv2.ListenerConfig{} for _, opt := range opts { - if opt, ok := opt.(func(*contour.ListenerConfig)); ok { + if opt, ok := opt.(func(*contourv2.ListenerConfig)); ok { opt(&conf) } } resources := []contour.ResourceCache{ - contour.NewListenerCache(conf, statsAddress, statsPort), - &contour.SecretCache{}, - &contour.RouteCache{}, - &contour.ClusterCache{}, + contourv2.NewListenerCache(conf, statsAddress, statsPort), + &contourv2.SecretCache{}, + &contourv2.RouteCache{}, + &contourv2.ClusterCache{}, et, } @@ -231,7 +232,7 @@ func (r *resourceEventHandler) OnDelete(obj interface{}) { // routeResources returns the given routes as a slice of any.Any // resources, appropriately sorted. -func routeResources(t *testing.T, routes ...*v2.RouteConfiguration) []*any.Any { +func routeResources(t *testing.T, routes ...*envoy_api_v2.RouteConfiguration) []*any.Any { sort.Stable(sorter.For(routes)) return resources(t, protobuf.AsMessages(routes)...) } @@ -246,8 +247,8 @@ func resources(t *testing.T, protos ...proto.Message) []*any.Any { } type grpcStream interface { - Send(*v2.DiscoveryRequest) error - Recv() (*v2.DiscoveryResponse, error) + Send(*envoy_api_v2.DiscoveryRequest) error + Recv() (*envoy_api_v2.DiscoveryResponse, error) } type statusResult struct { @@ -340,29 +341,29 @@ func (c *Contour) Request(typeurl string, names ...string) *Response { require.NoError(c, err) st = sts case routeType: - rds := v2.NewRouteDiscoveryServiceClient(c.ClientConn) + rds := envoy_api_v2.NewRouteDiscoveryServiceClient(c.ClientConn) str, err := rds.StreamRoutes(ctx) require.NoError(c, err) st = str case clusterType: - cds := v2.NewClusterDiscoveryServiceClient(c.ClientConn) + cds := envoy_api_v2.NewClusterDiscoveryServiceClient(c.ClientConn) stc, err := cds.StreamClusters(ctx) require.NoError(c, err) st = stc case listenerType: - lds := v2.NewListenerDiscoveryServiceClient(c.ClientConn) + lds := envoy_api_v2.NewListenerDiscoveryServiceClient(c.ClientConn) stl, err := lds.StreamListeners(ctx) require.NoError(c, err) st = stl case endpointType: - eds := v2.NewEndpointDiscoveryServiceClient(c.ClientConn) + eds := envoy_api_v2.NewEndpointDiscoveryServiceClient(c.ClientConn) ste, err := eds.StreamEndpoints(ctx) require.NoError(c, err) st = ste default: c.Fatal("unknown typeURL:", typeurl) } - resp := c.sendRequest(st, &v2.DiscoveryRequest{ + resp := c.sendRequest(st, &envoy_api_v2.DiscoveryRequest{ TypeUrl: typeurl, ResourceNames: names, }) @@ -372,7 +373,7 @@ func (c *Contour) Request(typeurl string, names ...string) *Response { } } -func (c *Contour) sendRequest(stream grpcStream, req *v2.DiscoveryRequest) *v2.DiscoveryResponse { +func (c *Contour) sendRequest(stream grpcStream, req *envoy_api_v2.DiscoveryRequest) *envoy_api_v2.DiscoveryResponse { err := stream.Send(req) require.NoError(c, err) resp, err := stream.Recv() @@ -382,12 +383,12 @@ func (c *Contour) sendRequest(stream grpcStream, req *v2.DiscoveryRequest) *v2.D type Response struct { *Contour - *v2.DiscoveryResponse + *envoy_api_v2.DiscoveryResponse } // Equals tests that the response retrieved from Contour is equal to the supplied value. // TODO(youngnick) This function really should be copied to an `EqualResources` function. -func (r *Response) Equals(want *v2.DiscoveryResponse) *Contour { +func (r *Response) Equals(want *envoy_api_v2.DiscoveryResponse) *Contour { r.Helper() protobuf.RequireEqual(r.T, want.Resources, r.DiscoveryResponse.Resources) diff --git a/internal/featuretests/headercondition_test.go b/internal/featuretests/headercondition_test.go index 99f8f6d0474..960ceda9e45 100644 --- a/internal/featuretests/headercondition_test.go +++ b/internal/featuretests/headercondition_test.go @@ -16,12 +16,11 @@ package featuretests import ( "testing" - v22 "github.com/projectcontour/contour/internal/envoy/v2" - - v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_api_v2_route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" "github.com/projectcontour/contour/internal/dag" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -79,10 +78,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { } rh.OnAdd(proxy1) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/blog", dag.HeaderMatchCondition{ Name: "x-header", @@ -142,10 +141,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy1, proxy2) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/blog", dag.HeaderMatchCondition{ Name: "x-header", @@ -205,10 +204,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy2, proxy3) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/blog", dag.HeaderMatchCondition{ Name: "x-header", @@ -268,10 +267,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy3, proxy4) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/blog", dag.HeaderMatchCondition{ Name: "x-header", @@ -331,10 +330,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy4, proxy5) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/blog", dag.HeaderMatchCondition{ Name: "x-header", @@ -392,10 +391,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy5, proxy6) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/", dag.HeaderMatchCondition{ Name: "x-header", @@ -451,10 +450,10 @@ func TestConditions_ContainsHeader_HTTProxy(t *testing.T) { rh.OnUpdate(proxy6, proxy7) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/", dag.HeaderMatchCondition{ Name: "x-header", diff --git a/internal/featuretests/headerpolicy_test.go b/internal/featuretests/headerpolicy_test.go index 68ffda21028..02fa9b4f41e 100644 --- a/internal/featuretests/headerpolicy_test.go +++ b/internal/featuretests/headerpolicy_test.go @@ -14,17 +14,16 @@ package featuretests import ( + "testing" + + envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_api_v2_core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" envoy_api_v2_route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" "github.com/golang/protobuf/ptypes/wrappers" - v22 "github.com/projectcontour/contour/internal/envoy/v2" + projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" - - "testing" - - v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" - projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -55,10 +54,10 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { }), ) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routeHostRewrite("default/svc1/80/da39a3ee5e", "goodbye.planet"), @@ -88,10 +87,10 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { }), ) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routeCluster("default/svc1/80/da39a3ee5e"), @@ -129,10 +128,10 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { }), ) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routeCluster("default/svc1/80/da39a3ee5e"), @@ -186,10 +185,10 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { }), ) - c.Request(routeType).Equals(&v2.DiscoveryResponse{ + c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: routeResources(t, - v22.RouteConfiguration("ingress_http", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: &envoy_api_v2_route.Route_Redirect{ @@ -201,8 +200,8 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { }, }), ), - v22.RouteConfiguration("https/hello.world", - v22.VirtualHost("hello.world", + envoyv2.RouteConfiguration("https/hello.world", + envoyv2.VirtualHost("hello.world", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routeHostRewrite("default/externalname/443/da39a3ee5e", "goodbye.planet"), @@ -212,7 +211,7 @@ func TestHeaderPolicy_ReplaceHeader_HTTProxy(t *testing.T) { TypeUrl: routeType, }) - c.Request(clusterType).Equals(&v2.DiscoveryResponse{ + c.Request(clusterType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, tlsCluster(externalNameCluster("default/externalname/443/da39a3ee5e", "default/externalname/https", "default_externalname_443", "goodbye.planet", 443), nil, "goodbye.planet", "goodbye.planet"), ), diff --git a/internal/featuretests/listeners_test.go b/internal/featuretests/listeners_test.go index e75c7884cd1..31a2096eb42 100644 --- a/internal/featuretests/listeners_test.go +++ b/internal/featuretests/listeners_test.go @@ -20,9 +20,9 @@ import ( envoy_api_v2_auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" envoy_api_v2_listener "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" "github.com/projectcontour/contour/internal/dag" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" "k8s.io/api/networking/v1beta1" @@ -68,9 +68,9 @@ func TestNonTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains(v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0)), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0)), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), @@ -127,9 +127,9 @@ func TestNonTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains(v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0)), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0)), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), @@ -198,22 +198,22 @@ func TestTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains(v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0)), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0)), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), @@ -256,16 +256,16 @@ func TestTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), @@ -364,16 +364,16 @@ func TestHTTPProxyTLSListener(t *testing.T) { l1 := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", secret1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } // add service @@ -386,11 +386,11 @@ func TestHTTPProxyTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, l1, staticListener(), @@ -413,22 +413,22 @@ func TestHTTPProxyTLSListener(t *testing.T) { rh.OnAdd(secret1) l2 := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ - v2.FilterChainTLS( + envoyv2.FilterChainTLS( "kuard.example.com", - v2.DownstreamTLSContext( + envoyv2.DownstreamTLSContext( &dag.Secret{Object: secret1}, envoy_api_v2_auth.TlsParameters_TLSv1_3, nil, "h2", "http/1.1"), - v2.Filters(httpsFilterFor("kuard.example.com")), + envoyv2.Filters(httpsFilterFor("kuard.example.com")), ), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } // add ingress and assert the existence of ingress_http and ingres_https @@ -437,11 +437,11 @@ func TestHTTPProxyTLSListener(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, l2, staticListener(), @@ -503,16 +503,16 @@ func TestLDSFilter(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, ), TypeUrl: listenerType, @@ -523,11 +523,11 @@ func TestLDSFilter(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, ), TypeUrl: listenerType, @@ -552,7 +552,7 @@ func TestLDSStreamEmpty(t *testing.T) { } func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { - rh, c, done := setup(t, func(conf *contour.ListenerConfig) { + rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { conf.UseProxyProto = true }) defer done() @@ -593,12 +593,12 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - ListenerFilters: v2.ListenerFilters( - v2.ProxyProtocol(), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.ProxyProtocol(), ), - FilterChains: v2.FilterChains(v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0)), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0)), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), @@ -608,7 +608,7 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { } func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { - rh, c, done := setup(t, func(conf *contour.ListenerConfig) { + rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { conf.UseProxyProto = true }) defer done() @@ -670,28 +670,28 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { ingress_https := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.ProxyProtocol(), - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.ProxyProtocol(), + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } c.Request(listenerType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - ListenerFilters: v2.ListenerFilters( - v2.ProxyProtocol(), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.ProxyProtocol(), ), - FilterChains: v2.FilterChains(v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0)), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0)), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, ingress_https, staticListener(), @@ -701,7 +701,7 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { } func TestLDSCustomAddressAndPort(t *testing.T) { - rh, c, done := setup(t, func(conf *contour.ListenerConfig) { + rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { conf.HTTPAddress = "127.0.0.100" conf.HTTPPort = 9100 conf.HTTPSAddress = "127.0.0.200" @@ -768,24 +768,24 @@ func TestLDSCustomAddressAndPort(t *testing.T) { ingress_http := &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("127.0.0.100", 9100), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("127.0.0.100", 9100), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } ingress_https := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("127.0.0.200", 9200), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("127.0.0.200", 9200), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, httpsFilterFor("kuard.example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } c.Request(listenerType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, @@ -798,7 +798,7 @@ func TestLDSCustomAddressAndPort(t *testing.T) { } func TestLDSCustomAccessLogPaths(t *testing.T) { - rh, c, done := setup(t, func(conf *contour.ListenerConfig) { + rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { conf.HTTPAccessLog = "/tmp/http_access.log" conf.HTTPSAccessLog = "/tmp/https_access.log" }) @@ -861,30 +861,30 @@ func TestLDSCustomAccessLogPaths(t *testing.T) { ingress_http := &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/tmp/http_access.log"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/tmp/http_access.log"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } ingress_https := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("kuard.example.com", s1, - v2.HTTPConnectionManagerBuilder(). - AddFilter(v2.FilterMisdirectedRequests("kuard.example.com")). + envoyv2.HTTPConnectionManagerBuilder(). + AddFilter(envoyv2.FilterMisdirectedRequests("kuard.example.com")). DefaultFilters(). RouteConfigName("https/kuard.example.com"). - MetricsPrefix(contour.ENVOY_HTTPS_LISTENER). - AccessLoggers(v2.FileAccessLogEnvoy("/tmp/https_access.log")). + MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). + AccessLoggers(envoyv2.FileAccessLogEnvoy("/tmp/https_access.log")). Get(), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } c.Request(listenerType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", @@ -961,25 +961,25 @@ func TestHTTPProxyHTTPS(t *testing.T) { ingressHTTP := &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } ingressHTTPS := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ filterchaintls("example.com", s1, httpsFilterFor("example.com"), nil, "h2", "http/1.1"), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } c.Request(listenerType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", @@ -994,7 +994,7 @@ func TestHTTPProxyHTTPS(t *testing.T) { } func TestHTTPProxyMinimumTLSVersion(t *testing.T) { - rh, c, done := setup(t, func(conf *contour.ListenerConfig) { + rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { conf.MinimumTLSVersion = envoy_api_v2_auth.TlsParameters_TLSv1_2 }) @@ -1043,22 +1043,22 @@ func TestHTTPProxyMinimumTLSVersion(t *testing.T) { l1 := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ - v2.FilterChainTLS( + envoyv2.FilterChainTLS( "kuard.example.com", - v2.DownstreamTLSContext( + envoyv2.DownstreamTLSContext( &dag.Secret{Object: secret1}, envoy_api_v2_auth.TlsParameters_TLSv1_2, nil, "h2", "http/1.1"), - v2.Filters(httpsFilterFor("kuard.example.com")), + envoyv2.Filters(httpsFilterFor("kuard.example.com")), ), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } // verify that p1's TLS 1.1 minimum has been upgraded to 1.2 @@ -1066,11 +1066,11 @@ func TestHTTPProxyMinimumTLSVersion(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, l1, staticListener(), @@ -1108,22 +1108,22 @@ func TestHTTPProxyMinimumTLSVersion(t *testing.T) { l2 := &envoy_api_v2.Listener{ Name: "ingress_https", - Address: v2.SocketAddress("0.0.0.0", 8443), - ListenerFilters: v2.ListenerFilters( - v2.TLSInspector(), + Address: envoyv2.SocketAddress("0.0.0.0", 8443), + ListenerFilters: envoyv2.ListenerFilters( + envoyv2.TLSInspector(), ), FilterChains: []*envoy_api_v2_listener.FilterChain{ - v2.FilterChainTLS( + envoyv2.FilterChainTLS( "kuard.example.com", - v2.DownstreamTLSContext( + envoyv2.DownstreamTLSContext( &dag.Secret{Object: secret1}, envoy_api_v2_auth.TlsParameters_TLSv1_3, nil, "h2", "http/1.1"), - v2.Filters(httpsFilterFor("kuard.example.com")), + envoyv2.Filters(httpsFilterFor("kuard.example.com")), ), }, - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), } // verify that p2's TLS 1.3 minimum has NOT been downgraded to 1.2 @@ -1131,11 +1131,11 @@ func TestHTTPProxyMinimumTLSVersion(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, l2, staticListener(), @@ -1199,11 +1199,11 @@ func TestLDSHTTPProxyRootCannotDelegateToAnotherRoot(t *testing.T) { Resources: resources(t, &envoy_api_v2.Listener{ Name: "ingress_http", - Address: v2.SocketAddress("0.0.0.0", 8080), - FilterChains: v2.FilterChains( - v2.HTTPConnectionManager("ingress_http", v2.FileAccessLogEnvoy("/dev/stdout"), 0), + Address: envoyv2.SocketAddress("0.0.0.0", 8080), + FilterChains: envoyv2.FilterChains( + envoyv2.HTTPConnectionManager("ingress_http", envoyv2.FileAccessLogEnvoy("/dev/stdout"), 0), ), - SocketOptions: v2.TCPKeepaliveSocketOptions(), + SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), }, staticListener(), ), diff --git a/internal/featuretests/retrypolicy_test.go b/internal/featuretests/retrypolicy_test.go index d625896c1a3..e13ab26044f 100644 --- a/internal/featuretests/retrypolicy_test.go +++ b/internal/featuretests/retrypolicy_test.go @@ -20,7 +20,7 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_api_v2_route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" "k8s.io/api/networking/v1beta1" @@ -54,8 +54,8 @@ func TestRetryPolicy(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: withRetryPolicy(routeCluster("default/backend/80/da39a3ee5e"), "5xx,gateway-error", 7, 120*time.Millisecond), @@ -83,8 +83,8 @@ func TestRetryPolicy(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: withRetryPolicy(routeCluster("default/backend/80/da39a3ee5e"), "5xx,gateway-error", 7, 120*time.Millisecond), @@ -112,8 +112,8 @@ func TestRetryPolicy(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: withRetryPolicy(routeCluster("default/backend/80/da39a3ee5e"), "5xx,gateway-error", 7, 120*time.Millisecond), @@ -149,8 +149,8 @@ func TestRetryPolicy(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ Resources: resources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost(hp1.Spec.VirtualHost.Fqdn, + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost(hp1.Spec.VirtualHost.Fqdn, &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: withRetryPolicy(routeCluster("default/backend/80/da39a3ee5e"), "5xx", 5, 105*time.Second), diff --git a/internal/featuretests/route_test.go b/internal/featuretests/route_test.go index d38b4b289bf..4af32e124ce 100644 --- a/internal/featuretests/route_test.go +++ b/internal/featuretests/route_test.go @@ -24,7 +24,7 @@ import ( projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" "github.com/projectcontour/contour/internal/contour" "github.com/projectcontour/contour/internal/dag" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" "github.com/projectcontour/contour/internal/protobuf" v1 "k8s.io/api/core/v1" @@ -86,8 +86,8 @@ func TestEditIngress(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", &envoy_api_v2_route.Route{ + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), }), @@ -121,8 +121,8 @@ func TestEditIngress(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "2", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", &envoy_api_v2_route.Route{ + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/testing"), Action: routecluster("default/kuard/80/da39a3ee5e"), }), @@ -180,8 +180,8 @@ func TestIngressPathRouteWithoutHost(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "2", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/hello"), Action: routecluster("default/hello/80/da39a3ee5e"), @@ -230,8 +230,8 @@ func TestEditIngressInPlace(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "2", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("hello.example.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/wowie/80/da39a3ee5e"), @@ -273,8 +273,8 @@ func TestEditIngressInPlace(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "3", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("hello.example.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/whoop"), Action: routecluster("default/kerpow/9000/da39a3ee5e"), @@ -325,15 +325,15 @@ func TestEditIngressInPlace(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "4", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("hello.example.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/whoop"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), @@ -391,20 +391,20 @@ func TestEditIngressInPlace(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "5", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("hello.example.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("hello.example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/whoop"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), - v2.RouteConfiguration("https/hello.example.com", - v2.VirtualHost("hello.example.com", + envoyv2.RouteConfiguration("https/hello.example.com", + envoyv2.VirtualHost("hello.example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/whoop"), Action: routecluster("default/kerpow/9000/da39a3ee5e"), @@ -497,18 +497,18 @@ func TestSSLRedirectOverlay(t *testing.T) { WithPorts(v1.ServicePort{Name: "http", Port: 8009, TargetPort: intstr.FromInt(8080)})) assertRDS(t, c, "5", virtualhosts( - v2.VirtualHost("example.com", + envoyv2.VirtualHost("example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk"), Action: routecluster("nginx-ingress/challenge-service/8009/da39a3ee5e"), }, &envoy_api_v2_route.Route{ Match: routePrefix("/"), // match all - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), virtualhosts( - v2.VirtualHost("example.com", + envoyv2.VirtualHost("example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk"), Action: routecluster("nginx-ingress/challenge-service/8009/da39a3ee5e"), @@ -565,7 +565,7 @@ func TestInvalidCertInIngress(t *testing.T) { }) assertRDS(t, c, "1", virtualhosts( - v2.VirtualHost("kuard.io", + envoyv2.VirtualHost("kuard.io", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -584,14 +584,14 @@ func TestInvalidCertInIngress(t *testing.T) { }) assertRDS(t, c, "2", virtualhosts( - v2.VirtualHost("kuard.io", + envoyv2.VirtualHost("kuard.io", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), }, ), ), virtualhosts( - v2.VirtualHost("kuard.io", + envoyv2.VirtualHost("kuard.io", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -639,7 +639,7 @@ func TestIssue257(t *testing.T) { rh.OnAdd(s1) assertRDS(t, c, "2", virtualhosts( - v2.VirtualHost("*", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -692,7 +692,7 @@ func TestIssue257(t *testing.T) { rh.OnUpdate(i1, i2) assertRDS(t, c, "3", virtualhosts( - v2.VirtualHost("kuard.db.gd-ms.com", + envoyv2.VirtualHost("kuard.db.gd-ms.com", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -779,20 +779,20 @@ func TestRDSFilter(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "5", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("example.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk"), Action: routecluster("nginx-ingress/challenge-service/8009/da39a3ee5e"), }, &envoy_api_v2_route.Route{ Match: routePrefix("/"), // match all - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), - v2.RouteConfiguration("https/example.com", - v2.VirtualHost("example.com", + envoyv2.RouteConfiguration("https/example.com", + envoyv2.VirtualHost("example.com", &envoy_api_v2_route.Route{ Match: routePrefix("/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk"), Action: routecluster("nginx-ingress/challenge-service/8009/da39a3ee5e"), @@ -867,8 +867,8 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/kuard"), Action: routecluster("default/kuard/8080/da39a3ee5e"), @@ -878,7 +878,7 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { Action: routecluster("default/kuard/80/da39a3ee5e"), }, ), - v2.VirtualHost("test-gui", + envoyv2.VirtualHost("test-gui", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/test-gui/80/da39a3ee5e"), @@ -920,7 +920,7 @@ func TestRDSIngressClassAnnotation(t *testing.T) { } rh.OnAdd(i1) assertRDS(t, c, "1", virtualhosts( - v2.VirtualHost("*", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/8080/da39a3ee5e"), @@ -981,7 +981,7 @@ func TestRDSIngressClassAnnotation(t *testing.T) { } rh.OnUpdate(i3, i4) assertRDS(t, c, "3", virtualhosts( - v2.VirtualHost("*", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/8080/da39a3ee5e"), @@ -1006,7 +1006,7 @@ func TestRDSIngressClassAnnotation(t *testing.T) { } rh.OnUpdate(i4, i5) assertRDS(t, c, "4", virtualhosts( - v2.VirtualHost("*", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/kuard/8080/da39a3ee5e"), @@ -1116,7 +1116,7 @@ func TestRDSIngressSpecMissingHTTPKey(t *testing.T) { WithPorts(v1.ServicePort{Name: "http", Port: 9001, TargetPort: intstr.FromInt(8080)})) assertRDS(t, c, "2", virtualhosts( - v2.VirtualHost("test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("default/network-test/9001/da39a3ee5e"), @@ -1154,7 +1154,7 @@ func TestRouteWithAServiceWeight(t *testing.T) { rh.OnAdd(p1) assertRDS(t, c, "1", virtualhosts( - v2.VirtualHost("test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -1188,7 +1188,7 @@ func TestRouteWithAServiceWeight(t *testing.T) { rh.OnUpdate(p1, p2) assertRDS(t, c, "2", virtualhosts( - v2.VirtualHost("test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routeweightedcluster( @@ -1245,16 +1245,16 @@ func TestRouteWithTLS(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), Match: routePrefix("/a"), }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -1324,11 +1324,11 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/insecure"), @@ -1336,8 +1336,8 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), Action: routecluster("default/svc2/80/da39a3ee5e"), @@ -1421,20 +1421,20 @@ func TestRouteWithTLS_InsecurePaths_DisablePermitInsecureTrue(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/insecure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), Action: routecluster("default/svc2/80/da39a3ee5e"), @@ -1491,8 +1491,8 @@ func TestRoutePrefixRouteRegex(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("*", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("*", &envoy_api_v2_route.Route{ Match: routeRegex("/[^/]+/invoices(/.*|/?)"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -1513,12 +1513,12 @@ func assertRDS(t *testing.T, c *Contour, versioninfo string, ingressHTTP, ingres t.Helper() routes := []*envoy_api_v2.RouteConfiguration{ - v2.RouteConfiguration("ingress_http", ingressHTTP...), + envoyv2.RouteConfiguration("ingress_http", ingressHTTP...), } for _, vh := range ingressHTTPS { routes = append(routes, - v2.RouteConfiguration(path.Join("https", vh.Name), vh)) + envoyv2.RouteConfiguration(path.Join("https", vh.Name), vh)) } c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ @@ -1535,7 +1535,7 @@ type weightedcluster struct { } func routeRegex(regex string, headers ...dag.HeaderMatchCondition) *envoy_api_v2_route.RouteMatch { - return v2.RouteMatch(&dag.Route{ + return envoyv2.RouteMatch(&dag.Route{ PathMatchCondition: &dag.RegexMatchCondition{ Regex: regex, }, @@ -1604,7 +1604,7 @@ func TestHTTPProxyRouteWithAServiceWeight(t *testing.T) { rh.OnAdd(proxy1) assertRDS(t, c, "1", virtualhosts( - v2.VirtualHost("test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -1636,7 +1636,7 @@ func TestHTTPProxyRouteWithAServiceWeight(t *testing.T) { rh.OnUpdate(proxy1, proxy2) assertRDS(t, c, "2", virtualhosts( - v2.VirtualHost("test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routeweightedcluster( @@ -1691,16 +1691,16 @@ func TestHTTPProxyRouteWithTLS(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routecluster("default/kuard/80/da39a3ee5e"), @@ -1766,11 +1766,11 @@ func TestHTTPProxyRouteWithTLS_InsecurePaths(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/insecure"), @@ -1778,8 +1778,8 @@ func TestHTTPProxyRouteWithTLS_InsecurePaths(t *testing.T) { }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), Action: routecluster("default/svc2/80/da39a3ee5e"), @@ -1859,20 +1859,20 @@ func TestHTTPProxyRouteWithTLS_InsecurePaths_DisablePermitInsecureTrue(t *testin c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "1", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, &envoy_api_v2_route.Route{ Match: routePrefix("/insecure"), - Action: v2.UpgradeHTTPS(), + Action: envoyv2.UpgradeHTTPS(), }, ), ), - v2.RouteConfiguration("https/test2.test.com", - v2.VirtualHost("test2.test.com", + envoyv2.RouteConfiguration("https/test2.test.com", + envoyv2.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/secure"), Action: routecluster("default/svc2/80/da39a3ee5e"), @@ -1938,8 +1938,8 @@ func TestRDSHTTPProxyRootCannotDelegateToAnotherRoot(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "2", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http", - v2.VirtualHost("www.containersteve.com", + envoyv2.RouteConfiguration("ingress_http", + envoyv2.VirtualHost("www.containersteve.com", &envoy_api_v2_route.Route{ Match: routePrefix("/"), Action: routecluster("marketing/green/80/da39a3ee5e"), @@ -2046,7 +2046,7 @@ func TestRDSHTTPProxyDuplicateIncludeConditions(t *testing.T) { c.Request(routeType).Equals(&envoy_api_v2.DiscoveryResponse{ VersionInfo: "2", Resources: routeResources(t, - v2.RouteConfiguration("ingress_http"), + envoyv2.RouteConfiguration("ingress_http"), ), TypeUrl: routeType, Nonce: "2", diff --git a/internal/featuretests/secrets_test.go b/internal/featuretests/secrets_test.go index 1eeeec19efe..9d93ae113d7 100644 --- a/internal/featuretests/secrets_test.go +++ b/internal/featuretests/secrets_test.go @@ -19,7 +19,7 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" envoy_api_v2_auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" "github.com/projectcontour/contour/internal/dag" - v2 "github.com/projectcontour/contour/internal/envoy/v2" + envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" v1 "k8s.io/api/core/v1" "k8s.io/api/networking/v1beta1" @@ -231,7 +231,7 @@ func TestSDSshouldNotPublishInvalidSecret(t *testing.T) { } func secret(sec *v1.Secret) *envoy_api_v2_auth.Secret { - return v2.Secret(&dag.Secret{ + return envoyv2.Secret(&dag.Secret{ Object: sec, }) } diff --git a/internal/featuretests/timeouts_test.go b/internal/featuretests/timeouts_test.go index 87db6848f92..0184ab6391a 100644 --- a/internal/featuretests/timeouts_test.go +++ b/internal/featuretests/timeouts_test.go @@ -19,7 +19,7 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - "github.com/projectcontour/contour/internal/contour" + contourv2 "github.com/projectcontour/contour/internal/contour/v2" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" "github.com/projectcontour/contour/internal/fixture" "github.com/projectcontour/contour/internal/timeout" @@ -56,17 +56,17 @@ func TestTimeoutsNotSpecified(t *testing.T) { } rh.OnAdd(hp1) - c.Request(listenerType, contour.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ + c.Request(listenerType, contourv2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ TypeUrl: listenerType, Resources: resources(t, &envoy_api_v2.Listener{ - Name: contour.ENVOY_HTTP_LISTENER, + Name: contourv2.ENVOY_HTTP_LISTENER, Address: envoyv2.SocketAddress("0.0.0.0", 8080), SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManagerBuilder(). - RouteConfigName(contour.ENVOY_HTTP_LISTENER). - MetricsPrefix(contour.ENVOY_HTTP_LISTENER). - AccessLoggers(envoyv2.FileAccessLogEnvoy(contour.DEFAULT_HTTP_ACCESS_LOG)). + RouteConfigName(contourv2.ENVOY_HTTP_LISTENER). + MetricsPrefix(contourv2.ENVOY_HTTP_LISTENER). + AccessLoggers(envoyv2.FileAccessLogEnvoy(contourv2.DEFAULT_HTTP_ACCESS_LOG)). DefaultFilters(). Get(), ), @@ -75,7 +75,7 @@ func TestTimeoutsNotSpecified(t *testing.T) { } func TestNonZeroTimeoutsSpecified(t *testing.T) { - withTimeouts := func(conf *contour.ListenerConfig) { + withTimeouts := func(conf *contourv2.ListenerConfig) { conf.ConnectionIdleTimeout = timeout.DurationSetting(7 * time.Second) conf.StreamIdleTimeout = timeout.DurationSetting(70 * time.Second) conf.MaxConnectionDuration = timeout.DurationSetting(700 * time.Second) @@ -109,17 +109,17 @@ func TestNonZeroTimeoutsSpecified(t *testing.T) { } rh.OnAdd(hp1) - c.Request(listenerType, contour.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ + c.Request(listenerType, contourv2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ TypeUrl: listenerType, Resources: resources(t, &envoy_api_v2.Listener{ - Name: contour.ENVOY_HTTP_LISTENER, + Name: contourv2.ENVOY_HTTP_LISTENER, Address: envoyv2.SocketAddress("0.0.0.0", 8080), SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManagerBuilder(). - RouteConfigName(contour.ENVOY_HTTP_LISTENER). - MetricsPrefix(contour.ENVOY_HTTP_LISTENER). - AccessLoggers(envoyv2.FileAccessLogEnvoy(contour.DEFAULT_HTTP_ACCESS_LOG)). + RouteConfigName(contourv2.ENVOY_HTTP_LISTENER). + MetricsPrefix(contourv2.ENVOY_HTTP_LISTENER). + AccessLoggers(envoyv2.FileAccessLogEnvoy(contourv2.DEFAULT_HTTP_ACCESS_LOG)). DefaultFilters(). ConnectionIdleTimeout(timeout.DurationSetting(7 * time.Second)). StreamIdleTimeout(timeout.DurationSetting(70 * time.Second)).