fix: update linter.
This commit is contained in:
parent
027d313df5
commit
29efac3e5e
52 changed files with 17 additions and 89 deletions
|
@ -40,7 +40,9 @@
|
|||
"scopelint",
|
||||
"gochecknoinits",
|
||||
"gochecknoglobals",
|
||||
# "godox", # manage TODO FIXME ## wait for https://github.com/golangci/golangci-lint/issues/337
|
||||
"bodyclose", # Too many false-positive and panics.
|
||||
# "stylecheck", # skip because report issues related to some generated files. ## wait for https://github.com/golangci/golangci-lint/issues/337
|
||||
]
|
||||
|
||||
[issues]
|
||||
|
|
|
@ -119,7 +119,6 @@ func runCmd(staticConfiguration *static.Configuration) error {
|
|||
return fmt.Errorf("error while building entryPoint %s: %v", entryPointName, err)
|
||||
}
|
||||
serverEntryPointsTCP[entryPointName].RouteAppenderFactory = router.NewRouteAppenderFactory(*staticConfiguration, entryPointName, acmeProviders)
|
||||
|
||||
}
|
||||
|
||||
svr := server.NewServer(*staticConfiguration, providerAggregator, serverEntryPointsTCP, tlsManager)
|
||||
|
|
|
@ -47,7 +47,6 @@ func (s *ErrorPagesSuite) TestSimpleConfiguration(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *ErrorPagesSuite) TestErrorPage(c *check.C) {
|
||||
|
||||
// error.toml contains a mis-configuration of the backend host
|
||||
file := s.adaptFile(c, "fixtures/error_pages/error.toml", struct {
|
||||
Server1 string
|
||||
|
|
|
@ -90,7 +90,6 @@ func getHelloClientGRPC() (helloworld.GreeterClient, func() error, error) {
|
|||
return nil, func() error { return nil }, err
|
||||
}
|
||||
return helloworld.NewGreeterClient(conn), conn.Close, nil
|
||||
|
||||
}
|
||||
|
||||
func getHelloClientGRPCh2c() (helloworld.GreeterClient, func() error, error) {
|
||||
|
@ -99,7 +98,6 @@ func getHelloClientGRPCh2c() (helloworld.GreeterClient, func() error, error) {
|
|||
return nil, func() error { return nil }, err
|
||||
}
|
||||
return helloworld.NewGreeterClient(conn), conn.Close, nil
|
||||
|
||||
}
|
||||
|
||||
func callHelloClientGRPC(name string, secure bool) (string, error) {
|
||||
|
|
|
@ -27,7 +27,6 @@ func (s *HealthCheckSuite) SetUpSuite(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *HealthCheckSuite) TestSimpleConfiguration(c *check.C) {
|
||||
|
||||
file := s.adaptFile(c, "fixtures/healthcheck/simple.toml", struct {
|
||||
Server1 string
|
||||
Server2 string
|
||||
|
@ -166,7 +165,6 @@ func (s *HealthCheckSuite) TestMultipleEntrypoints(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *HealthCheckSuite) TestPortOverload(c *check.C) {
|
||||
|
||||
// Set one whoami health to 200
|
||||
client := &http.Client{}
|
||||
statusInternalServerErrorReq, err := http.NewRequest(http.MethodPost, "http://"+s.whoami1IP+"/health", bytes.NewBuffer([]byte("200")))
|
||||
|
@ -206,5 +204,4 @@ func (s *HealthCheckSuite) TestPortOverload(c *check.C) {
|
|||
// Verify no backend service is available due to failing health checks
|
||||
err = try.Request(frontendHealthReq, 3*time.Second, try.StatusCodeIs(http.StatusServiceUnavailable))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
}
|
||||
|
|
|
@ -193,7 +193,6 @@ func (s *SimpleSuite) TestStatsWithMultipleEntryPoint(c *check.C) {
|
|||
|
||||
err = try.GetRequest("http://127.0.0.1:8080/health", 1*time.Second, try.BodyContains(`"total_status_code_count":{"200":2}`))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) {
|
||||
|
@ -301,7 +300,6 @@ func (s *SimpleSuite) TestMultipleProviderSameBackendName(c *check.C) {
|
|||
|
||||
err = try.GetRequest("http://127.0.0.1:8000/file", 1*time.Second, try.BodyContains(ipWhoami02))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestIPStrategyWhitelist(c *check.C) {
|
||||
|
@ -449,7 +447,6 @@ func (s *SimpleSuite) TestMultiProvider(c *check.C) {
|
|||
|
||||
err = try.GetRequest("http://127.0.0.1:8000/", 1*time.Second, try.StatusCodeIs(http.StatusOK), try.BodyContains("CustomValue"))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestSimpleConfigurationHostRequestTrailingPeriod(c *check.C) {
|
||||
|
@ -625,8 +622,8 @@ func (s *SimpleSuite) TestWRRSticky(c *check.C) {
|
|||
repartition := map[string]int{}
|
||||
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
for i := 0; i < 4; i++ {
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
response, err := http.DefaultClient.Do(req)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(response.StatusCode, checker.Equals, http.StatusOK)
|
||||
|
|
|
@ -230,7 +230,6 @@ func guessWhoTLSMaxVersion(addr, serverName string, tlsCall bool, tlsMaxVersion
|
|||
var err error
|
||||
|
||||
if tlsCall {
|
||||
|
||||
conn, err = tls.Dial("tcp", addr, &tls.Config{
|
||||
ServerName: serverName,
|
||||
InsecureSkipVerify: true,
|
||||
|
|
|
@ -88,7 +88,6 @@ func (s *TracingSuite) TestZipkinRateLimit(c *check.C) {
|
|||
|
||||
err = try.GetRequest("http://"+s.IP+":9411/api/v2/spans?serviceName=tracing", 20*time.Second, try.BodyContains("forward service1/router1@file", "ratelimit-1@file"))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
}
|
||||
|
||||
func (s *TracingSuite) TestZipkinRetry(c *check.C) {
|
||||
|
|
|
@ -177,7 +177,6 @@ func (s *WebsocketSuite) TestOrigin(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(n, checker.Equals, 2)
|
||||
c.Assert(string(msg), checker.Equals, "OK")
|
||||
|
||||
}
|
||||
|
||||
func (s *WebsocketSuite) TestWrongOriginIgnoredByServer(c *check.C) {
|
||||
|
@ -238,7 +237,6 @@ func (s *WebsocketSuite) TestWrongOriginIgnoredByServer(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(n, checker.Equals, 2)
|
||||
c.Assert(string(msg), checker.Equals, "OK")
|
||||
|
||||
}
|
||||
|
||||
func (s *WebsocketSuite) TestSSLTermination(c *check.C) {
|
||||
|
@ -389,7 +387,6 @@ func (s *WebsocketSuite) TestSpecificResponseFromBackend(c *check.C) {
|
|||
_, resp, err := gorillawebsocket.DefaultDialer.Dial("ws://127.0.0.1:8000/ws", nil)
|
||||
c.Assert(err, checker.NotNil)
|
||||
c.Assert(resp.StatusCode, check.Equals, http.StatusUnauthorized)
|
||||
|
||||
}
|
||||
|
||||
func (s *WebsocketSuite) TestURLWithURLEncodedChar(c *check.C) {
|
||||
|
|
|
@ -82,7 +82,6 @@ func Test_execute(t *testing.T) {
|
|||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
},
|
||||
expected: expected{result: "root"},
|
||||
},
|
||||
|
@ -99,7 +98,6 @@ func Test_execute(t *testing.T) {
|
|||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
},
|
||||
expected: expected{error: true},
|
||||
},
|
||||
|
|
|
@ -85,7 +85,6 @@ func TestFinder_Find(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
finder := Finder{
|
||||
BasePaths: test.basePaths,
|
||||
Extensions: []string{"toml", "yaml", "yml"},
|
||||
|
|
|
@ -460,7 +460,6 @@ func (c *ClientTLS) CreateTLSConfig() (*tls.Config, error) {
|
|||
cert, err = tls.X509KeyPair([]byte(c.Cert), []byte(c.Key))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load TLS keypair: %v", err)
|
||||
|
||||
}
|
||||
} else {
|
||||
return nil, fmt.Errorf("TLS key is a file, but tls cert is not")
|
||||
|
|
|
@ -130,7 +130,6 @@ func findTypedField(rType reflect.Type, node *Node) (reflect.StructField, error)
|
|||
return cField, nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return reflect.StructField{}, fmt.Errorf("field not found, node: %s", node.Name)
|
||||
|
|
|
@ -687,5 +687,4 @@ func TestPopulateUsedBy(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ type EntryPoints map[string]*EntryPoint
|
|||
|
||||
// EntryPointsTransport configures communication between clients and Traefik.
|
||||
type EntryPointsTransport struct {
|
||||
LifeCycle *LifeCycle `description:"Timeouts influencing the server life cycle." json:"lifeCycle,omitempty" toml:"lifeCycle,omitempty" yaml:"lifeCycle,omitempty" export:"true" export:"true"`
|
||||
RespondingTimeouts *RespondingTimeouts `description:"Timeouts for incoming requests to the Traefik instance." json:"respondingTimeouts,omitempty" toml:"respondingTimeouts,omitempty" yaml:"respondingTimeouts,omitempty" export:"true" export:"true"`
|
||||
LifeCycle *LifeCycle `description:"Timeouts influencing the server life cycle." json:"lifeCycle,omitempty" toml:"lifeCycle,omitempty" yaml:"lifeCycle,omitempty" export:"true"`
|
||||
RespondingTimeouts *RespondingTimeouts `description:"Timeouts for incoming requests to the Traefik instance." json:"respondingTimeouts,omitempty" toml:"respondingTimeouts,omitempty" yaml:"respondingTimeouts,omitempty" export:"true"`
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values.
|
||||
|
|
|
@ -40,7 +40,6 @@ func TestLog(t *testing.T) {
|
|||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
var buffer bytes.Buffer
|
||||
SetOutput(&buffer)
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ func TestInfluxDB(t *testing.T) {
|
|||
influxDBRegistry.EntryPointReqsCounter().With("entrypoint", "test").Add(1)
|
||||
influxDBRegistry.EntryPointReqDurationHistogram().With("entrypoint", "test").Observe(10000)
|
||||
influxDBRegistry.EntryPointOpenConnsGauge().With("entrypoint", "test").Set(1)
|
||||
|
||||
})
|
||||
|
||||
assertMessage(t, msgEntrypoint, expectedEntrypoint)
|
||||
|
|
|
@ -269,7 +269,6 @@ func TestPrometheus(t *testing.T) {
|
|||
}
|
||||
test.assert(family)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ func AddServiceFields(rw http.ResponseWriter, req *http.Request, next http.Handl
|
|||
data.Core[ServiceAddr] = req.URL.Host
|
||||
|
||||
next.ServeHTTP(rw, req)
|
||||
|
||||
}
|
||||
|
||||
// AddOriginFields add origin fields
|
||||
|
|
|
@ -69,8 +69,8 @@ func toLog(fields logrus.Fields, key string, defaultValue string, quoted bool) i
|
|||
return v
|
||||
}
|
||||
}
|
||||
return defaultValue
|
||||
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
func toLogEntry(s string, defaultValue string, quote bool) string {
|
||||
|
|
|
@ -99,11 +99,9 @@ func TestCommonLogFormatter_Format(t *testing.T) {
|
|||
assert.Equal(t, test.expectedLog, string(raw))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Test_toLog(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
fields logrus.Fields
|
||||
|
|
|
@ -527,7 +527,6 @@ func TestNewLogHandlerOutputStdout(t *testing.T) {
|
|||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
// NOTE: It is not possible to run these cases in parallel because we capture Stdout
|
||||
|
||||
file, restoreStdout := captureStdout(t)
|
||||
|
@ -543,7 +542,6 @@ func TestNewLogHandlerOutputStdout(t *testing.T) {
|
|||
}
|
||||
|
||||
func assertValidLogData(t *testing.T, expected string, logData []byte) {
|
||||
|
||||
if len(expected) == 0 {
|
||||
assert.Zero(t, len(logData))
|
||||
t.Log(string(logData))
|
||||
|
|
|
@ -367,7 +367,6 @@ func Test_writeHeader(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
||||
req := testhelpers.MustNewRequest(http.MethodGet, "http://foo.bar/path?q=1", nil)
|
||||
for key, value := range test.headers {
|
||||
req.Header.Set(key, value)
|
||||
|
|
|
@ -327,7 +327,6 @@ func TestGetTracingInformation(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "testing", name)
|
||||
assert.Equal(t, tracing.SpanKindNoneEnum, trace)
|
||||
|
||||
}
|
||||
|
||||
func TestCORSResponses(t *testing.T) {
|
||||
|
|
|
@ -360,7 +360,6 @@ WqeUSNGYV//RunTeuRDAf5OxehERb1srzBXhRZ3cZdzXbgR/`),
|
|||
require.Equal(t, test.expected, sanitize(test.toSanitize), "The sanitized certificates should be equal")
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestTLSClientHeadersWithPEM(t *testing.T) {
|
||||
|
@ -429,7 +428,6 @@ func TestTLSClientHeadersWithPEM(t *testing.T) {
|
|||
require.Empty(t, res.Header().Get(xForwardedTLSClientCert), "The response header should be always empty")
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestGetSans(t *testing.T) {
|
||||
|
@ -478,7 +476,6 @@ func TestGetSans(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestTLSClientHeadersWithCertInfo(t *testing.T) {
|
||||
|
@ -659,5 +656,4 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) {
|
|||
require.Empty(t, res.Header().Get(xForwardedTLSClientCertInfo), "The response header should be always empty")
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ func (p *pipelining) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||
} else {
|
||||
p.next.ServeHTTP(&writerWithoutCloseNotify{rw}, r)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// writerWithoutCloseNotify helps to disable closeNotify
|
||||
|
|
|
@ -142,7 +142,6 @@ func TestRateLimit(t *testing.T) {
|
|||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
t.Parallel()
|
||||
|
||||
reqCount := 0
|
||||
|
|
|
@ -179,16 +179,13 @@ func TestRedirectRegexHandler(t *testing.T) {
|
|||
handler.ServeHTTP(recorder, r)
|
||||
|
||||
assert.Equal(t, test.expectedStatus, recorder.Code)
|
||||
if test.expectedStatus == http.StatusMovedPermanently ||
|
||||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
switch test.expectedStatus {
|
||||
case http.StatusMovedPermanently, http.StatusFound, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, test.expectedURL, location.String())
|
||||
} else {
|
||||
default:
|
||||
location, err := recorder.Result().Location()
|
||||
require.Errorf(t, err, "Location %v", location)
|
||||
}
|
||||
|
|
|
@ -206,16 +206,14 @@ func TestRedirectSchemeHandler(t *testing.T) {
|
|||
handler.ServeHTTP(recorder, r)
|
||||
|
||||
assert.Equal(t, test.expectedStatus, recorder.Code)
|
||||
if test.expectedStatus == http.StatusMovedPermanently ||
|
||||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
switch test.expectedStatus {
|
||||
case http.StatusMovedPermanently, http.StatusFound, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, test.expectedURL, location.String())
|
||||
} else {
|
||||
default:
|
||||
location, err := recorder.Result().Location()
|
||||
require.Errorf(t, err, "Location %v", location)
|
||||
}
|
||||
|
@ -234,7 +232,6 @@ func TestRedirectSchemeHandler(t *testing.T) {
|
|||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ func TestReplacePath(t *testing.T) {
|
|||
|
||||
for _, path := range paths {
|
||||
t.Run(path, func(t *testing.T) {
|
||||
|
||||
var expectedPath, actualHeader, requestURI string
|
||||
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
expectedPath = r.URL.Path
|
||||
|
|
|
@ -74,7 +74,6 @@ func TestReplacePathRegex(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
var actualPath, actualHeader, requestURI string
|
||||
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
actualPath = r.URL.Path
|
||||
|
|
|
@ -65,7 +65,6 @@ func TestEntryPointMiddleware(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
newTracing, err := tracing.NewTracing("", test.spanNameLimit, test.tracing)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@ func TestNewForwarder(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
newTracing, err := tracing.NewTracing("", test.spanNameLimit, test.tracing)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
@ -171,7 +171,6 @@ func NewLocalChallengeStore() *LocalChallengeStore {
|
|||
TLSChallenges: make(map[string]*Certificate),
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// GetHTTPChallengeToken Get the http challenge token from the store
|
||||
|
|
|
@ -414,7 +414,6 @@ func (p *Provider) watchNewDomains(ctx context.Context) {
|
|||
}
|
||||
p.resolveDomains(ctxRouter, domains, tlsStore)
|
||||
}
|
||||
|
||||
}
|
||||
case <-stop:
|
||||
return
|
||||
|
|
|
@ -193,10 +193,11 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||
if p.Watch {
|
||||
if p.SwarmMode {
|
||||
errChan := make(chan error)
|
||||
|
||||
// TODO: This need to be change. Linked to Swarm events docker/docker#23827
|
||||
ticker := time.NewTicker(time.Duration(p.SwarmModeRefreshSeconds))
|
||||
pool.GoCtx(func(ctx context.Context) {
|
||||
|
||||
pool.GoCtx(func(ctx context.Context) {
|
||||
ctx = log.With(ctx, log.Str(log.ProviderName, "docker"))
|
||||
logger := log.FromContext(ctx)
|
||||
|
||||
|
@ -229,7 +230,6 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||
return err
|
||||
}
|
||||
// channel closed
|
||||
|
||||
} else {
|
||||
f := filters.NewArgs()
|
||||
f.Add("type", "container")
|
||||
|
@ -256,7 +256,6 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||
case configurationChan <- message:
|
||||
case <-ctx.Done():
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,6 @@ func createProvider(t *testing.T, test ProvideTestCase, watch bool) (*Provider,
|
|||
}
|
||||
|
||||
if len(test.filePath) > 0 {
|
||||
|
||||
var file *os.File
|
||||
if watch {
|
||||
var err error
|
||||
|
|
|
@ -225,7 +225,6 @@ func (p *Provider) loadConfigurationFromCRD(ctx context.Context, client Client)
|
|||
PassTLSClientCert: middleware.Spec.PassTLSClientCert,
|
||||
Retry: middleware.Spec.Retry,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return conf
|
||||
|
|
|
@ -121,9 +121,7 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client
|
|||
}
|
||||
|
||||
conf.Routers[serviceName].TLS.Options = tlsOptionsName
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend
|
|||
|
||||
var port int32
|
||||
for _, subset := range endpoints.Subsets {
|
||||
|
||||
for _, p := range subset.Ports {
|
||||
if portName == p.Name {
|
||||
port = p.Port
|
||||
|
@ -352,7 +351,6 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
|
|||
Service: serviceName,
|
||||
TLS: &dynamic.RouterTLSConfig{},
|
||||
}
|
||||
|
||||
}
|
||||
conf.HTTP.Services[serviceName] = service
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||
logger := log.FromContext(ctx)
|
||||
|
||||
operation := func() error {
|
||||
|
||||
confg := marathon.NewDefaultConfig()
|
||||
confg.URL = p.Endpoint
|
||||
confg.EventsTransport = marathon.EventsTransportSSE
|
||||
|
|
|
@ -92,7 +92,6 @@ func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, service ran
|
|||
}
|
||||
|
||||
func (p *Provider) buildServiceConfiguration(ctx context.Context, service rancherData, configuration *dynamic.HTTPConfiguration) error {
|
||||
|
||||
serviceName := service.Name
|
||||
|
||||
if len(configuration.Services) == 0 {
|
||||
|
@ -181,7 +180,6 @@ func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBa
|
|||
|
||||
loadBalancer.Servers = servers
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (p *Provider) addServers(ctx context.Context, service rancherData, loadBalancer *dynamic.ServersLoadBalancer) error {
|
||||
|
|
|
@ -46,7 +46,6 @@ func (p *Provider) Append(systemRouter *mux.Router) {
|
|||
Methods(http.MethodPut).
|
||||
Path("/api/providers/{provider}").
|
||||
HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
vars := mux.Vars(request)
|
||||
if vars["provider"] != "rest" {
|
||||
response.WriteHeader(http.StatusBadRequest)
|
||||
|
|
|
@ -399,7 +399,6 @@ func TestAccessLog(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
rtConf := runtime.NewConfig(dynamic.Configuration{
|
||||
HTTP: &dynamic.HTTPConfiguration{
|
||||
Services: test.serviceConfig,
|
||||
|
@ -407,6 +406,7 @@ func TestAccessLog(t *testing.T) {
|
|||
Middlewares: test.middlewaresConfig,
|
||||
},
|
||||
})
|
||||
|
||||
serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport, nil, nil, nil, nil)
|
||||
middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager)
|
||||
responseModifierFactory := responsemodifiers.NewBuilder(rtConf.Middlewares)
|
||||
|
@ -722,7 +722,6 @@ func TestRuntimeConfiguration(t *testing.T) {
|
|||
assert.Equal(t, test.expectedError, allErrors)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestProviderOnMiddlewares(t *testing.T) {
|
||||
|
@ -833,7 +832,6 @@ func BenchmarkRouterServe(b *testing.B) {
|
|||
for i := 0; i < b.N; i++ {
|
||||
reqHost.ServeHTTP(w, req, handlers["web"].ServeHTTP)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func BenchmarkService(b *testing.B) {
|
||||
|
@ -868,5 +866,4 @@ func BenchmarkService(b *testing.B) {
|
|||
for i := 0; i < b.N; i++ {
|
||||
handler.ServeHTTP(w, req)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ func TestShutdownHTTPHijacked(t *testing.T) {
|
|||
resp := http.Response{StatusCode: http.StatusOK}
|
||||
err = resp.Write(conn)
|
||||
require.NoError(t, err)
|
||||
|
||||
}))
|
||||
|
||||
entryPoint.switchRouter(router)
|
||||
|
||||
conn, err := net.Dial("tcp", entryPoint.listener.Addr().String())
|
||||
|
|
|
@ -19,7 +19,6 @@ type responseRecorder struct {
|
|||
func (r *responseRecorder) WriteHeader(statusCode int) {
|
||||
r.save[r.Header().Get("server")]++
|
||||
r.ResponseRecorder.WriteHeader(statusCode)
|
||||
|
||||
}
|
||||
|
||||
func TestBalancer(t *testing.T) {
|
||||
|
|
|
@ -139,7 +139,6 @@ func TestWebSocketEcho(t *testing.T) {
|
|||
|
||||
err = conn.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
}))
|
||||
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
@ -169,7 +168,6 @@ func TestWebSocketEcho(t *testing.T) {
|
|||
|
||||
err = conn.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
}
|
||||
|
||||
func TestWebSocketPassHost(t *testing.T) {
|
||||
|
@ -215,7 +213,6 @@ func TestWebSocketPassHost(t *testing.T) {
|
|||
|
||||
err = conn.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
}))
|
||||
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
@ -246,7 +243,6 @@ func TestWebSocketPassHost(t *testing.T) {
|
|||
|
||||
err = conn.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,7 +258,6 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) {
|
|||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
|
||||
handler, err := sm.getLoadBalancerServiceHandler(context.Background(), test.serviceName, test.service, test.responseModifier)
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
|
|
@ -85,5 +85,4 @@ func (m *Manager) BuildTCP(rootCtx context.Context, serviceName string) (tcp.Han
|
|||
conf.AddError(err, true)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -140,7 +140,6 @@ func (c *Certificates) isEmpty() bool {
|
|||
|
||||
// AppendCertificate appends a Certificate to a certificates map keyed by entrypoint.
|
||||
func (c *Certificate) AppendCertificate(certs map[string]map[string]*tls.Certificate, ep string) error {
|
||||
|
||||
certContent, err := c.CertFile.Read()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read CertFile : %v", err)
|
||||
|
@ -168,7 +167,6 @@ func (c *Certificate) AppendCertificate(certs map[string]map[string]*tls.Certifi
|
|||
SANs = append(SANs, strings.ToLower(dnsName))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if parsedCert.IPAddresses != nil {
|
||||
for _, ip := range parsedCert.IPAddresses {
|
||||
|
@ -176,7 +174,6 @@ func (c *Certificate) AppendCertificate(certs map[string]map[string]*tls.Certifi
|
|||
SANs = append(SANs, strings.ToLower(ip.String()))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
certKey := strings.Join(SANs, ",")
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ func (c CertificateStore) getDefaultCertificateDomains() []string {
|
|||
|
||||
// GetAllDomains return a slice with all the certificate domain
|
||||
func (c CertificateStore) GetAllDomains() []string {
|
||||
|
||||
allCerts := c.getDefaultCertificateDomains()
|
||||
|
||||
// Get dynamic certificates
|
||||
|
|
|
@ -64,7 +64,7 @@ type FieldHeaders struct {
|
|||
// AccessLogFields holds configuration for access log fields
|
||||
type AccessLogFields struct {
|
||||
DefaultMode string `description:"Default mode for fields: keep | drop" json:"defaultMode,omitempty" toml:"defaultMode,omitempty" yaml:"defaultMode,omitempty" export:"true"`
|
||||
Names map[string]string `json:"names,omitempty" description:"Override mode for fields" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"`
|
||||
Names map[string]string `description:"Override mode for fields" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"`
|
||||
Headers *FieldHeaders `description:"Headers to keep, drop or redact" json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty" export:"true"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue