From 8c32370472c0120f6d759c46c7b73ecebdf406ff Mon Sep 17 00:00:00 2001 From: Steve Sloka Date: Tue, 29 Sep 2020 10:02:25 -0400 Subject: [PATCH] Renames the internal/contour package to internal/xdscache. Fixes #2939 Signed-off-by: Steve Sloka --- cmd/contour/serve.go | 23 +++++++++--------- cmd/contour/servecontext.go | 6 ++--- cmd/contour/shutdownmanager.go | 4 ++-- internal/featuretests/envoy.go | 10 ++++---- internal/featuretests/featuretests.go | 23 +++++++++--------- internal/featuretests/listeners_test.go | 14 +++++------ internal/featuretests/timeouts_test.go | 24 +++++++++---------- internal/{contour => xdscache}/resources.go | 2 +- internal/{contour => xdscache}/snapshot.go | 2 +- .../{contour => xdscache}/snapshot_test.go | 2 +- internal/{contour => xdscache}/v2/cluster.go | 3 +-- .../{contour => xdscache}/v2/cluster_test.go | 0 .../{contour => xdscache}/v2/contour_test.go | 0 .../v2/endpointstranslator.go | 3 +-- .../v2/endpointstranslator_test.go | 0 internal/{contour => xdscache}/v2/listener.go | 0 .../{contour => xdscache}/v2/listener_test.go | 0 internal/{contour => xdscache}/v2/route.go | 0 .../{contour => xdscache}/v2/route_test.go | 0 internal/{contour => xdscache}/v2/secret.go | 0 .../{contour => xdscache}/v2/secret_test.go | 0 .../{contour => xdscache}/v2/server_test.go | 10 ++++---- .../{contour => xdscache}/v2/visitor_test.go | 0 23 files changed, 63 insertions(+), 63 deletions(-) rename internal/{contour => xdscache}/resources.go (98%) rename internal/{contour => xdscache}/snapshot.go (99%) rename internal/{contour => xdscache}/snapshot_test.go (98%) rename internal/{contour => xdscache}/v2/cluster.go (99%) rename internal/{contour => xdscache}/v2/cluster_test.go (100%) rename internal/{contour => xdscache}/v2/contour_test.go (100%) rename internal/{contour => xdscache}/v2/endpointstranslator.go (99%) rename internal/{contour => xdscache}/v2/endpointstranslator_test.go (100%) rename internal/{contour => xdscache}/v2/listener.go (100%) rename internal/{contour => xdscache}/v2/listener_test.go (100%) rename internal/{contour => xdscache}/v2/route.go (100%) rename internal/{contour => xdscache}/v2/route_test.go (100%) rename internal/{contour => xdscache}/v2/secret.go (100%) rename internal/{contour => xdscache}/v2/secret_test.go (100%) rename internal/{contour => xdscache}/v2/server_test.go (96%) rename internal/{contour => xdscache}/v2/visitor_test.go (100%) diff --git a/cmd/contour/serve.go b/cmd/contour/serve.go index 4cb87954486..ede5d0a7ad5 100644 --- a/cmd/contour/serve.go +++ b/cmd/contour/serve.go @@ -29,7 +29,6 @@ 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" @@ -39,6 +38,8 @@ import ( "github.com/projectcontour/contour/internal/timeout" "github.com/projectcontour/contour/internal/workgroup" "github.com/projectcontour/contour/internal/xds" + "github.com/projectcontour/contour/internal/xdscache" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -247,7 +248,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { return fmt.Errorf("error parsing request timeout: %w", err) } - listenerConfig := contourv2.ListenerConfig{ + listenerConfig := xdscache_v2.ListenerConfig{ UseProxyProto: ctx.useProxyProto, HTTPAddress: ctx.httpAddr, HTTPPort: ctx.httpPort, @@ -276,13 +277,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 := contourv2.NewEndpointsTranslator(log.WithField("context", "endpointstranslator")) + endpointHandler := xdscache_v2.NewEndpointsTranslator(log.WithField("context", "endpointstranslator")) - resources := []contour.ResourceCache{ - contourv2.NewListenerCache(listenerConfig, ctx.statsAddr, ctx.statsPort), - &contourv2.SecretCache{}, - &contourv2.RouteCache{}, - &contourv2.ClusterCache{}, + resources := []xdscache.ResourceCache{ + xdscache_v2.NewListenerCache(listenerConfig, ctx.statsAddr, ctx.statsPort), + &xdscache_v2.SecretCache{}, + &xdscache_v2.RouteCache{}, + &xdscache_v2.ClusterCache{}, endpointHandler, } @@ -292,7 +293,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { log.WithField("context", "xDS")) // snapshotHandler is used to produce new snapshots when the internal state changes for any xDS resource. - snapshotHandler := contour.NewSnapshotHandler(snapshotCache, resources, log.WithField("context", "snapshotHandler")) + snapshotHandler := xdscache.NewSnapshotHandler(snapshotCache, resources, log.WithField("context", "snapshotHandler")) // register observer for endpoints updates. endpointHandler.Observer = contour.ComposeObservers(snapshotHandler) @@ -306,7 +307,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { eventHandler := &contour.EventHandler{ HoldoffDelay: 100 * time.Millisecond, HoldoffMaxDelay: 500 * time.Millisecond, - Observer: dag.ComposeObservers(append(contour.ObserversOf(resources), snapshotHandler)...), + Observer: dag.ComposeObservers(append(xdscache.ObserversOf(resources), snapshotHandler)...), Builder: dag.Builder{ Source: dag.KubernetesCache{ RootNamespaces: ctx.proxyRootNamespaces(), @@ -514,7 +515,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { switch ctx.XDSServerType { case "contour": grpcServer = xds.RegisterServer( - xds.NewContourServer(log, contour.ResourcesOf(resources)...), + xds.NewContourServer(log, xdscache.ResourcesOf(resources)...), registry, ctx.grpcOptions(log)...) case "envoy": diff --git a/cmd/contour/servecontext.go b/cmd/contour/servecontext.go index 085ae286b61..83a4a076736 100644 --- a/cmd/contour/servecontext.go +++ b/cmd/contour/servecontext.go @@ -25,8 +25,8 @@ import ( "strings" "time" - contourv2 "github.com/projectcontour/contour/internal/contour/v2" envoyv2 "github.com/projectcontour/contour/internal/envoy/v2" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -166,8 +166,8 @@ func newServeContext() *serveContext { healthPort: 8000, metricsAddr: "0.0.0.0", metricsPort: 8000, - httpAccessLog: contourv2.DEFAULT_HTTP_ACCESS_LOG, - httpsAccessLog: contourv2.DEFAULT_HTTPS_ACCESS_LOG, + httpAccessLog: xdscache_v2.DEFAULT_HTTP_ACCESS_LOG, + httpsAccessLog: xdscache_v2.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 69519747f0e..a3b41c058f4 100644 --- a/cmd/contour/shutdownmanager.go +++ b/cmd/contour/shutdownmanager.go @@ -21,7 +21,7 @@ import ( "os" "time" - contourv2 "github.com/projectcontour/contour/internal/contour/v2" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" "github.com/prometheus/common/expfmt" "github.com/sirupsen/logrus" "gopkg.in/alecthomas/kingpin.v2" @@ -40,7 +40,7 @@ const shutdownReadyFile = "/ok" const shutdownReadyCheckInterval = time.Second * 1 func prometheusLabels() []string { - return []string{contourv2.ENVOY_HTTP_LISTENER, contourv2.ENVOY_HTTPS_LISTENER} + return []string{xdscache_v2.ENVOY_HTTP_LISTENER, xdscache_v2.ENVOY_HTTPS_LISTENER} } type shutdownmanagerContext struct { diff --git a/internal/featuretests/envoy.go b/internal/featuretests/envoy.go index 3c3613b3505..2151f0e96a7 100644 --- a/internal/featuretests/envoy.go +++ b/internal/featuretests/envoy.go @@ -30,10 +30,10 @@ import ( "github.com/envoyproxy/go-control-plane/pkg/wellknown" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" - 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" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -291,8 +291,8 @@ func filterchaintlsfallback(fallbackSecret *v1.Secret, peerValidationContext *da envoyv2.Filters( envoyv2.HTTPConnectionManagerBuilder(). DefaultFilters(). - RouteConfigName(contourv2.ENVOY_FALLBACK_ROUTECONFIG). - MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). + RouteConfigName(xdscache_v2.ENVOY_FALLBACK_ROUTECONFIG). + MetricsPrefix(xdscache_v2.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(contourv2.ENVOY_HTTPS_LISTENER). + MetricsPrefix(xdscache_v2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/dev/stdout")). Get() } @@ -326,7 +326,7 @@ func authzFilterFor( }, }). RouteConfigName(path.Join("https", vhost)). - MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). + MetricsPrefix(xdscache_v2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/dev/stdout")). Get() } diff --git a/internal/featuretests/featuretests.go b/internal/featuretests/featuretests.go index b7ef8290f59..19d1392863f 100644 --- a/internal/featuretests/featuretests.go +++ b/internal/featuretests/featuretests.go @@ -29,7 +29,6 @@ import ( "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" @@ -38,6 +37,8 @@ import ( "github.com/projectcontour/contour/internal/sorter" "github.com/projectcontour/contour/internal/workgroup" "github.com/projectcontour/contour/internal/xds" + "github.com/projectcontour/contour/internal/xdscache" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" @@ -63,20 +64,20 @@ func setup(t *testing.T, opts ...interface{}) (cache.ResourceEventHandler, *Cont log := fixture.NewTestLogger(t) log.SetLevel(logrus.DebugLevel) - et := contourv2.NewEndpointsTranslator(log) + et := xdscache_v2.NewEndpointsTranslator(log) - conf := contourv2.ListenerConfig{} + conf := xdscache_v2.ListenerConfig{} for _, opt := range opts { - if opt, ok := opt.(func(*contourv2.ListenerConfig)); ok { + if opt, ok := opt.(func(*xdscache_v2.ListenerConfig)); ok { opt(&conf) } } - resources := []contour.ResourceCache{ - contourv2.NewListenerCache(conf, statsAddress, statsPort), - &contourv2.SecretCache{}, - &contourv2.RouteCache{}, - &contourv2.ClusterCache{}, + resources := []xdscache.ResourceCache{ + xdscache_v2.NewListenerCache(conf, statsAddress, statsPort), + &xdscache_v2.SecretCache{}, + &xdscache_v2.RouteCache{}, + &xdscache_v2.ClusterCache{}, et, } @@ -95,7 +96,7 @@ func setup(t *testing.T, opts ...interface{}) (cache.ResourceEventHandler, *Cont HoldoffMaxDelay: time.Duration(rand.Intn(500)) * time.Millisecond, Observer: &contour.RebuildMetricsObserver{ Metrics: metrics.NewMetrics(r), - NextObserver: dag.ComposeObservers(contour.ObserversOf(resources)...), + NextObserver: dag.ComposeObservers(xdscache.ObserversOf(resources)...), }, Builder: dag.Builder{ Source: dag.KubernetesCache{ @@ -128,7 +129,7 @@ func setup(t *testing.T, opts ...interface{}) (cache.ResourceEventHandler, *Cont require.NoError(t, err) srv := xds.RegisterServer( - xds.NewContourServer(log, contour.ResourcesOf(resources)...), + xds.NewContourServer(log, xdscache.ResourcesOf(resources)...), r /* Prometheus registry */) var g workgroup.Group diff --git a/internal/featuretests/listeners_test.go b/internal/featuretests/listeners_test.go index 31a2096eb42..fd2cb2b4e44 100644 --- a/internal/featuretests/listeners_test.go +++ b/internal/featuretests/listeners_test.go @@ -20,10 +20,10 @@ 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" - 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/fixture" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" v1 "k8s.io/api/core/v1" "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -552,7 +552,7 @@ func TestLDSStreamEmpty(t *testing.T) { } func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { - rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { + rh, c, done := setup(t, func(conf *xdscache_v2.ListenerConfig) { conf.UseProxyProto = true }) defer done() @@ -608,7 +608,7 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { } func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { - rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { + rh, c, done := setup(t, func(conf *xdscache_v2.ListenerConfig) { conf.UseProxyProto = true }) defer done() @@ -701,7 +701,7 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { } func TestLDSCustomAddressAndPort(t *testing.T) { - rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { + rh, c, done := setup(t, func(conf *xdscache_v2.ListenerConfig) { conf.HTTPAddress = "127.0.0.100" conf.HTTPPort = 9100 conf.HTTPSAddress = "127.0.0.200" @@ -798,7 +798,7 @@ func TestLDSCustomAddressAndPort(t *testing.T) { } func TestLDSCustomAccessLogPaths(t *testing.T) { - rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { + rh, c, done := setup(t, func(conf *xdscache_v2.ListenerConfig) { conf.HTTPAccessLog = "/tmp/http_access.log" conf.HTTPSAccessLog = "/tmp/https_access.log" }) @@ -879,7 +879,7 @@ func TestLDSCustomAccessLogPaths(t *testing.T) { AddFilter(envoyv2.FilterMisdirectedRequests("kuard.example.com")). DefaultFilters(). RouteConfigName("https/kuard.example.com"). - MetricsPrefix(contourv2.ENVOY_HTTPS_LISTENER). + MetricsPrefix(xdscache_v2.ENVOY_HTTPS_LISTENER). AccessLoggers(envoyv2.FileAccessLogEnvoy("/tmp/https_access.log")). Get(), nil, "h2", "http/1.1"), @@ -994,7 +994,7 @@ func TestHTTPProxyHTTPS(t *testing.T) { } func TestHTTPProxyMinimumTLSVersion(t *testing.T) { - rh, c, done := setup(t, func(conf *contourv2.ListenerConfig) { + rh, c, done := setup(t, func(conf *xdscache_v2.ListenerConfig) { conf.MinimumTLSVersion = envoy_api_v2_auth.TlsParameters_TLSv1_2 }) diff --git a/internal/featuretests/timeouts_test.go b/internal/featuretests/timeouts_test.go index 0184ab6391a..2062c150211 100644 --- a/internal/featuretests/timeouts_test.go +++ b/internal/featuretests/timeouts_test.go @@ -19,10 +19,10 @@ import ( envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" projcontour "github.com/projectcontour/contour/apis/projectcontour/v1" - 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" + xdscache_v2 "github.com/projectcontour/contour/internal/xdscache/v2" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -56,17 +56,17 @@ func TestTimeoutsNotSpecified(t *testing.T) { } rh.OnAdd(hp1) - c.Request(listenerType, contourv2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ + c.Request(listenerType, xdscache_v2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ TypeUrl: listenerType, Resources: resources(t, &envoy_api_v2.Listener{ - Name: contourv2.ENVOY_HTTP_LISTENER, + Name: xdscache_v2.ENVOY_HTTP_LISTENER, Address: envoyv2.SocketAddress("0.0.0.0", 8080), SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManagerBuilder(). - RouteConfigName(contourv2.ENVOY_HTTP_LISTENER). - MetricsPrefix(contourv2.ENVOY_HTTP_LISTENER). - AccessLoggers(envoyv2.FileAccessLogEnvoy(contourv2.DEFAULT_HTTP_ACCESS_LOG)). + RouteConfigName(xdscache_v2.ENVOY_HTTP_LISTENER). + MetricsPrefix(xdscache_v2.ENVOY_HTTP_LISTENER). + AccessLoggers(envoyv2.FileAccessLogEnvoy(xdscache_v2.DEFAULT_HTTP_ACCESS_LOG)). DefaultFilters(). Get(), ), @@ -75,7 +75,7 @@ func TestTimeoutsNotSpecified(t *testing.T) { } func TestNonZeroTimeoutsSpecified(t *testing.T) { - withTimeouts := func(conf *contourv2.ListenerConfig) { + withTimeouts := func(conf *xdscache_v2.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, contourv2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ + c.Request(listenerType, xdscache_v2.ENVOY_HTTP_LISTENER).Equals(&envoy_api_v2.DiscoveryResponse{ TypeUrl: listenerType, Resources: resources(t, &envoy_api_v2.Listener{ - Name: contourv2.ENVOY_HTTP_LISTENER, + Name: xdscache_v2.ENVOY_HTTP_LISTENER, Address: envoyv2.SocketAddress("0.0.0.0", 8080), SocketOptions: envoyv2.TCPKeepaliveSocketOptions(), FilterChains: envoyv2.FilterChains(envoyv2.HTTPConnectionManagerBuilder(). - RouteConfigName(contourv2.ENVOY_HTTP_LISTENER). - MetricsPrefix(contourv2.ENVOY_HTTP_LISTENER). - AccessLoggers(envoyv2.FileAccessLogEnvoy(contourv2.DEFAULT_HTTP_ACCESS_LOG)). + RouteConfigName(xdscache_v2.ENVOY_HTTP_LISTENER). + MetricsPrefix(xdscache_v2.ENVOY_HTTP_LISTENER). + AccessLoggers(envoyv2.FileAccessLogEnvoy(xdscache_v2.DEFAULT_HTTP_ACCESS_LOG)). DefaultFilters(). ConnectionIdleTimeout(timeout.DurationSetting(7 * time.Second)). StreamIdleTimeout(timeout.DurationSetting(70 * time.Second)). diff --git a/internal/contour/resources.go b/internal/xdscache/resources.go similarity index 98% rename from internal/contour/resources.go rename to internal/xdscache/resources.go index d34ce316da2..7b4b2d56c82 100644 --- a/internal/contour/resources.go +++ b/internal/xdscache/resources.go @@ -14,7 +14,7 @@ // Package contour contains the translation business logic that listens // to Kubernetes ResourceEventHandler events and translates those into // additions/deletions in caches connected to the Envoy xDS gRPC API server. -package contour +package xdscache import ( "github.com/projectcontour/contour/internal/dag" diff --git a/internal/contour/snapshot.go b/internal/xdscache/snapshot.go similarity index 99% rename from internal/contour/snapshot.go rename to internal/xdscache/snapshot.go index b215662f6f6..b4d8bc54336 100644 --- a/internal/contour/snapshot.go +++ b/internal/xdscache/snapshot.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package xdscache import ( "math" diff --git a/internal/contour/snapshot_test.go b/internal/xdscache/snapshot_test.go similarity index 98% rename from internal/contour/snapshot_test.go rename to internal/xdscache/snapshot_test.go index 247d0601c94..632694b27bd 100644 --- a/internal/contour/snapshot_test.go +++ b/internal/xdscache/snapshot_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contour +package xdscache import ( "math" diff --git a/internal/contour/v2/cluster.go b/internal/xdscache/v2/cluster.go similarity index 99% rename from internal/contour/v2/cluster.go rename to internal/xdscache/v2/cluster.go index 2871b9d54d5..51c37c5b16b 100644 --- a/internal/contour/v2/cluster.go +++ b/internal/xdscache/v2/cluster.go @@ -17,11 +17,10 @@ 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" + "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" diff --git a/internal/contour/v2/cluster_test.go b/internal/xdscache/v2/cluster_test.go similarity index 100% rename from internal/contour/v2/cluster_test.go rename to internal/xdscache/v2/cluster_test.go diff --git a/internal/contour/v2/contour_test.go b/internal/xdscache/v2/contour_test.go similarity index 100% rename from internal/contour/v2/contour_test.go rename to internal/xdscache/v2/contour_test.go diff --git a/internal/contour/v2/endpointstranslator.go b/internal/xdscache/v2/endpointstranslator.go similarity index 99% rename from internal/contour/v2/endpointstranslator.go rename to internal/xdscache/v2/endpointstranslator.go index 44a69042a27..6677dc787c9 100644 --- a/internal/contour/v2/endpointstranslator.go +++ b/internal/xdscache/v2/endpointstranslator.go @@ -18,12 +18,11 @@ import ( "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" "github.com/golang/protobuf/proto" + "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/k8s" diff --git a/internal/contour/v2/endpointstranslator_test.go b/internal/xdscache/v2/endpointstranslator_test.go similarity index 100% rename from internal/contour/v2/endpointstranslator_test.go rename to internal/xdscache/v2/endpointstranslator_test.go diff --git a/internal/contour/v2/listener.go b/internal/xdscache/v2/listener.go similarity index 100% rename from internal/contour/v2/listener.go rename to internal/xdscache/v2/listener.go diff --git a/internal/contour/v2/listener_test.go b/internal/xdscache/v2/listener_test.go similarity index 100% rename from internal/contour/v2/listener_test.go rename to internal/xdscache/v2/listener_test.go diff --git a/internal/contour/v2/route.go b/internal/xdscache/v2/route.go similarity index 100% rename from internal/contour/v2/route.go rename to internal/xdscache/v2/route.go diff --git a/internal/contour/v2/route_test.go b/internal/xdscache/v2/route_test.go similarity index 100% rename from internal/contour/v2/route_test.go rename to internal/xdscache/v2/route_test.go diff --git a/internal/contour/v2/secret.go b/internal/xdscache/v2/secret.go similarity index 100% rename from internal/contour/v2/secret.go rename to internal/xdscache/v2/secret.go diff --git a/internal/contour/v2/secret_test.go b/internal/xdscache/v2/secret_test.go similarity index 100% rename from internal/contour/v2/secret_test.go rename to internal/xdscache/v2/secret_test.go diff --git a/internal/contour/v2/server_test.go b/internal/xdscache/v2/server_test.go similarity index 96% rename from internal/contour/v2/server_test.go rename to internal/xdscache/v2/server_test.go index a7716e4629f..00367d6eadd 100644 --- a/internal/contour/v2/server_test.go +++ b/internal/xdscache/v2/server_test.go @@ -20,14 +20,14 @@ 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" + "github.com/projectcontour/contour/internal/contour" "github.com/projectcontour/contour/internal/dag" "github.com/projectcontour/contour/internal/fixture" "github.com/projectcontour/contour/internal/xds" + "github.com/projectcontour/contour/internal/xdscache" "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" "google.golang.org/grpc" @@ -193,7 +193,7 @@ func TestGRPC(t *testing.T) { t.Run(name, func(t *testing.T) { et = NewEndpointsTranslator(fixture.NewTestLogger(t)) - resources := []contour.ResourceCache{ + resources := []xdscache.ResourceCache{ NewListenerCache(ListenerConfig{}, "", 0), &SecretCache{}, &RouteCache{}, @@ -202,11 +202,11 @@ func TestGRPC(t *testing.T) { } eh = &contour.EventHandler{ - Observer: dag.ComposeObservers(contour.ObserversOf(resources)...), + Observer: dag.ComposeObservers(xdscache.ObserversOf(resources)...), FieldLogger: log, } - srv := xds.RegisterServer(xds.NewContourServer(log, contour.ResourcesOf(resources)...), nil) + srv := xds.RegisterServer(xds.NewContourServer(log, xdscache.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/v2/visitor_test.go b/internal/xdscache/v2/visitor_test.go similarity index 100% rename from internal/contour/v2/visitor_test.go rename to internal/xdscache/v2/visitor_test.go