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

Correct initial problems with go1.22.2 and Docker #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg/*
src/docker_rdma_sriov/bin/*
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.10.1 as build
FROM golang:1.22.2 as build

WORKDIR /go/workspace
COPY . .
Expand All @@ -8,12 +8,10 @@ ENV GOPATH=/go/workspace
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN go get github.com/Mellanox/rdmamap github.com/Mellanox/sriovnet github.com/docker/docker/api/types github.com/spf13/cobra github.com/vishvananda/netlink github.com/docker/docker/client
RUN go install -ldflags="-s -w -X main.GitCommitId=$GIT_COMMIT -extldflags "-static"" -v docker_rdma_sriov
RUN cd src/docker_rdma_sriov && go install -ldflags="-s -w -X main.GitCommitId=$GIT_COMMIT -extldflags "-static"" -v docker_rdma_sriov

FROM debian:stretch-slim
FROM debian:bookworm-slim
RUN mkdir /container_tools

COPY --from=build /go/workspace/bin/docker_rdma_sriov /container_tools/docker_rdma_sriov

CMD cp -f /container_tools/* /tmp/
9 changes: 1 addition & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ GO_BIN=$GO_PATH/bin
export GOPATH=$GO_PATH
export GOBIN=$GO_BIN

go get github.com/Mellanox/rdmamap
go get github.com/Mellanox/sriovnet
go get github.com/docker/docker/api/types
go get github.com/spf13/cobra
go get github.com/vishvananda/netlink
go get github.com/docker/docker/client
go get github.com/Mellanox/rdmamap

export GIT_COMMIT=$(git rev-list -1 HEAD)
cd src/docker_rdma_sriov
CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-X main.GitCommitId=$GIT_COMMIT -extldflags "-static"" -o bin/docker_rdma_sriov docker_rdma_sriov
7 changes: 4 additions & 3 deletions build_container
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function execute_cmd()
"make")
echo "Building image: $ARCH_IMAGE"
GIT_COMMIT=$(git rev-list -1 HEAD)
docker build . -t $ARCH_IMAGE --build-arg GIT_COMMIT=$GIT_COMMIT
docker build . -t $ARCH_IMAGE --build-arg="GIT_COMMIT=$GIT_COMMIT" $@
;;
"push")
echo "Pushing images"
Expand All @@ -76,8 +76,9 @@ validate_input_cmd $1
if [ $# -lt 1 ]; then
input_cmd=make
else
input_cmd=$1
input_cmd=$1
shift
fi

execute_cmd
execute_cmd $@

2 changes: 1 addition & 1 deletion src/docker_rdma_sriov/devlink_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/Mellanox/sriovnet"
"github.com/k8snetworkplumbingwg/sriovnet"
"github.com/spf13/cobra"
"path/filepath"
"strings"
Expand Down
48 changes: 48 additions & 0 deletions src/docker_rdma_sriov/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module docker_rdma_sriov

go 1.22.2

replace google.golang.org/genproto/googleapis/api/httpbody => google.golang.org/genproto/googleapis/api/httpbody v0.0.0-20240227224415-6ceb2ff114de

replace google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de

replace google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de

require (
github.com/Mellanox/rdmamap v1.1.0
github.com/docker/docker v26.0.2+incompatible
github.com/k8snetworkplumbingwg/sriovnet v1.2.0
github.com/spf13/cobra v1.8.0
github.com/vishvananda/netlink v1.2.1-beta.2
github.com/vishvananda/netns v0.0.4
)

require (
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/afero v1.9.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
)
1,321 changes: 1,321 additions & 0 deletions src/docker_rdma_sriov/go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/docker_rdma_sriov/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
)

const (
appVersion = "0.0.5"
appVersion = "0.0.5-1"
)

var GitCommitId string

func getRightClientApiVersion() (string, error) {
// Start with the lowest API to query which version is supported.
lowestCli, err3 := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.12"))
lowestCli, err3 := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.24"))
if err3 != nil {
fmt.Println("Fail to create client: ", err3)
return "", err3
Expand Down
2 changes: 1 addition & 1 deletion src/docker_rdma_sriov/representor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/Mellanox/sriovnet"
"github.com/k8snetworkplumbingwg/sriovnet"
"github.com/vishvananda/netlink"
"strconv"
)
Expand Down
2 changes: 1 addition & 1 deletion src/docker_rdma_sriov/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/Mellanox/rdmamap"
"github.com/Mellanox/sriovnet"
"github.com/k8snetworkplumbingwg/sriovnet"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
"github.com/vishvananda/netlink"
Expand Down
2 changes: 1 addition & 1 deletion src/docker_rdma_sriov/sriov.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/Mellanox/rdmamap"
"github.com/Mellanox/sriovnet"
"github.com/k8snetworkplumbingwg/sriovnet"
"github.com/spf13/cobra"
"github.com/vishvananda/netlink"
"github.com/vishvananda/netns"
Expand Down
4 changes: 2 additions & 2 deletions src/docker_rdma_sriov/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/Mellanox/rdmamap"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/spf13/cobra"
"os"
)
Expand All @@ -14,7 +14,7 @@ func DumpAllContainersRdmaStats() {
if err != nil {
return
}
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
containers, err := cli.ContainerList(context.Background(), container.ListOptions{})
if err != nil {
fmt.Println("Fail to get container list", err)
return
Expand Down
2 changes: 1 addition & 1 deletion src/docker_rdma_sriov/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/Mellanox/sriovnet"
"github.com/k8snetworkplumbingwg/sriovnet"
"os"
"path/filepath"
"strings"
Expand Down
10 changes: 10 additions & 0 deletions src/k8sdo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module k8sdo

go 1.22.2

require github.com/spf13/cobra v1.8.0

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
10 changes: 10 additions & 0 deletions src/k8sdo/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=