Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Traefik v2.10, go1.21 and alpine 3.18 #842

Open
wants to merge 10 commits into
base: v1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'traefik/mesh'
env:
STRUCTOR_VERSION: v1.12.0
STRUCTOR_VERSION: v1.13.2
MIXTUS_VERSION: v0.4.1

steps:
Expand Down
8 changes: 6 additions & 2 deletions .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
max-per-linter = 0
max-same-issues = 0
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",
"Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv|\\(k8s\\.io/client-go/tools/cache\\.SharedInformer\\)\\.AddEventHandler). is not checked",
"package-comments: should have a package comment",
"import '[^']+' is not allowed from list 'Main'",
"if-return: redundant if ...; err != nil check, just return error instead.",
"unused-parameter: parameter '[^']+' seems to be unused, consider removing or renaming it as _",
"tag is not aligned, should be: description:",
Copy link
Contributor

@ldez ldez Oct 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should revert this modification.
And add the following snippet inside the .golangci.toml file:

[linters-settings.depguard]
    [linters-settings.depguard.rules.main]
        [[linters-settings.depguard.rules.main.deny]]
            pkg = "github.com/instana/testify"
            desc = "not allowed"

        [[linters-settings.depguard.rules.main.deny]]
            pkg = "github.com/pkg/errors"
            desc = "Should be replaced by standard lib errors package"

[linters-settings.tagalign]
    align = false
    sort = true
    order = [
        "description",
        "json",
        "toml",
        "yaml",
        "yml",
        "label",
        "label-slice-as-struct",
        "file",
        "kv",
        "export"
    ]

The other problem should be fixed (and not ignored) except "package-comments: should have a package comment"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do except fixing the actual problems, you know your code better 😅

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could fix linter issues except AddEventHandler and unused-parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry can you revert the change related to tagalign and add this configuration:

[linters-settings.tagalign]
    align = false
    sort = true
    order = [
        "description",
        "json",
        "toml",
        "yaml",
        "yml",
        "label",
        "label-slice-as-struct",
        "file",
        "kv",
        "export"
    ]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can fix unused-parameter: you just have to replace the name of the parameter with _.

And AddEventHandler can also be fixed but it's a bit more complex, so you can ignore them inside this PR but I will fix them after the merge of your PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already tried that yesterday, it doesn't work, just another linter pops up instead of revive:
File is not `gci`-ed with --skip-generated -s standard -s default (gci)
It would be much easier if you fix those special cases yourself, you know your code and Go better than me.

And no single check has been run yet, can't you start the GitHub Actions manually to see if all integration tests work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works I did it locally.

]
4 changes: 2 additions & 2 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Traefik Mesh Pipeline
agent:
machine:
type: e1-standard-4
os_image: ubuntu1804
os_image: ubuntu2004

auto_cancel:
running:
Expand All @@ -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.21
- 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.21-alpine AS base-image

# Package dependencies
RUN apk --no-cache --no-progress add \
Expand All @@ -21,21 +21,21 @@ 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.54.2

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

RUN make ${MAKE_TARGET}

## IMAGE
FROM alpine:3.15
FROM alpine:3.18

RUN addgroup -g 1000 -S app && \
adduser -u 1000 -S app -G app
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ check: $(DIST_DIR)
"$(DOCKER_IMAGE_NAME):check" golangci-lint run --config .golangci.toml

publish-images: build
seihon publish -v "$(VERSION)" -v "latest" --image-name ${DOCKER_IMAGE_NAME} --dry-run=false --base-runtime-image=alpine:3.15
seihon publish -v "$(VERSION)" -v "latest" --image-name ${DOCKER_IMAGE_NAME} --dry-run=false --base-runtime-image=alpine:3.18

## Create packages for the release
release-packages: vendor build
Expand Down Expand Up @@ -102,7 +102,7 @@ tidy:
go mod tidy

k3d:
@command -v k3d >/dev/null 2>&1 || curl -s https://raw.githubusercontent.com/rancher/k3d/v5.4.4/install.sh | TAG=v5.4.4 bash
@command -v k3d >/dev/null 2>&1 || curl -s https://raw.githubusercontent.com/rancher/k3d/v5.6.0/install.sh | TAG=v5.6.0 bash

docs-package:
mkdir -p $(CURDIR)/pages
Expand Down
14 changes: 6 additions & 8 deletions docs/check.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.15
FROM alpine:3.18

# The "build-dependencies" virtual package provides build tools for html-proofer installation.
# It compile ruby-nokogiri, because alpine native version is always out of date
Expand All @@ -14,20 +14,18 @@ RUN apk --no-cache --no-progress add \
ruby-dev \
build-base

RUN gem install --no-document html-proofer -v 3.19.0 -- --use-system-libraries
RUN gem install --no-document html-proofer -v 5.0.8 -- --use-system-libraries

# After Ruby, some NodeJS YAY!
RUN apk --no-cache --no-progress add \
git \
nodejs \
npm

# To handle 'not get uid/gid'
RUN npm config set unsafe-perm true

RUN npm install --global \
[email protected] \
[email protected]
# unsafe-perm true to handle 'not get uid/gid'
RUN npm install --global --unsafe-perm=true \
[email protected] \
[email protected]

# Finally the shell tools we need for later
# tini helps to terminate properly all the parallelized tasks when sending CTRL-C
Expand Down
10 changes: 5 additions & 5 deletions docs/content/contributing/building-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ $ make
Successfully tagged traefik/mesh:latest
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
version : 019a39d
commit : 019a39d
build date : 2023-10-14_02:17:49PM
go version : go1.21.3
go compiler : gc
platform : linux/amd64
#[...]
Expand Down Expand Up @@ -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.21
go compiler : gc
platform : linux/amd64
```
Expand Down
10 changes: 5 additions & 5 deletions docs/content/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
serviceAccount: whoami-server
containers:
- name: whoami
image: traefik/whoami:v1.6.0
image: traefik/whoami:v1.10.1
imagePullPolicy: IfNotPresent

---
Expand All @@ -77,7 +77,7 @@ spec:
serviceAccount: whoami-server
containers:
- name: whoami-tcp
image: traefik/whoamitcp:v0.1.0
image: traefik/whoamitcp:v0.3.0
imagePullPolicy: IfNotPresent

---
Expand Down Expand Up @@ -122,7 +122,7 @@ spec:
serviceAccountName: whoami-client
containers:
- name: whoami-client
image: giantswarm/tiny-tools:3.9
image: giantswarm/tiny-tools:3.12
command:
- "sleep"
- "3600"
Expand Down Expand Up @@ -164,7 +164,7 @@ IP: 5.6.7.8
RemoteAddr: 1.2.3.4:12345
GET / HTTP/1.1
Host: whoami.whoami.svc.cluster.local
User-Agent: curl/7.64.0
User-Agent: curl/7.69.1
Accept: */*
```

Expand Down Expand Up @@ -239,7 +239,7 @@ IP: 5.6.7.8
RemoteAddr: 1.2.3.4:12345
GET / HTTP/1.1
Host: whoami.whoami.traefik.mesh
User-Agent: curl/7.64.0
User-Agent: curl/7.69.1
Accept: */*
X-Forwarded-For: 3.4.5.6
```
Expand Down
4 changes: 2 additions & 2 deletions docs/content/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ spec:
spec:
containers:
- name: server
image: traefik/whoami:v1.6.0
image: traefik/whoami:v1.10.1
ports:
- containerPort: 80
---
Expand Down Expand Up @@ -116,7 +116,7 @@ spec:
spec:
containers:
- name: client
image: giantswarm/tiny-tools:3.9
image: giantswarm/tiny-tools:3.12
imagePullPolicy: IfNotPresent
command:
- "sleep"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.15
FROM alpine:3.18

ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin

Expand Down
100 changes: 57 additions & 43 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,69 +1,83 @@
module github.com/traefik/mesh

go 1.19
go 1.21

toolchain go1.21.3

require (
github.com/cenkalti/backoff/v4 v4.1.1
github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/google/uuid v1.3.0
github.com/cenkalti/backoff/v4 v4.2.1
github.com/go-check/check v0.0.0-20201130134442-10cb98267c6c
github.com/google/uuid v1.3.1
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-version v1.3.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/hashicorp/go-version v1.6.0
github.com/servicemeshinterface/smi-sdk-go v0.5.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/traefik/paerser v0.2.0
github.com/traefik/traefik/v2 v2.10.5
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.26.9
k8s.io/apimachinery v0.26.9
k8s.io/client-go v0.26.9
)

require (
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/BurntSushi/toml v1.3.2 // 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/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // 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/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/go-acme/lego/v4 v4.14.2 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // 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.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.6.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.4.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.56 // 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/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/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.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
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // 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.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

// Containous forks
Expand Down
Loading