Merge current v2.8 into master
This commit is contained in:
commit
703de5331b
30 changed files with 74 additions and 64 deletions
2
.github/workflows/validate.yaml
vendored
2
.github/workflows/validate.yaml
vendored
|
@ -7,7 +7,7 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GO_VERSION: 1.19
|
GO_VERSION: 1.19
|
||||||
GOLANGCI_LINT_VERSION: v1.48.0
|
GOLANGCI_LINT_VERSION: v1.49.0
|
||||||
MISSSPELL_VERSION: v0.3.4
|
MISSSPELL_VERSION: v0.3.4
|
||||||
IN_DOCKER: ""
|
IN_DOCKER: ""
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,12 @@
|
||||||
"interfacer", # Deprecated
|
"interfacer", # Deprecated
|
||||||
"maligned", # Deprecated
|
"maligned", # Deprecated
|
||||||
"golint", # Deprecated
|
"golint", # Deprecated
|
||||||
|
"exhaustivestruct",# Deprecated
|
||||||
"nosnakecase", # Deprecated
|
"nosnakecase", # Deprecated
|
||||||
|
"ifshort", # Deprecated
|
||||||
|
"structcheck", # Deprecated
|
||||||
|
"varcheck", # Deprecated
|
||||||
|
"deadcode", # Deprecated
|
||||||
"execinquery", # Not relevant (SQL)
|
"execinquery", # Not relevant (SQL)
|
||||||
"sqlclosecheck", # Not relevant (SQL)
|
"sqlclosecheck", # Not relevant (SQL)
|
||||||
"rowserrcheck", # Not relevant (SQL)
|
"rowserrcheck", # Not relevant (SQL)
|
||||||
|
@ -130,7 +135,6 @@
|
||||||
"nestif", # Too many false-positive.
|
"nestif", # Too many false-positive.
|
||||||
"prealloc", # Too many false-positive.
|
"prealloc", # Too many false-positive.
|
||||||
"makezero", # Not relevant
|
"makezero", # Not relevant
|
||||||
"ifshort", # Not relevant
|
|
||||||
"dupl", # Too strict
|
"dupl", # Too strict
|
||||||
"gosec", # Too strict
|
"gosec", # Too strict
|
||||||
"gochecknoinits",
|
"gochecknoinits",
|
||||||
|
@ -143,14 +147,11 @@
|
||||||
"tparallel", # Not relevant
|
"tparallel", # Not relevant
|
||||||
"paralleltest", # Not relevant
|
"paralleltest", # Not relevant
|
||||||
"exhaustive", # Not relevant
|
"exhaustive", # Not relevant
|
||||||
"exhaustivestruct", # Not relevant
|
|
||||||
"exhaustruct", # duplicate of exhaustivestruct
|
"exhaustruct", # duplicate of exhaustivestruct
|
||||||
"goerr113", # Too strict
|
"goerr113", # Too strict
|
||||||
"wrapcheck", # Too strict
|
"wrapcheck", # Too strict
|
||||||
"noctx", # Too strict
|
"noctx", # Too strict
|
||||||
"bodyclose", # Too many false-positive and panics.
|
"bodyclose", # Too many false-positive and panics.
|
||||||
"unparam", # Too strict
|
|
||||||
"godox", # Too strict
|
|
||||||
"forcetypeassert", # Too strict
|
"forcetypeassert", # Too strict
|
||||||
"tagliatelle", # Not compatible with current tags.
|
"tagliatelle", # Not compatible with current tags.
|
||||||
"varnamelen", # not relevant
|
"varnamelen", # not relevant
|
||||||
|
@ -160,7 +161,6 @@
|
||||||
"containedctx", # too many false-positive
|
"containedctx", # too many false-positive
|
||||||
"maintidx", # kind of duplicate of gocyclo
|
"maintidx", # kind of duplicate of gocyclo
|
||||||
"nonamedreturns", # not relevant
|
"nonamedreturns", # not relevant
|
||||||
"structcheck", # duplicate of unused
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[issues]
|
[issues]
|
||||||
|
@ -182,6 +182,10 @@
|
||||||
[[issues.exclude-rules]]
|
[[issues.exclude-rules]]
|
||||||
path = "(.+)_test.go"
|
path = "(.+)_test.go"
|
||||||
linters = ["goconst", "funlen", "godot", "nosnakecase"]
|
linters = ["goconst", "funlen", "godot", "nosnakecase"]
|
||||||
|
[[issues.exclude-rules]]
|
||||||
|
path = "(.+)_test.go"
|
||||||
|
text = " always receives "
|
||||||
|
linters = [ "unparam" ]
|
||||||
[[issues.exclude-rules]]
|
[[issues.exclude-rules]]
|
||||||
path = "integration/.+_test.go"
|
path = "integration/.+_test.go"
|
||||||
text = "Error return value of `cmd\\.Process\\.Kill` is not checked"
|
text = "Error return value of `cmd\\.Process\\.Kill` is not checked"
|
||||||
|
@ -230,4 +234,13 @@
|
||||||
[[issues.exclude-rules]]
|
[[issues.exclude-rules]]
|
||||||
path = "pkg/types/tls_test.go"
|
path = "pkg/types/tls_test.go"
|
||||||
text = "SA1019: tlsConfig.RootCAs.Subjects has been deprecated since Go 1.18"
|
text = "SA1019: tlsConfig.RootCAs.Subjects has been deprecated since Go 1.18"
|
||||||
|
[[issues.exclude-rules]]
|
||||||
|
path = "pkg/provider/kubernetes/(crd|gateway)/client.go"
|
||||||
|
linters = ["interfacebloat"]
|
||||||
|
[[issues.exclude-rules]]
|
||||||
|
path = "pkg/metrics/metrics.go"
|
||||||
|
linters = ["interfacebloat"]
|
||||||
|
[[issues.exclude-rules]]
|
||||||
|
path = "pkg/provider/acme/provider.go"
|
||||||
|
text = "\\(\\*Provider\\)\\.resolveCertificate - result 0 \\(\\*github.com/go-acme/lego/v4/certificate.Resource\\) is never used"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ global_job_config:
|
||||||
- export "PATH=${GOPATH}/bin:${PATH}"
|
- export "PATH=${GOPATH}/bin:${PATH}"
|
||||||
- mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin"
|
- mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin"
|
||||||
- export GOPROXY=https://proxy.golang.org,direct
|
- export GOPROXY=https://proxy.golang.org,direct
|
||||||
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.48.0
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.49.0
|
||||||
- curl -sSfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | bash -s -- -b "${GOPATH}/bin"
|
- curl -sSfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | bash -s -- -b "${GOPATH}/bin"
|
||||||
- checkout
|
- checkout
|
||||||
- cache restore traefik-$(checksum go.sum)
|
- cache restore traefik-$(checksum go.sum)
|
||||||
|
|
|
@ -13,7 +13,7 @@ RUN mkdir -p /usr/local/bin \
|
||||||
| tar -xzC /usr/local/bin --transform 's#^.+/##x'
|
| tar -xzC /usr/local/bin --transform 's#^.+/##x'
|
||||||
|
|
||||||
# Download golangci-lint binary to bin folder in $GOPATH
|
# Download golangci-lint binary to bin folder in $GOPATH
|
||||||
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOPATH/bin v1.48.0
|
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOPATH/bin v1.49.0
|
||||||
|
|
||||||
# Download misspell binary to bin folder in $GOPATH
|
# Download misspell binary to bin folder in $GOPATH
|
||||||
RUN curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | bash -s -- -b $GOPATH/bin v0.3.4
|
RUN curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | bash -s -- -b $GOPATH/bin v0.3.4
|
||||||
|
|
|
@ -64,7 +64,7 @@ func Do(staticConfiguration static.Configuration) (*http.Response, error) {
|
||||||
client := &http.Client{Timeout: 5 * time.Second}
|
client := &http.Client{Timeout: 5 * time.Second}
|
||||||
protocol := "http"
|
protocol := "http"
|
||||||
|
|
||||||
// FIXME Handle TLS on ping etc...
|
// TODO Handle TLS on ping etc...
|
||||||
// if pingEntryPoint.TLS != nil {
|
// if pingEntryPoint.TLS != nil {
|
||||||
// protocol = "https"
|
// protocol = "https"
|
||||||
// tr := &http.Transport{
|
// tr := &http.Transport{
|
||||||
|
|
|
@ -72,22 +72,16 @@ func NewCentrifuge(rootPkg string) (*Centrifuge, error) {
|
||||||
|
|
||||||
// Run runs the code extraction and the code generation.
|
// Run runs the code extraction and the code generation.
|
||||||
func (c Centrifuge) Run(dest string, pkgName string) error {
|
func (c Centrifuge) Run(dest string, pkgName string) error {
|
||||||
files, err := c.run(c.pkg.Scope(), c.rootPkg, pkgName)
|
files := c.run(c.pkg.Scope(), c.rootPkg, pkgName)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = fileWriter{baseDir: dest}.Write(files)
|
err := fileWriter{baseDir: dest}.Write(files)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range c.pkg.Imports() {
|
for _, p := range c.pkg.Imports() {
|
||||||
if contains(c.IncludedImports, p.Path()) {
|
if contains(c.IncludedImports, p.Path()) {
|
||||||
fls, err := c.run(p.Scope(), p.Path(), p.Name())
|
fls := c.run(p.Scope(), p.Path(), p.Name())
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = fileWriter{baseDir: filepath.Join(dest, p.Name())}.Write(fls)
|
err = fileWriter{baseDir: filepath.Join(dest, p.Name())}.Write(fls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -99,7 +93,7 @@ func (c Centrifuge) Run(dest string, pkgName string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Centrifuge) run(sc *types.Scope, rootPkg string, pkgName string) (map[string]*File, error) {
|
func (c Centrifuge) run(sc *types.Scope, rootPkg string, pkgName string) map[string]*File {
|
||||||
files := map[string]*File{}
|
files := map[string]*File{}
|
||||||
|
|
||||||
for _, name := range sc.Names() {
|
for _, name := range sc.Names() {
|
||||||
|
@ -158,7 +152,7 @@ func (c Centrifuge) run(sc *types.Scope, rootPkg string, pkgName string) (map[st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return files, nil
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Centrifuge) writeStruct(name string, obj *types.Struct, rootPkg string, elt *File) string {
|
func (c Centrifuge) writeStruct(name string, obj *types.Struct, rootPkg string, elt *File) string {
|
||||||
|
|
|
@ -342,7 +342,7 @@ For complete details, refer to your provider's _Additional configuration_ link.
|
||||||
| [IBM Cloud (SoftLayer)](https://www.ibm.com/cloud/) | `ibmcloud` | `SOFTLAYER_USERNAME`, `SOFTLAYER_API_KEY` | [Additional configuration](https://go-acme.github.io/lego/dns/ibmcloud) |
|
| [IBM Cloud (SoftLayer)](https://www.ibm.com/cloud/) | `ibmcloud` | `SOFTLAYER_USERNAME`, `SOFTLAYER_API_KEY` | [Additional configuration](https://go-acme.github.io/lego/dns/ibmcloud) |
|
||||||
| [IIJ DNS Platform Service](https://www.iij.ad.jp) | `iijdpf` | `IIJ_DPF_API_TOKEN` , `IIJ_DPF_DPM_SERVICE_CODE` | [Additional configuration](https://go-acme.github.io/lego/dns/iijdpf) |
|
| [IIJ DNS Platform Service](https://www.iij.ad.jp) | `iijdpf` | `IIJ_DPF_API_TOKEN` , `IIJ_DPF_DPM_SERVICE_CODE` | [Additional configuration](https://go-acme.github.io/lego/dns/iijdpf) |
|
||||||
| [IIJ](https://www.iij.ad.jp/) | `iij` | `IIJ_API_ACCESS_KEY`, `IIJ_API_SECRET_KEY`, `IIJ_DO_SERVICE_CODE` | [Additional configuration](https://go-acme.github.io/lego/dns/iij) |
|
| [IIJ](https://www.iij.ad.jp/) | `iij` | `IIJ_API_ACCESS_KEY`, `IIJ_API_SECRET_KEY`, `IIJ_DO_SERVICE_CODE` | [Additional configuration](https://go-acme.github.io/lego/dns/iij) |
|
||||||
| [Infoblox](https://www.infoblox.com/) | `infoblox` | `INFOBLOX_USER`, `INFOBLOX_PASSWORD`, `INFOBLOX_HOST` | [Additional configuration](https://go-acme.github.io/lego/dns/infoblox) |
|
| [Infoblox](https://www.infoblox.com/) | `infoblox` | `INFOBLOX_USERNAME`, `INFOBLOX_PASSWORD`, `INFOBLOX_HOST` | [Additional configuration](https://go-acme.github.io/lego/dns/infoblox) |
|
||||||
| [Infomaniak](https://www.infomaniak.com) | `infomaniak` | `INFOMANIAK_ACCESS_TOKEN` | [Additional configuration](https://go-acme.github.io/lego/dns/infomaniak) |
|
| [Infomaniak](https://www.infomaniak.com) | `infomaniak` | `INFOMANIAK_ACCESS_TOKEN` | [Additional configuration](https://go-acme.github.io/lego/dns/infomaniak) |
|
||||||
| [Internet.bs](https://internetbs.net) | `internetbs` | `INTERNET_BS_API_KEY`, `INTERNET_BS_PASSWORD` | [Additional configuration](https://go-acme.github.io/lego/dns/internetbs) |
|
| [Internet.bs](https://internetbs.net) | `internetbs` | `INTERNET_BS_API_KEY`, `INTERNET_BS_PASSWORD` | [Additional configuration](https://go-acme.github.io/lego/dns/internetbs) |
|
||||||
| [INWX](https://www.inwx.de/en) | `inwx` | `INWX_USERNAME`, `INWX_PASSWORD` | [Additional configuration](https://go-acme.github.io/lego/dns/inwx) |
|
| [INWX](https://www.inwx.de/en) | `inwx` | `INWX_USERNAME`, `INWX_PASSWORD` | [Additional configuration](https://go-acme.github.io/lego/dns/inwx) |
|
||||||
|
|
|
@ -678,7 +678,7 @@ metadata:
|
||||||
name: myca
|
name: myca
|
||||||
|
|
||||||
data:
|
data:
|
||||||
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=
|
ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `maxIdleConnsPerHost`
|
#### `maxIdleConnsPerHost`
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -55,7 +55,7 @@ require (
|
||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/stretchr/testify v1.8.0
|
github.com/stretchr/testify v1.8.0
|
||||||
github.com/stvp/go-udp-testing v0.0.0-20191102171040-06b61409b154
|
github.com/stvp/go-udp-testing v0.0.0-20191102171040-06b61409b154
|
||||||
github.com/traefik/paerser v0.1.8
|
github.com/traefik/paerser v0.1.9
|
||||||
github.com/traefik/yaegi v0.14.1
|
github.com/traefik/yaegi v0.14.1
|
||||||
github.com/uber/jaeger-client-go v2.30.0+incompatible
|
github.com/uber/jaeger-client-go v2.30.0+incompatible
|
||||||
github.com/uber/jaeger-lib v2.2.0+incompatible
|
github.com/uber/jaeger-lib v2.2.0+incompatible
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1903,8 +1903,8 @@ github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/
|
||||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
|
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
|
||||||
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 h1:y/1cL5AL2oRcfzz8CAHHhR6kDDfIOT0WEyH5k40sccM=
|
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 h1:y/1cL5AL2oRcfzz8CAHHhR6kDDfIOT0WEyH5k40sccM=
|
||||||
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305/go.mod h1:gXOLibKqQTRAVuVZ9gX7G9Ykky8ll8yb4slxsEMoY0c=
|
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305/go.mod h1:gXOLibKqQTRAVuVZ9gX7G9Ykky8ll8yb4slxsEMoY0c=
|
||||||
github.com/traefik/paerser v0.1.8 h1:DmX/v9KwWAFvRr5A/XQzLLfd1BSWgh710q+dZJmjZ+c=
|
github.com/traefik/paerser v0.1.9 h1:x5hZafOt/yogLvr6upoSOYIAn2nh2GsnLb236MOzd4I=
|
||||||
github.com/traefik/paerser v0.1.8/go.mod h1:Dk3Bfz6Zyj13/S8pJyRdx/FNvXlsVRVbtp0UK4ZSiA0=
|
github.com/traefik/paerser v0.1.9/go.mod h1:Dk3Bfz6Zyj13/S8pJyRdx/FNvXlsVRVbtp0UK4ZSiA0=
|
||||||
github.com/traefik/yaegi v0.14.1 h1:t0ssyzeZCWTFGd/JnVuDxH/slMQfYg+2CDD4dLW/rU0=
|
github.com/traefik/yaegi v0.14.1 h1:t0ssyzeZCWTFGd/JnVuDxH/slMQfYg+2CDD4dLW/rU0=
|
||||||
github.com/traefik/yaegi v0.14.1/go.mod h1:AVRxhaI2G+nUsaM1zyktzwXn69G3t/AuTDrCiTds9p0=
|
github.com/traefik/yaegi v0.14.1/go.mod h1:AVRxhaI2G+nUsaM1zyktzwXn69G3t/AuTDrCiTds9p0=
|
||||||
github.com/transip/gotransip/v6 v6.6.1 h1:nsCU1ErZS5G0FeOpgGXc4FsWvBff9GPswSMggsC4564=
|
github.com/transip/gotransip/v6 v6.6.1 h1:nsCU1ErZS5G0FeOpgGXc4FsWvBff9GPswSMggsC4564=
|
||||||
|
|
|
@ -603,7 +603,7 @@ func (s *ConsulCatalogSuite) TestConsulServiceWithOneMissingLabels(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "my.super.host"
|
req.Host = "my.super.host"
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
// TODO validate : run on 80
|
// TODO validate : run on 80
|
||||||
// Expected a 404 as we did not configure anything
|
// Expected a 404 as we did not configure anything
|
||||||
err = try.Request(req, 1500*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
|
err = try.Request(req, 1500*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
|
||||||
|
@ -681,7 +681,7 @@ func (s *ConsulCatalogSuite) TestConsulServiceWithHealthCheck(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "whoami"
|
req.Host = "whoami"
|
||||||
|
|
||||||
// FIXME Need to wait for up to 10 seconds (for consul discovery or traefik to boot up ?)
|
// TODO Need to wait for up to 10 seconds (for consul discovery or traefik to boot up ?)
|
||||||
err = try.Request(req, 10*time.Second, try.StatusCodeIs(200), try.BodyContainsOr("Hostname: whoami2"))
|
err = try.Request(req, 10*time.Second, try.StatusCodeIs(200), try.BodyContainsOr("Hostname: whoami2"))
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ func (s *DockerSuite) TestDefaultDockerContainers(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = fmt.Sprintf("simple-%s.docker.localhost", s.composeProject.Name)
|
req.Host = fmt.Sprintf("simple-%s.docker.localhost", s.composeProject.Name)
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ func (s *DockerSuite) TestDockerContainersWithLabels(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "my-super.host"
|
req.Host = "my-super.host"
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
_, err = try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
_, err = try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ func (s *DockerSuite) TestDockerContainersWithLabels(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "my.super.host"
|
req.Host = "my.super.host"
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ func (s *DockerSuite) TestDockerContainersWithOneMissingLabels(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "my.super.host"
|
req.Host = "my.super.host"
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
// TODO validate : run on 80
|
// TODO validate : run on 80
|
||||||
// Expected a 404 as we did not configure anything
|
// Expected a 404 as we did not configure anything
|
||||||
err = try.Request(req, 1500*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
|
err = try.Request(req, 1500*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
|
||||||
|
@ -227,7 +227,7 @@ func (s *DockerSuite) TestRestartDockerContainers(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
req.Host = "my.super.host"
|
req.Host = "my.super.host"
|
||||||
|
|
||||||
// FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
// TODO Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?)
|
||||||
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
|
|
@ -209,14 +209,14 @@ func (s *BaseSuite) traefikCmd(args ...string) (*exec.Cmd, func(*check.C)) {
|
||||||
cmd, out := s.cmdTraefik(args...)
|
cmd, out := s.cmdTraefik(args...)
|
||||||
return cmd, func(c *check.C) {
|
return cmd, func(c *check.C) {
|
||||||
if c.Failed() || *showLog {
|
if c.Failed() || *showLog {
|
||||||
s.displayLogK3S(c)
|
s.displayLogK3S()
|
||||||
s.displayLogCompose(c)
|
s.displayLogCompose(c)
|
||||||
s.displayTraefikLog(c, out)
|
s.displayTraefikLog(c, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *BaseSuite) displayLogK3S(c *check.C) {
|
func (s *BaseSuite) displayLogK3S() {
|
||||||
filePath := "./fixtures/k8s/config.skip/k3s.log"
|
filePath := "./fixtures/k8s/config.skip/k3s.log"
|
||||||
if _, err := os.Stat(filePath); err == nil {
|
if _, err := os.Stat(filePath); err == nil {
|
||||||
content, errR := os.ReadFile(filePath)
|
content, errR := os.ReadFile(filePath)
|
||||||
|
|
|
@ -135,7 +135,7 @@ type storeWriter struct {
|
||||||
data map[string]string
|
data map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f storeWriter) Put(key string, value []byte, options []string) error {
|
func (f storeWriter) Put(key string, value []byte, _ []string) error {
|
||||||
f.data[key] = string(value)
|
f.data[key] = string(value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// FIXME Goroutines2 -> Goroutines
|
// TODO Goroutines2 -> Goroutines
|
||||||
expvar.Publish("Goroutines2", expvar.Func(goroutines))
|
expvar.Publish("Goroutines2", expvar.Func(goroutines))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,9 +216,9 @@ type ServerHealthCheck struct {
|
||||||
Path string `json:"path,omitempty" toml:"path,omitempty" yaml:"path,omitempty" export:"true"`
|
Path string `json:"path,omitempty" toml:"path,omitempty" yaml:"path,omitempty" export:"true"`
|
||||||
Method string `json:"method,omitempty" toml:"method,omitempty" yaml:"method,omitempty" export:"true"`
|
Method string `json:"method,omitempty" toml:"method,omitempty" yaml:"method,omitempty" export:"true"`
|
||||||
Port int `json:"port,omitempty" toml:"port,omitempty,omitzero" yaml:"port,omitempty" export:"true"`
|
Port int `json:"port,omitempty" toml:"port,omitempty,omitzero" yaml:"port,omitempty" export:"true"`
|
||||||
// FIXME change string to ptypes.Duration
|
// TODO change string to ptypes.Duration
|
||||||
Interval string `json:"interval,omitempty" toml:"interval,omitempty" yaml:"interval,omitempty" export:"true"`
|
Interval string `json:"interval,omitempty" toml:"interval,omitempty" yaml:"interval,omitempty" export:"true"`
|
||||||
// FIXME change string to ptypes.Duration
|
// TODO change string to ptypes.Duration
|
||||||
Timeout string `json:"timeout,omitempty" toml:"timeout,omitempty" yaml:"timeout,omitempty" export:"true"`
|
Timeout string `json:"timeout,omitempty" toml:"timeout,omitempty" yaml:"timeout,omitempty" export:"true"`
|
||||||
Hostname string `json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"`
|
Hostname string `json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"`
|
||||||
FollowRedirects *bool `json:"followRedirects" toml:"followRedirects" yaml:"followRedirects" export:"true"`
|
FollowRedirects *bool `json:"followRedirects" toml:"followRedirects" yaml:"followRedirects" export:"true"`
|
||||||
|
|
|
@ -20,27 +20,32 @@ type Registry interface {
|
||||||
IsSvcEnabled() bool
|
IsSvcEnabled() bool
|
||||||
|
|
||||||
// server metrics
|
// server metrics
|
||||||
|
|
||||||
ConfigReloadsCounter() metrics.Counter
|
ConfigReloadsCounter() metrics.Counter
|
||||||
ConfigReloadsFailureCounter() metrics.Counter
|
ConfigReloadsFailureCounter() metrics.Counter
|
||||||
LastConfigReloadSuccessGauge() metrics.Gauge
|
LastConfigReloadSuccessGauge() metrics.Gauge
|
||||||
LastConfigReloadFailureGauge() metrics.Gauge
|
LastConfigReloadFailureGauge() metrics.Gauge
|
||||||
|
|
||||||
// TLS
|
// TLS
|
||||||
|
|
||||||
TLSCertsNotAfterTimestampGauge() metrics.Gauge
|
TLSCertsNotAfterTimestampGauge() metrics.Gauge
|
||||||
|
|
||||||
// entry point metrics
|
// entry point metrics
|
||||||
|
|
||||||
EntryPointReqsCounter() metrics.Counter
|
EntryPointReqsCounter() metrics.Counter
|
||||||
EntryPointReqsTLSCounter() metrics.Counter
|
EntryPointReqsTLSCounter() metrics.Counter
|
||||||
EntryPointReqDurationHistogram() ScalableHistogram
|
EntryPointReqDurationHistogram() ScalableHistogram
|
||||||
EntryPointOpenConnsGauge() metrics.Gauge
|
EntryPointOpenConnsGauge() metrics.Gauge
|
||||||
|
|
||||||
// router metrics
|
// router metrics
|
||||||
|
|
||||||
RouterReqsCounter() metrics.Counter
|
RouterReqsCounter() metrics.Counter
|
||||||
RouterReqsTLSCounter() metrics.Counter
|
RouterReqsTLSCounter() metrics.Counter
|
||||||
RouterReqDurationHistogram() ScalableHistogram
|
RouterReqDurationHistogram() ScalableHistogram
|
||||||
RouterOpenConnsGauge() metrics.Gauge
|
RouterOpenConnsGauge() metrics.Gauge
|
||||||
|
|
||||||
// service metrics
|
// service metrics
|
||||||
|
|
||||||
ServiceReqsCounter() metrics.Counter
|
ServiceReqsCounter() metrics.Counter
|
||||||
ServiceReqsTLSCounter() metrics.Counter
|
ServiceReqsTLSCounter() metrics.Counter
|
||||||
ServiceReqDurationHistogram() ScalableHistogram
|
ServiceReqDurationHistogram() ScalableHistogram
|
||||||
|
|
|
@ -166,6 +166,8 @@ func containsHeader(req *http.Request, name, value string) bool {
|
||||||
// values that are not part of the set of HTTP verbs are replaced with EXTENSION_METHOD.
|
// values that are not part of the set of HTTP verbs are replaced with EXTENSION_METHOD.
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
|
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
|
||||||
// https://datatracker.ietf.org/doc/html/rfc2616/#section-5.1.1.
|
// https://datatracker.ietf.org/doc/html/rfc2616/#section-5.1.1.
|
||||||
|
//
|
||||||
|
//nolint:usestdlibvars
|
||||||
func getMethod(r *http.Request) string {
|
func getMethod(r *http.Request) string {
|
||||||
if !utf8.ValidString(r.Method) {
|
if !utf8.ValidString(r.Method) {
|
||||||
log.WithoutContext().Warnf("Invalid HTTP method encoding: %s", r.Method)
|
log.WithoutContext().Warnf("Invalid HTTP method encoding: %s", r.Method)
|
||||||
|
|
|
@ -166,7 +166,7 @@ func (rl *rateLimiter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
delay := res.Delay()
|
delay := res.Delay()
|
||||||
if delay > rl.maxDelay {
|
if delay > rl.maxDelay {
|
||||||
res.Cancel()
|
res.Cancel()
|
||||||
rl.serveDelayError(ctx, w, r, delay)
|
rl.serveDelayError(ctx, w, delay)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ func (rl *rateLimiter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
rl.next.ServeHTTP(w, r)
|
rl.next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rl *rateLimiter) serveDelayError(ctx context.Context, w http.ResponseWriter, r *http.Request, delay time.Duration) {
|
func (rl *rateLimiter) serveDelayError(ctx context.Context, w http.ResponseWriter, delay time.Duration) {
|
||||||
w.Header().Set("Retry-After", fmt.Sprintf("%.0f", math.Ceil(delay.Seconds())))
|
w.Header().Set("Retry-After", fmt.Sprintf("%.0f", math.Ceil(delay.Seconds())))
|
||||||
w.Header().Set("X-Retry-In", delay.String())
|
w.Header().Set("X-Retry-In", delay.String())
|
||||||
w.WriteHeader(http.StatusTooManyRequests)
|
w.WriteHeader(http.StatusTooManyRequests)
|
||||||
|
|
|
@ -16,7 +16,6 @@ import (
|
||||||
"github.com/traefik/traefik/v2/pkg/config/dynamic"
|
"github.com/traefik/traefik/v2/pkg/config/dynamic"
|
||||||
"github.com/traefik/traefik/v2/pkg/log"
|
"github.com/traefik/traefik/v2/pkg/log"
|
||||||
"github.com/traefik/traefik/v2/pkg/middlewares"
|
"github.com/traefik/traefik/v2/pkg/middlewares"
|
||||||
"github.com/traefik/traefik/v2/pkg/safe"
|
|
||||||
"github.com/traefik/traefik/v2/pkg/tracing"
|
"github.com/traefik/traefik/v2/pkg/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -118,7 +117,7 @@ func (r *retry) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||||
r.listener.Retried(req, attempts)
|
r.listener.Retried(req, attempts)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := backoff.RetryNotify(safe.OperationWithRecover(operation), backOff, notify)
|
err := backoff.RetryNotify(operation, backOff, notify)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.FromContext(middlewares.GetLoggerCtx(req.Context(), r.name, typeName)).
|
log.FromContext(middlewares.GetLoggerCtx(req.Context(), r.name, typeName)).
|
||||||
Debugf("Final retry attempt failed: %v", err.Error())
|
Debugf("Final retry attempt failed: %v", err.Error())
|
||||||
|
|
|
@ -26,7 +26,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
|
||||||
domainSafe := &safe.Safe{}
|
domainSafe := &safe.Safe{}
|
||||||
domainSafe.Set(domainMap)
|
domainSafe.Set(domainMap)
|
||||||
|
|
||||||
// FIXME Add a test for DefaultCertificate
|
// TODO Add a test for DefaultCertificate
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
desc string
|
desc string
|
||||||
dynamicCerts *safe.Safe
|
dynamicCerts *safe.Safe
|
||||||
|
|
|
@ -140,9 +140,9 @@ func (p *Provider) buildTCPServiceConfiguration(item itemData, configuration *dy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range configuration.Services {
|
for name, service := range configuration.Services {
|
||||||
if err := p.addServerTCP(item, service.LoadBalancer); err != nil {
|
if err := p.addServerTCP(item, service.LoadBalancer); err != nil {
|
||||||
return err
|
return fmt.Errorf("%s: %w", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,9 +160,9 @@ func (p *Provider) buildUDPServiceConfiguration(item itemData, configuration *dy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range configuration.Services {
|
for name, service := range configuration.Services {
|
||||||
if err := p.addServerUDP(item, service.LoadBalancer); err != nil {
|
if err := p.addServerUDP(item, service.LoadBalancer); err != nil {
|
||||||
return err
|
return fmt.Errorf("%s: %w", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ func (p *Provider) buildServiceConfiguration(item itemData, configuration *dynam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range configuration.Services {
|
for name, service := range configuration.Services {
|
||||||
if err := p.addServer(item, service.LoadBalancer); err != nil {
|
if err := p.addServer(item, service.LoadBalancer); err != nil {
|
||||||
return err
|
return fmt.Errorf("%s: %w", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
||||||
logger.Errorf("Failed to create a client for docker, error: %s", err)
|
logger.Errorf("Failed to create a client for docker, error: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer dockerClient.Close()
|
||||||
|
|
||||||
serverVersion, err := dockerClient.ServerVersion(ctx)
|
serverVersion, err := dockerClient.ServerVersion(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -250,7 +251,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
services, err := p.listServices(ctx, dockerClient)
|
services, err := p.listServices(ctx, dockerClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Failed to list services for docker, error %s", err)
|
logger.Errorf("Failed to list services for docker swarm mode, error %s", err)
|
||||||
errChan <- err
|
errChan <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ metadata:
|
||||||
|
|
||||||
data:
|
data:
|
||||||
ca.crt: VEVTVFJPT1RDQVM0
|
ca.crt: VEVTVFJPT1RDQVM0
|
||||||
tls.ca: VEVTVFJPT1RDQVM1 # <-- This should be the prefered one.
|
tls.ca: VEVTVFJPT1RDQVM1 # <-- This should be the preferred one.
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (s *Mock) List(ctx context.Context, prefix string, options *store.ReadOptio
|
||||||
}
|
}
|
||||||
var kv []*store.KVPair
|
var kv []*store.KVPair
|
||||||
for _, kvPair := range s.KVPairs {
|
for _, kvPair := range s.KVPairs {
|
||||||
if strings.HasPrefix(kvPair.Key, prefix) { // FIXME && !strings.ContainsAny(strings.TrimPrefix(kvPair.Key, prefix), "/") {
|
if strings.HasPrefix(kvPair.Key, prefix) {
|
||||||
kv = append(kv, kvPair)
|
kv = append(kv, kvPair)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
|
||||||
return nil, badConf
|
return nil, badConf
|
||||||
}
|
}
|
||||||
middleware = func(next http.Handler) (http.Handler, error) {
|
middleware = func(next http.Handler) (http.Handler, error) {
|
||||||
// FIXME missing metrics / accessLog
|
// TODO missing metrics / accessLog
|
||||||
return retry.New(ctx, next, *config.Retry, retry.Listeners{}, middlewareName)
|
return retry.New(ctx, next, *config.Retry, retry.Listeners{}, middlewareName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (r *Router) ServeTCP(conn tcp.WriteCloser) {
|
||||||
// we still need to reply with a 404.
|
// we still need to reply with a 404.
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME -- Check if ProxyProtocol changes the first bytes of the request
|
// TODO -- Check if ProxyProtocol changes the first bytes of the request
|
||||||
br := bufio.NewReader(conn)
|
br := bufio.NewReader(conn)
|
||||||
hello, err := clientHelloInfo(br)
|
hello, err := clientHelloInfo(br)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -218,7 +218,7 @@ func (r *Router) AddHTTPTLSConfig(sniHost string, config *tls.Config) {
|
||||||
|
|
||||||
// GetConn creates a connection proxy with a peeked string.
|
// GetConn creates a connection proxy with a peeked string.
|
||||||
func (r *Router) GetConn(conn tcp.WriteCloser, peeked string) tcp.WriteCloser {
|
func (r *Router) GetConn(conn tcp.WriteCloser, peeked string) tcp.WriteCloser {
|
||||||
// FIXME should it really be on Router ?
|
// TODO should it really be on Router ?
|
||||||
conn = &Conn{
|
conn = &Conn{
|
||||||
Peeked: []byte(peeked),
|
Peeked: []byte(peeked),
|
||||||
WriteCloser: conn,
|
WriteCloser: conn,
|
||||||
|
|
|
@ -52,11 +52,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m
|
||||||
log.FromContext(ctx).Warn("Config has more than one udp router for a given entrypoint.")
|
log.FromContext(ctx).Warn("Config has more than one udp router for a given entrypoint.")
|
||||||
}
|
}
|
||||||
|
|
||||||
handlers, err := m.buildEntryPointHandlers(ctx, routers)
|
handlers := m.buildEntryPointHandlers(ctx, routers)
|
||||||
if err != nil {
|
|
||||||
log.FromContext(ctx).Error(err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(handlers) > 0 {
|
if len(handlers) > 0 {
|
||||||
// As UDP support only one router per entrypoint, we only take the first one.
|
// As UDP support only one router per entrypoint, we only take the first one.
|
||||||
|
@ -66,7 +62,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m
|
||||||
return entryPointHandlers
|
return entryPointHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) buildEntryPointHandlers(ctx context.Context, configs map[string]*runtime.UDPRouterInfo) ([]udp.Handler, error) {
|
func (m *Manager) buildEntryPointHandlers(ctx context.Context, configs map[string]*runtime.UDPRouterInfo) []udp.Handler {
|
||||||
var rtNames []string
|
var rtNames []string
|
||||||
for routerName := range configs {
|
for routerName := range configs {
|
||||||
rtNames = append(rtNames, routerName)
|
rtNames = append(rtNames, routerName)
|
||||||
|
@ -101,5 +97,5 @@ func (m *Manager) buildEntryPointHandlers(ctx context.Context, configs map[strin
|
||||||
handlers = append(handlers, handler)
|
handlers = append(handlers, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
return handlers, nil
|
return handlers
|
||||||
}
|
}
|
||||||
|
|
|
@ -426,7 +426,7 @@ func (m *Manager) upsertServers(ctx context.Context, lb healthcheck.BalancerHand
|
||||||
return fmt.Errorf("error adding server %s to load balancer: %w", srv.URL, err)
|
return fmt.Errorf("error adding server %s to load balancer: %w", srv.URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Handle Metrics
|
// TODO Handle Metrics
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetBestCertificate(t *testing.T) {
|
func TestGetBestCertificate(t *testing.T) {
|
||||||
// FIXME Add tests for defaultCert
|
// TODO Add tests for defaultCert
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
desc string
|
desc string
|
||||||
domainToCheck string
|
domainToCheck string
|
||||||
|
|
Loading…
Reference in a new issue