From e56ae1a7666cf9bffe817c39722c04768b8878ee Mon Sep 17 00:00:00 2001 From: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:00:06 +0200 Subject: [PATCH] Update to go1.23 --- .github/workflows/build.yaml | 2 +- .github/workflows/experimental.yaml | 2 +- .github/workflows/test-integration.yaml | 2 +- .github/workflows/test-unit.yaml | 2 +- .github/workflows/validate.yaml | 4 +-- .golangci.yml | 6 ++-- .semaphore/semaphore.yml | 4 +-- .../kubernetes-crd-definition-v1.yml | 36 +++++++++---------- .../traefik.containo.us_ingressroutes.yaml | 2 +- .../traefik.containo.us_ingressroutetcps.yaml | 2 +- .../traefik.containo.us_ingressrouteudps.yaml | 2 +- .../traefik.containo.us_middlewares.yaml | 2 +- .../traefik.containo.us_middlewaretcps.yaml | 2 +- ...traefik.containo.us_serverstransports.yaml | 2 +- .../traefik.containo.us_tlsoptions.yaml | 2 +- .../traefik.containo.us_tlsstores.yaml | 2 +- .../traefik.containo.us_traefikservices.yaml | 2 +- .../traefik.io_ingressroutes.yaml | 2 +- .../traefik.io_ingressroutetcps.yaml | 2 +- .../traefik.io_ingressrouteudps.yaml | 2 +- .../traefik.io_middlewares.yaml | 2 +- .../traefik.io_middlewaretcps.yaml | 2 +- .../traefik.io_serverstransports.yaml | 2 +- .../traefik.io_tlsoptions.yaml | 2 +- .../traefik.io_tlsstores.yaml | 2 +- .../traefik.io_traefikservices.yaml | 2 +- go.mod | 2 +- integration/fixtures/k8s/01-traefik-crd.yml | 36 +++++++++---------- pkg/api/criterion.go | 10 +++--- pkg/collector/collector.go | 10 +++--- pkg/middlewares/accesslog/logger_test.go | 6 ++-- pkg/middlewares/auth/forward.go | 20 +++++------ pkg/middlewares/ipallowlist/ip_allowlist.go | 5 ++- pkg/middlewares/ipwhitelist/ip_whitelist.go | 5 ++- .../pass_tls_client_cert_test.go | 4 +-- pkg/provider/docker/config.go | 3 +- pkg/provider/ecs/config.go | 3 +- pkg/tcp/wrr_load_balancer.go | 14 ++++---- pkg/udp/wrr_load_balancer.go | 14 ++++---- script/code-gen-docker.sh | 2 +- script/codegen.Dockerfile | 4 +-- 41 files changed, 113 insertions(+), 119 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 542cd056b..18f66ed3b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,7 +10,7 @@ on: - 'script/gcg/**' env: - GO_VERSION: '1.22' + GO_VERSION: '1.23' CGO_ENABLED: 0 jobs: diff --git a/.github/workflows/experimental.yaml b/.github/workflows/experimental.yaml index 7d9e2e2ea..aadce96a8 100644 --- a/.github/workflows/experimental.yaml +++ b/.github/workflows/experimental.yaml @@ -7,7 +7,7 @@ on: - v* env: - GO_VERSION: '1.22' + GO_VERSION: '1.23' CGO_ENABLED: 0 jobs: diff --git a/.github/workflows/test-integration.yaml b/.github/workflows/test-integration.yaml index c00cad272..10fe2ca44 100644 --- a/.github/workflows/test-integration.yaml +++ b/.github/workflows/test-integration.yaml @@ -10,7 +10,7 @@ on: - 'script/gcg/**' env: - GO_VERSION: '1.22' + GO_VERSION: '1.23' CGO_ENABLED: 0 jobs: diff --git a/.github/workflows/test-unit.yaml b/.github/workflows/test-unit.yaml index a22dc4cda..5550ec1cd 100644 --- a/.github/workflows/test-unit.yaml +++ b/.github/workflows/test-unit.yaml @@ -10,7 +10,7 @@ on: - 'script/gcg/**' env: - GO_VERSION: '1.22' + GO_VERSION: '1.23' jobs: diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 641d5b7b9..708b88e24 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -6,8 +6,8 @@ on: - '*' env: - GO_VERSION: '1.22' - GOLANGCI_LINT_VERSION: v1.59.0 + GO_VERSION: '1.23' + GOLANGCI_LINT_VERSION: v1.60.3 MISSSPELL_VERSION: v0.6.0 jobs: diff --git a/.golangci.yml b/.golangci.yml index b164ea9ed..41a87c9fd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -197,8 +197,7 @@ linters: - maintidx # kind of duplicate of gocyclo - nonamedreturns # Too strict - gosmopolitan # not relevant - - exportloopref # Useless with go1.22 - - musttag + - exportloopref # Not relevant since go1.22 issues: exclude-use-default: false @@ -271,3 +270,6 @@ issues: text: 'unusedwrite: unused write to field' linters: - govet + - path: pkg/provider/acme/local_store.go + linters: + - musttag diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 4c638d96c..1ea75c475 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -19,13 +19,13 @@ 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.22 + - sudo semgo go1.23 - export "GOPATH=$(go env GOPATH)" - export "SEMAPHORE_GIT_DIR=${GOPATH}/src/github.com/traefik/${SEMAPHORE_PROJECT_NAME}" - export "PATH=${GOPATH}/bin:${PATH}" - mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin" - 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.59.0 + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.60.3 - curl -sSfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | bash -s -- -b "${GOPATH}/bin" - checkout - cache restore traefik-$(checksum go.sum) diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml index 2b4b4aad6..be8be7dd4 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.io spec: group: traefik.io @@ -290,7 +290,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.io spec: group: traefik.io @@ -514,7 +514,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.io spec: group: traefik.io @@ -618,7 +618,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.io spec: group: traefik.io @@ -1598,7 +1598,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.io spec: group: traefik.io @@ -1685,7 +1685,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.io spec: group: traefik.io @@ -1811,7 +1811,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.io spec: group: traefik.io @@ -1925,7 +1925,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.io spec: group: traefik.io @@ -2022,7 +2022,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.io spec: group: traefik.io @@ -2433,7 +2433,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.containo.us spec: group: traefik.containo.us @@ -2720,7 +2720,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.containo.us spec: group: traefik.containo.us @@ -2944,7 +2944,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.containo.us spec: group: traefik.containo.us @@ -3048,7 +3048,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.containo.us spec: group: traefik.containo.us @@ -4028,7 +4028,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.containo.us spec: group: traefik.containo.us @@ -4115,7 +4115,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.containo.us spec: group: traefik.containo.us @@ -4241,7 +4241,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.containo.us spec: group: traefik.containo.us @@ -4355,7 +4355,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.containo.us spec: group: traefik.containo.us @@ -4452,7 +4452,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutes.yaml index 31f9791db..50f8111f5 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutetcps.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutetcps.yaml index e8356112f..a3efe07cd 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutetcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressroutetcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressrouteudps.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressrouteudps.yaml index ac3f3b17e..9d3df782b 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressrouteudps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_ingressrouteudps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewares.yaml index 605b8af5f..10382ea4c 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewares.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewaretcps.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewaretcps.yaml index 6535b365f..829a9c85a 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewaretcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_middlewaretcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_serverstransports.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_serverstransports.yaml index 454e35a2a..deb9a824a 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_serverstransports.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_serverstransports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml index bef834eab..daa25640d 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsstores.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsstores.yaml index 57c8e1bf7..40bd04225 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsstores.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsstores.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_traefikservices.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_traefikservices.yaml index 5ceb028aa..348025449 100644 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_traefikservices.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.containo.us_traefikservices.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.containo.us spec: group: traefik.containo.us diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml index 587207d7c..cd011fae3 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml index ef6f9b8c1..ed704afd0 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml index 60cc29d54..234351e9a 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml index 0068a365f..e82fab171 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml index 982caa692..dc435fdf5 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml index aad13e089..96e1d432f 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml index 19ae64ec2..0fdd05bc4 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml index 18d421823..240fcf44f 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml index f6a460a44..5c6d83ca7 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.io spec: group: traefik.io diff --git a/go.mod b/go.mod index 394e423bc..1b875c0f1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/traefik/traefik/v2 -go 1.22 +go 1.23.0 require ( github.com/BurntSushi/toml v1.4.0 diff --git a/integration/fixtures/k8s/01-traefik-crd.yml b/integration/fixtures/k8s/01-traefik-crd.yml index 2b4b4aad6..be8be7dd4 100644 --- a/integration/fixtures/k8s/01-traefik-crd.yml +++ b/integration/fixtures/k8s/01-traefik-crd.yml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.io spec: group: traefik.io @@ -290,7 +290,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.io spec: group: traefik.io @@ -514,7 +514,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.io spec: group: traefik.io @@ -618,7 +618,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.io spec: group: traefik.io @@ -1598,7 +1598,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.io spec: group: traefik.io @@ -1685,7 +1685,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.io spec: group: traefik.io @@ -1811,7 +1811,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.io spec: group: traefik.io @@ -1925,7 +1925,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.io spec: group: traefik.io @@ -2022,7 +2022,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.io spec: group: traefik.io @@ -2433,7 +2433,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutes.traefik.containo.us spec: group: traefik.containo.us @@ -2720,7 +2720,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressroutetcps.traefik.containo.us spec: group: traefik.containo.us @@ -2944,7 +2944,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: ingressrouteudps.traefik.containo.us spec: group: traefik.containo.us @@ -3048,7 +3048,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewares.traefik.containo.us spec: group: traefik.containo.us @@ -4028,7 +4028,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: middlewaretcps.traefik.containo.us spec: group: traefik.containo.us @@ -4115,7 +4115,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: serverstransports.traefik.containo.us spec: group: traefik.containo.us @@ -4241,7 +4241,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsoptions.traefik.containo.us spec: group: traefik.containo.us @@ -4355,7 +4355,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: tlsstores.traefik.containo.us spec: group: traefik.containo.us @@ -4452,7 +4452,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: traefikservices.traefik.containo.us spec: group: traefik.containo.us diff --git a/pkg/api/criterion.go b/pkg/api/criterion.go index cd173f532..4a3c35612 100644 --- a/pkg/api/criterion.go +++ b/pkg/api/criterion.go @@ -56,7 +56,7 @@ func (c *searchCriterion) searchIn(values ...string) bool { }) } -func pagination(request *http.Request, max int) (pageInfo, error) { +func pagination(request *http.Request, maximum int) (pageInfo, error) { perPage, err := getIntParam(request, "per_page", defaultPerPage) if err != nil { return pageInfo{}, err @@ -68,17 +68,17 @@ func pagination(request *http.Request, max int) (pageInfo, error) { } startIndex := (page - 1) * perPage - if startIndex != 0 && startIndex >= max { + if startIndex != 0 && startIndex >= maximum { return pageInfo{}, fmt.Errorf("invalid request: page: %d, per_page: %d", page, perPage) } endIndex := startIndex + perPage - if endIndex >= max { - endIndex = max + if endIndex >= maximum { + endIndex = maximum } nextPage := 1 - if page*perPage < max { + if page*perPage < maximum { nextPage = page + 1 } diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go index 50ce0666d..28b7fc1d8 100644 --- a/pkg/collector/collector.go +++ b/pkg/collector/collector.go @@ -21,11 +21,11 @@ const collectorURL = "https://collect.traefik.io/9vxmmkcdmalbdi635d4jgc5p5rx0h7h // Collected data. type data struct { - Version string - Codename string - BuildDate string - Configuration string - Hash string + Version string `json:"version"` + Codename string `json:"codename"` + BuildDate string `json:"buildDate"` + Configuration string `json:"configuration"` + Hash string `json:"hash"` } // Collect anonymous data. diff --git a/pkg/middlewares/accesslog/logger_test.go b/pkg/middlewares/accesslog/logger_test.go index ebec9173e..338467293 100644 --- a/pkg/middlewares/accesslog/logger_test.go +++ b/pkg/middlewares/accesslog/logger_test.go @@ -197,7 +197,7 @@ func TestLoggerHeaderFields(t *testing.T) { if config.FilePath != "" { _, err = os.Stat(config.FilePath) - require.NoError(t, err, fmt.Sprintf("logger should create %s", config.FilePath)) + require.NoErrorf(t, err, "logger should create %s", config.FilePath) } req := &http.Request{ @@ -701,7 +701,7 @@ func assertValidLogData(t *testing.T, expected string, logData []byte) { t.Helper() if len(expected) == 0 { - assert.Zero(t, len(logData)) + assert.Empty(t, logData) t.Log(string(logData)) return } @@ -758,7 +758,7 @@ func doLoggingTLSOpt(t *testing.T, config *types.AccessLog, enableTLS bool) { if config.FilePath != "" { _, err = os.Stat(config.FilePath) - require.NoError(t, err, fmt.Sprintf("logger should create %s", config.FilePath)) + require.NoErrorf(t, err, "logger should create %s", config.FilePath) } req := &http.Request{ diff --git a/pkg/middlewares/auth/forward.go b/pkg/middlewares/auth/forward.go index 708ea85dc..70b3374ab 100644 --- a/pkg/middlewares/auth/forward.go +++ b/pkg/middlewares/auth/forward.go @@ -103,9 +103,8 @@ func (fa *forwardAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) { forwardReq, err := http.NewRequest(http.MethodGet, fa.address, nil) tracing.LogRequest(tracing.GetSpan(req), forwardReq) if err != nil { - logMessage := fmt.Sprintf("Error calling %s. Cause %s", fa.address, err) - logger.Debug(logMessage) - tracing.SetErrorWithEvent(req, logMessage) + logger.Debugf("Error calling %s. Cause %s", fa.address, err) + tracing.SetErrorWithEvent(req, "Error calling %s. Cause %s", fa.address, err) rw.WriteHeader(http.StatusInternalServerError) return @@ -119,9 +118,8 @@ func (fa *forwardAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) { forwardResponse, forwardErr := fa.client.Do(forwardReq) if forwardErr != nil { - logMessage := fmt.Sprintf("Error calling %s. Cause: %s", fa.address, forwardErr) - logger.Debug(logMessage) - tracing.SetErrorWithEvent(req, logMessage) + logger.Debugf("Error calling %s. Cause: %s", fa.address, forwardErr) + tracing.SetErrorWithEvent(req, "Error calling %s. Cause: %s", fa.address, forwardErr) rw.WriteHeader(http.StatusInternalServerError) return @@ -130,9 +128,8 @@ func (fa *forwardAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) { body, readError := io.ReadAll(forwardResponse.Body) if readError != nil { - logMessage := fmt.Sprintf("Error reading body %s. Cause: %s", fa.address, readError) - logger.Debug(logMessage) - tracing.SetErrorWithEvent(req, logMessage) + logger.Debugf("Error reading body %s. Cause: %s", fa.address, readError) + tracing.SetErrorWithEvent(req, "Error reading body %s. Cause: %s", fa.address, readError) rw.WriteHeader(http.StatusInternalServerError) return @@ -151,9 +148,8 @@ func (fa *forwardAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if err != nil { if !errors.Is(err, http.ErrNoLocation) { - logMessage := fmt.Sprintf("Error reading response location header %s. Cause: %s", fa.address, err) - logger.Debug(logMessage) - tracing.SetErrorWithEvent(req, logMessage) + logger.Debugf("Error reading response location header %s. Cause: %s", fa.address, err) + tracing.SetErrorWithEvent(req, "Error reading response location header %s. Cause: %s", fa.address, err) rw.WriteHeader(http.StatusInternalServerError) return diff --git a/pkg/middlewares/ipallowlist/ip_allowlist.go b/pkg/middlewares/ipallowlist/ip_allowlist.go index d700a9279..b0dda6c31 100644 --- a/pkg/middlewares/ipallowlist/ip_allowlist.go +++ b/pkg/middlewares/ipallowlist/ip_allowlist.go @@ -66,9 +66,8 @@ func (al *ipAllowLister) ServeHTTP(rw http.ResponseWriter, req *http.Request) { clientIP := al.strategy.GetIP(req) err := al.allowLister.IsAuthorized(clientIP) if err != nil { - msg := fmt.Sprintf("Rejecting IP %s: %v", clientIP, err) - logger.Debug(msg) - tracing.SetErrorWithEvent(req, msg) + logger.Debugf("Rejecting IP %s: %v", clientIP, err) + tracing.SetErrorWithEvent(req, "Rejecting IP %s: %v", clientIP, err) reject(ctx, rw) return } diff --git a/pkg/middlewares/ipwhitelist/ip_whitelist.go b/pkg/middlewares/ipwhitelist/ip_whitelist.go index dde042b42..cc18fb2da 100644 --- a/pkg/middlewares/ipwhitelist/ip_whitelist.go +++ b/pkg/middlewares/ipwhitelist/ip_whitelist.go @@ -66,9 +66,8 @@ func (wl *ipWhiteLister) ServeHTTP(rw http.ResponseWriter, req *http.Request) { clientIP := wl.strategy.GetIP(req) err := wl.whiteLister.IsAuthorized(clientIP) if err != nil { - msg := fmt.Sprintf("Rejecting IP %s: %v", clientIP, err) - logger.Debug(msg) - tracing.SetErrorWithEvent(req, msg) + logger.Debugf("Rejecting IP %s: %v", clientIP, err) + tracing.SetErrorWithEvent(req, "Rejecting IP %s: %v", clientIP, err) reject(ctx, rw) return } diff --git a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go index 911fd3cb7..d0a4b7735 100644 --- a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go +++ b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go @@ -319,7 +319,7 @@ func TestPassTLSClientCert_PEM(t *testing.T) { res := httptest.NewRecorder() req := testhelpers.MustNewRequest(http.MethodGet, "http://example.com/foo", nil) - if test.certContents != nil && len(test.certContents) > 0 { + if len(test.certContents) > 0 { req.TLS = buildTLSWith(test.certContents) } @@ -541,7 +541,7 @@ func TestPassTLSClientCert_certInfo(t *testing.T) { res := httptest.NewRecorder() req := testhelpers.MustNewRequest(http.MethodGet, "http://example.com/foo", nil) - if test.certContents != nil && len(test.certContents) > 0 { + if len(test.certContents) > 0 { req.TLS = buildTLSWith(test.certContents) } diff --git a/pkg/provider/docker/config.go b/pkg/provider/docker/config.go index 894bb1049..f47b0221f 100644 --- a/pkg/provider/docker/config.go +++ b/pkg/provider/docker/config.go @@ -408,8 +408,7 @@ func getPort(container dockerData, serverPort string) string { nat.Sort(ports, less) if len(ports) > 0 { - min := ports[0] - return min.Port() + return ports[0].Port() } return "" diff --git a/pkg/provider/ecs/config.go b/pkg/provider/ecs/config.go index 8c9362514..297abf01b 100644 --- a/pkg/provider/ecs/config.go +++ b/pkg/provider/ecs/config.go @@ -318,8 +318,7 @@ func getPort(instance ecsInstance, serverPort string) string { nat.Sort(ports, less) if len(ports) > 0 { - min := ports[0] - return min.Port() + return ports[0].Port() } return "" diff --git a/pkg/tcp/wrr_load_balancer.go b/pkg/tcp/wrr_load_balancer.go index fd1972356..69df3a254 100644 --- a/pkg/tcp/wrr_load_balancer.go +++ b/pkg/tcp/wrr_load_balancer.go @@ -65,13 +65,13 @@ func (b *WRRLoadBalancer) AddWeightServer(serverHandler Handler, weight *int) { } func (b *WRRLoadBalancer) maxWeight() int { - max := -1 + maximum := -1 for _, s := range b.servers { - if s.weight > max { - max = s.weight + if s.weight > maximum { + maximum = s.weight } } - return max + return maximum } func (b *WRRLoadBalancer) weightGcd() int { @@ -103,8 +103,8 @@ func (b *WRRLoadBalancer) next() (Handler, error) { // and allows us not to build an iterator every time we readjust weights // Maximum weight across all enabled servers - max := b.maxWeight() - if max == 0 { + maximum := b.maxWeight() + if maximum == 0 { return nil, errors.New("all servers have 0 weight") } @@ -116,7 +116,7 @@ func (b *WRRLoadBalancer) next() (Handler, error) { if b.index == 0 { b.currentWeight -= gcd if b.currentWeight <= 0 { - b.currentWeight = max + b.currentWeight = maximum } } srv := b.servers[b.index] diff --git a/pkg/udp/wrr_load_balancer.go b/pkg/udp/wrr_load_balancer.go index d057ff426..f1d01308a 100644 --- a/pkg/udp/wrr_load_balancer.go +++ b/pkg/udp/wrr_load_balancer.go @@ -61,13 +61,13 @@ func (b *WRRLoadBalancer) AddWeightedServer(serverHandler Handler, weight *int) } func (b *WRRLoadBalancer) maxWeight() int { - max := -1 + maximum := -1 for _, s := range b.servers { - if s.weight > max { - max = s.weight + if s.weight > maximum { + maximum = s.weight } } - return max + return maximum } func (b *WRRLoadBalancer) weightGcd() int { @@ -99,8 +99,8 @@ func (b *WRRLoadBalancer) next() (Handler, error) { // what interleaves servers and allows us not to build an iterator every time we readjust weights. // Maximum weight across all enabled servers - max := b.maxWeight() - if max == 0 { + maximum := b.maxWeight() + if maximum == 0 { return nil, errors.New("all servers have 0 weight") } @@ -112,7 +112,7 @@ func (b *WRRLoadBalancer) next() (Handler, error) { if b.index == 0 { b.currentWeight -= gcd if b.currentWeight <= 0 { - b.currentWeight = max + b.currentWeight = maximum } } srv := b.servers[b.index] diff --git a/script/code-gen-docker.sh b/script/code-gen-docker.sh index 0702960d6..501957c65 100755 --- a/script/code-gen-docker.sh +++ b/script/code-gen-docker.sh @@ -9,7 +9,7 @@ IMAGE_NAME="kubernetes-codegen:latest" CURRENT_DIR="$(pwd)" echo "Building codegen Docker image..." -docker build --build-arg KUBE_VERSION=v0.29.1 \ +docker build --build-arg KUBE_VERSION=v0.29.8 \ --build-arg USER="${USER}" \ --build-arg UID="$(id -u)" \ --build-arg GID="$(id -g)" \ diff --git a/script/codegen.Dockerfile b/script/codegen.Dockerfile index 315d349c1..0d36ef63f 100644 --- a/script/codegen.Dockerfile +++ b/script/codegen.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22 +FROM golang:1.23 ARG USER=$USER ARG UID=$UID @@ -13,7 +13,7 @@ RUN go install k8s.io/code-generator/cmd/client-gen@$KUBE_VERSION RUN go install k8s.io/code-generator/cmd/lister-gen@$KUBE_VERSION RUN go install k8s.io/code-generator/cmd/informer-gen@$KUBE_VERSION RUN go install k8s.io/code-generator/cmd/deepcopy-gen@$KUBE_VERSION -RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 +RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1 RUN mkdir -p $GOPATH/src/k8s.io/code-generator RUN cp -R $GOPATH/pkg/mod/k8s.io/code-generator@$KUBE_VERSION/* $GOPATH/src/k8s.io/code-generator/