Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,18 @@
disable = [
"sqlclosecheck", # Not relevant (SQL)
"rowserrcheck", # Not relevant (SQL)
"ifshort", # Deprecated
"interfacer", # Deprecated
"golint", # Deprecated
"maligned", # Deprecated
"scopelint", # Deprecated
"cyclop", # Duplicate of gocyclo
"lll", # Long lines are ok.
"dupl", # Not relevant
"prealloc", # Not relevant
"gochecknoinits", # Too strict
"gochecknoglobals", # Too strict
"gomnd", # Does not allow for any config or time values
"gosec", # Does not allow exec.Command with variable
"bodyclose", # Too many false positives
"goconst", # Too many false positives
"wrapcheck", # Too strict
"goerr113", # Forces wrapping all errors
"noctx", # Too strict
"exhaustive", # Too strict
"exhaustivestruct", # Too strict
"exhaustruct", # Duplicate of exhaustivestruct
"nlreturn", # Too strict
"ireturn", # Not relevant
Expand All @@ -68,8 +60,15 @@
"paralleltest", # Not relevant
"forcetypeassert", # Too strict
"nonamedreturns", # Not relevant
"structcheck", # Duplicate of unused
"funlen",
"revive",
"testifylint",
"mnd",
"depguard",
"musttag",
"err113",
"predeclared",
"recvcheck"
]

[issues]
Expand All @@ -79,4 +78,7 @@
exclude = [
"Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked",
"should have a package comment, unless it's in another file for this package",
"SA1019: workqueue\\.NewRateLimitingQueue is deprecated: Use NewTypedRateLimitingQueue instead",
"SA1019: workqueue\\.RateLimitingInterface is deprecated: Use TypedRateLimitingInterface instead",
"SA1019: workqueue\\.DefaultControllerRateLimiter is deprecated: Use DefaultTypedControllerRateLimiter instead"
]
2 changes: 1 addition & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ global_job_config:
prologue:
commands:
- curl -sSfL https://raw.githubusercontent.com/ldez/semgo/master/godownloader.sh | sudo sh -s -- -b "/usr/local/bin"
- sudo semgo go1.19
- sudo semgo go1.24
- echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- checkout

Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS base-image
FROM golang:1.24-alpine AS base-image

# Package dependencies
RUN apk --no-cache --no-progress add \
Expand All @@ -21,14 +21,14 @@ WORKDIR /go/src/github.com/traefik/mesh
RUN curl -sfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | sh

# Download golangci-lint binary to bin folder in $GOPATH
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.48.0
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.64.8

ENV GO111MODULE on
ENV GO111MODULE=on
COPY go.mod go.sum ./
RUN go mod download
COPY . .

FROM base-image as maker
FROM base-image AS maker

ARG MAKE_TARGET=local-build

Expand Down
60 changes: 30 additions & 30 deletions cmd/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import (

// TraefikMeshConfiguration wraps the static configuration and extra parameters.
type TraefikMeshConfiguration struct {
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
MasterURL string `description:"The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
Debug bool `description:"Debug mode, deprecated, use --loglevel=debug instead." export:"true"`
ACL bool `description:"Enable ACL mode." export:"true"`
SMI bool `description:"Enable SMI operation, deprecated, use --acl instead." export:"true"`
DefaultMode string `description:"Default mode for mesh services." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
WatchNamespaces []string `description:"Namespaces to watch." export:"true"`
IgnoreNamespaces []string `description:"Namespaces to ignore." export:"true"`
APIPort int32 `description:"API port for the controller." export:"true"`
APIHost string `description:"API host for the controller to bind to." export:"true"`
LimitHTTPPort int32 `description:"Number of HTTP ports allocated." export:"true"`
LimitTCPPort int32 `description:"Number of TCP ports allocated." export:"true"`
LimitUDPPort int32 `description:"Number of UDP ports allocated." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
Debug bool `description:"Debug mode, deprecated, use --loglevel=debug instead." export:"true"`
ACL bool `description:"Enable ACL mode." export:"true"`
SMI bool `description:"Enable SMI operation, deprecated, use --acl instead." export:"true"`
DefaultMode string `description:"Default mode for mesh services." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
WatchNamespaces []string `description:"Namespaces to watch." export:"true"`
IgnoreNamespaces []string `description:"Namespaces to ignore." export:"true"`
APIPort int32 `description:"API port for the controller." export:"true"`
APIHost string `description:"API host for the controller to bind to." export:"true"`
LimitHTTPPort int32 `description:"Number of HTTP ports allocated." export:"true"`
LimitTCPPort int32 `description:"Number of TCP ports allocated." export:"true"`
LimitUDPPort int32 `description:"Number of UDP ports allocated." export:"true"`
}

// NewTraefikMeshConfiguration creates a TraefikMeshConfiguration with default values.
Expand All @@ -47,16 +47,16 @@ func NewTraefikMeshConfiguration() *TraefikMeshConfiguration {

// PrepareConfiguration holds the configuration to prepare the cluster.
type PrepareConfiguration struct {
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
MasterURL string `description:"The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
Debug bool `description:"Debug mode, deprecated, use --loglevel=debug instead." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
ClusterDomain string `description:"Your internal K8s cluster domain." export:"true"`
SMI bool `description:"Enable SMI operation, deprecated, use --acl instead." export:"true"`
ACL bool `description:"Enable ACL mode." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
Debug bool `description:"Debug mode, deprecated, use --loglevel=debug instead." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
ClusterDomain string `description:"Your internal K8s cluster domain." export:"true"`
SMI bool `description:"Enable SMI operation, deprecated, use --acl instead." export:"true"`
ACL bool `description:"Enable ACL mode." export:"true"`
}

// NewPrepareConfiguration creates a PrepareConfiguration with default values.
Expand All @@ -74,12 +74,12 @@ func NewPrepareConfiguration() *PrepareConfiguration {

// CleanupConfiguration holds the configuration for the cleanup command.
type CleanupConfiguration struct {
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"`
KubeConfig string `description:"Path to a kubeconfig. Only required if out-of-cluster." export:"true"`
MasterURL string `description:"The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
Namespace string `description:"The namespace that Traefik Mesh is installed in." export:"true"`
LogLevel string `description:"The log level." export:"true"`
LogFormat string `description:"The log format." export:"true"`
}

// NewCleanupConfiguration creates CleanupConfiguration.
Expand Down
2 changes: 1 addition & 1 deletion cmd/loaders.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (f *FileLoader) Load(args []string, cmd *cli.Command) (bool, error) {
return false, err
}

configFileFlag := fmt.Sprintf("%s.configFile", parser.DefaultRootName)
configFileFlag := parser.DefaultRootName + ".configFile"

configFile, err := loadConfigFiles(ref[configFileFlag], cmd.Configuration)
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions cmd/mesh/mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func traefikMeshCommand(config *cmd.TraefikMeshConfiguration) error {
return fmt.Errorf("unable to create the API server: %w", err)
}

ctr := controller.NewMeshController(clients, controller.Config{
ctr, err := controller.NewMeshController(clients, controller.Config{
ACLEnabled: aclEnabled,
DefaultMode: config.DefaultMode,
Namespace: config.Namespace,
Expand All @@ -111,6 +111,9 @@ func traefikMeshCommand(config *cmd.TraefikMeshConfiguration) error {
MinUDPPort: minUDPPort,
MaxUDPPort: getMaxPort(minUDPPort, config.LimitUDPPort),
}, apiServer, log)
if err != nil {
return fmt.Errorf("creating mesh controller: %w", err)
}

var wg sync.WaitGroup

Expand Down Expand Up @@ -168,6 +171,6 @@ func stopAPIServer(apiServer *api.API, log logrus.FieldLogger) {
}
}

func getMaxPort(min int32, limit int32) int32 {
func getMaxPort(min, limit int32) int32 {
return min + limit - 1
}
8 changes: 4 additions & 4 deletions docs/content/contributing/building-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ docker run --name=build -t "traefik/mesh:latest" version
version:
version : d6947526
commit : d6947526
build date : 2022-03-16_03:19:22PM
go version : go1.19
build date : 2022-11-14_03:19:22PM
go version : go1.24
go compiler : gc
platform : linux/amd64
#[...]
Expand All @@ -42,7 +42,7 @@ traefik-mesh

Requirements:

- `Go` v1.19+
- `Go` v1.24+
- Environment variable `GO111MODULE=on`

One your Go environment is set up, you can build Traefik Mesh from the sources by using the `go build` command.
Expand All @@ -55,7 +55,7 @@ version:
version : dev
commit : I don't remember exactly
build date : I don't remember exactly
go version : go1.19
go version : go1.24
go compiler : gc
platform : linux/amd64
```
Expand Down
108 changes: 59 additions & 49 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,75 +1,85 @@
module github.com/traefik/mesh

go 1.19
go 1.24.0

require (
github.com/cenkalti/backoff/v4 v4.1.1
github.com/cenkalti/backoff/v4 v4.3.0
github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-version v1.3.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/hashicorp/go-version v1.7.0
github.com/servicemeshinterface/smi-sdk-go v0.4.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.0
github.com/traefik/paerser v0.1.8
github.com/traefik/traefik/v2 v2.8.3
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.10.0
github.com/traefik/paerser v0.2.2
github.com/traefik/traefik/v2 v2.11.31
github.com/vdemeester/shakers v0.1.0
k8s.io/api v0.22.5
k8s.io/apimachinery v0.22.5
k8s.io/client-go v0.22.5
k8s.io/api v0.32.3
k8s.io/apimachinery v0.32.3
k8s.io/client-go v0.32.3
)

require (
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/go-acme/lego/v4 v4.7.0 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-acme/lego/v4 v4.25.2 // indirect
github.com/go-jose/go-jose/v4 v4.1.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/miekg/dns v1.1.67 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/crypto v0.43.0 // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/net v0.46.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/term v0.36.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.37.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.10.0 // indirect
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect
k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

// Containous forks
replace (
github.com/abbot/go-http-auth => github.com/containous/go-http-auth v0.4.1-0.20200324110947-a37a7636d23e
github.com/go-check/check => github.com/containous/check v0.0.0-20170915194414-ca0bf163426a
github.com/gorilla/mux => github.com/containous/mux v0.0.0-20220627093034-b2dd784e613f
github.com/mailgun/minheap => github.com/containous/minheap v0.0.0-20190809180810-6e71eb837595
)
Loading
Loading