Skip to content

Commit

Permalink
Remove unused logrus.Entry from proxy.Router (#50309)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy authored Dec 17, 2024
1 parent b6e8602 commit 04d8ca1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
9 changes: 0 additions & 9 deletions lib/proxy/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
oteltrace "go.opentelemetry.io/otel/trace"
"golang.org/x/crypto/ssh"
Expand Down Expand Up @@ -123,8 +122,6 @@ type LocalAccessPoint interface {
type RouterConfig struct {
// ClusterName indicates which cluster the router is for
ClusterName string
// Log is the logger to use
Log *logrus.Entry
// LocalAccessPoint is the proxy cache
LocalAccessPoint LocalAccessPoint
// SiteGetter allows looking up sites
Expand All @@ -138,10 +135,6 @@ type RouterConfig struct {

// CheckAndSetDefaults ensures the required items were populated
func (c *RouterConfig) CheckAndSetDefaults() error {
if c.Log == nil {
c.Log = logrus.WithField(teleport.ComponentKey, "Router")
}

if c.ClusterName == "" {
return trace.BadParameter("ClusterName must be provided")
}
Expand Down Expand Up @@ -169,7 +162,6 @@ func (c *RouterConfig) CheckAndSetDefaults() error {
// nodes and other clusters.
type Router struct {
clusterName string
log *logrus.Entry
localAccessPoint LocalAccessPoint
localSite reversetunnelclient.RemoteSite
siteGetter SiteGetter
Expand All @@ -191,7 +183,6 @@ func NewRouter(cfg RouterConfig) (*Router, error) {

return &Router{
clusterName: cfg.ClusterName,
log: cfg.Log,
localAccessPoint: cfg.LocalAccessPoint,
localSite: localSite,
siteGetter: cfg.SiteGetter,
Expand Down
10 changes: 0 additions & 10 deletions lib/proxy/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,6 @@ type fakeConn struct {
func TestRouter_DialHost(t *testing.T) {
t.Parallel()

logger := utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test")

srv := &types.ServerV2{
Kind: types.KindNode,
Version: types.V2,
Expand Down Expand Up @@ -668,7 +666,6 @@ func TestRouter_DialHost(t *testing.T) {
name: "failure resolving node",
router: Router{
clusterName: "test",
log: logger,
tracer: tracing.NoopTracer("test"),
serverResolver: serverResolver(nil, trace.NotFound(teleport.NodeIsAmbiguous)),
},
Expand All @@ -682,7 +679,6 @@ func TestRouter_DialHost(t *testing.T) {
router: Router{
clusterName: "leaf",
siteGetter: tunnel{err: trace.NotFound("unknown cluster")},
log: logger,
tracer: tracing.NoopTracer("test"),
},
assertion: func(t *testing.T, params reversetunnelclient.DialParams, conn net.Conn, err error) {
Expand All @@ -695,7 +691,6 @@ func TestRouter_DialHost(t *testing.T) {
name: "dial failure",
router: Router{
clusterName: "test",
log: logger,
localSite: &testRemoteSite{err: trace.ConnectionProblem(context.DeadlineExceeded, "connection refused")},
tracer: tracing.NoopTracer("test"),
serverResolver: serverResolver(srv, nil),
Expand All @@ -710,7 +705,6 @@ func TestRouter_DialHost(t *testing.T) {
name: "dial success",
router: Router{
clusterName: "test",
log: logger,
localSite: &testRemoteSite{conn: fakeConn{}},
tracer: tracing.NoopTracer("test"),
serverResolver: serverResolver(srv, nil),
Expand All @@ -727,7 +721,6 @@ func TestRouter_DialHost(t *testing.T) {
name: "dial success to agentless node",
router: Router{
clusterName: "test",
log: logger,
localSite: &testRemoteSite{conn: fakeConn{}},
siteGetter: &testSiteGetter{site: &testRemoteSite{conn: fakeConn{}}},
tracer: tracing.NoopTracer("test"),
Expand All @@ -746,7 +739,6 @@ func TestRouter_DialHost(t *testing.T) {
name: "dial success to agentless node using EC2 Instance Connect Endpoint",
router: Router{
clusterName: "test",
log: logger,
localSite: &testRemoteSite{conn: fakeConn{}},
siteGetter: &testSiteGetter{site: &testRemoteSite{conn: fakeConn{}}},
tracer: tracing.NoopTracer("test"),
Expand Down Expand Up @@ -783,7 +775,6 @@ func TestRouter_DialSite(t *testing.T) {
t.Parallel()

const cluster = "test"
logger := utils.NewLoggerForTests().WithField(teleport.ComponentKey, cluster)

cases := []struct {
name string
Expand Down Expand Up @@ -863,7 +854,6 @@ func TestRouter_DialSite(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
router := Router{
clusterName: cluster,
log: logger,
localSite: &tt.localSite,
siteGetter: tt.tunnel,
tracer: tracing.NoopTracer(cluster),
Expand Down
1 change: 0 additions & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4482,7 +4482,6 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error {
if !process.Config.Proxy.DisableReverseTunnel {
router, err := proxy.NewRouter(proxy.RouterConfig{
ClusterName: clusterName,
Log: process.log.WithField(teleport.ComponentKey, "router"),
LocalAccessPoint: accessPoint,
SiteGetter: tsrv,
TracerProvider: process.TracingProvider,
Expand Down
5 changes: 0 additions & 5 deletions lib/srv/regular/sshserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,6 @@ func TestProxyRoundRobin(t *testing.T) {

router, err := libproxy.NewRouter(libproxy.RouterConfig{
ClusterName: f.testSrv.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: proxyClient,
SiteGetter: reverseTunnelServer,
TracerProvider: tracing.NoopProvider(),
Expand Down Expand Up @@ -1820,7 +1819,6 @@ func TestProxyDirectAccess(t *testing.T) {

router, err := libproxy.NewRouter(libproxy.RouterConfig{
ClusterName: f.testSrv.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: proxyClient,
SiteGetter: reverseTunnelServer,
TracerProvider: tracing.NoopProvider(),
Expand Down Expand Up @@ -2509,7 +2507,6 @@ func TestParseSubsystemRequest(t *testing.T) {

router, err := libproxy.NewRouter(libproxy.RouterConfig{
ClusterName: f.testSrv.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: proxyClient,
SiteGetter: reverseTunnelServer,
TracerProvider: tracing.NoopProvider(),
Expand Down Expand Up @@ -2768,7 +2765,6 @@ func TestIgnorePuTTYSimpleChannel(t *testing.T) {

router, err := libproxy.NewRouter(libproxy.RouterConfig{
ClusterName: f.testSrv.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: proxyClient,
SiteGetter: reverseTunnelServer,
TracerProvider: tracing.NoopProvider(),
Expand Down Expand Up @@ -3188,7 +3184,6 @@ func TestHostUserCreationProxy(t *testing.T) {

router, err := libproxy.NewRouter(libproxy.RouterConfig{
ClusterName: f.testSrv.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: proxyClient,
SiteGetter: reverseTunnelServer,
TracerProvider: tracing.NoopProvider(),
Expand Down
2 changes: 0 additions & 2 deletions lib/web/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ func newWebSuiteWithConfig(t *testing.T, cfg webSuiteConfig) *WebSuite {

router, err := proxy.NewRouter(proxy.RouterConfig{
ClusterName: s.server.ClusterName(),
Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"),
LocalAccessPoint: s.proxyClient,
SiteGetter: revTunServer,
TracerProvider: tracing.NoopProvider(),
Expand Down Expand Up @@ -8219,7 +8218,6 @@ func createProxy(ctx context.Context, t *testing.T, proxyID string, node *regula
clustername := authServer.ClusterName()
router, err := proxy.NewRouter(proxy.RouterConfig{
ClusterName: clustername,
Log: log.WithField(teleport.ComponentKey, "router"),
LocalAccessPoint: client,
SiteGetter: revTunServer,
TracerProvider: tracing.NoopProvider(),
Expand Down

0 comments on commit 04d8ca1

Please sign in to comment.