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

Bump golang 1.18 and k8s 1.24 #431

Merged
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 12 additions & 12 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ jobs:
name: build
strategy:
matrix:
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x]
go-version: [1.17.x, 1.18.x]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need to support 1.17.x?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's in the build verification (we only publish 1.18 built container images)

goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
- name: Set up Go matrix
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -30,9 +30,9 @@ jobs:
name: test
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.16.x
go-version: 1.18.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -49,9 +49,9 @@ jobs:
name: test-coverage
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.16.x
go-version: 1.18.x

- uses: actions/checkout@v2

Expand All @@ -72,15 +72,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.16.x
go-version: 1.18.x
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.37
version: v1.46.2

shellcheck:
name: Shellcheck
Expand Down Expand Up @@ -111,9 +111,9 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.16.x
go-version: 1.18.x

# if this fails, run go mod tidy
- name: Check if module files are consistent with code
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GOCOV = $(GOBIN)/gocov
GOCOVXML = $(GOBIN)/gocov-xml
GCOV2LCOV = $(GOBIN)/gcov2lcov
GO2XUNIT = $(GOBIN)/go2xunit
GOMOCKERY = $(GOBIN)/mockery
# Package info
BINARY_NAME=sriovdp
PACKAGE=sriov-network-device-plugin
Expand Down Expand Up @@ -90,6 +91,9 @@ $(GOCOVXML): | $(BASE) ; $(info building gocov-xml...)
$(GO2XUNIT): | $(BASE) ; $(info building go2xunit...)
$Q go install github.com/tebeka/go2xunit@latest

$(GOMOCKERY): | $(BASE) ; $(info building go2xunit...)
$Q go install github.com/vektra/mockery/v2@latest

TEST_TARGETS := test-default test-bench test-short test-verbose test-race
.PHONY: $(TEST_TARGETS) test-xml check test tests
test-bench: ARGS=-run=__absolutelynothing__ -bench=. ## Run benchmarks
Expand Down Expand Up @@ -151,6 +155,12 @@ clean: ; $(info Cleaning...) @ ## Cleanup everything
@rm -rf $(GOBIN)
@rm -rf test/

.PHONY: mockery
mockery: | $(BASE) $(GOMOCKERY) ; $(info Running mockery...) @ ## Run golint on all source files
# $Q cd $(BASE)/pkg/types && rm -rf mocks && $(GOMOCKERY) --all 2>/dev/null
$Q $(GOMOCKERY) --name=".*" --dir=pkg/types --output=pkg/types/mocks --recursive=false --log-level=debug
$Q $(GOMOCKERY) --name=".*" --dir=pkg/utils --output=pkg/utils/mocks --recursive=false --log-level=debug

.PHONY: help
help: ; @ ## Display this help message
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
Expand Down
4 changes: 2 additions & 2 deletions cmd/sriovdp/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/golang/glog"
"github.com/jaypipes/ghw"
Expand Down Expand Up @@ -70,7 +70,7 @@ func newResourceManager(cp *cliParams) *resourceManager {
// readConfig reads and validate configurations from Config file
func (rm *resourceManager) readConfig() error {
resources := &types.ResourceConfList{}
rawBytes, err := ioutil.ReadFile(rm.configFile)
rawBytes, err := os.ReadFile(rm.configFile)

if err != nil {
return fmt.Errorf("error reading file %s, %v", rm.configFile, err)
Expand Down
11 changes: 5 additions & 6 deletions cmd/sriovdp/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -65,7 +64,7 @@ var _ = Describe("Resource manager", func() {
if err != nil {
panic(err)
}
_ = ioutil.WriteFile("/tmp/sriovdp/test_config", []byte("junk"), 0644)
_ = os.WriteFile("/tmp/sriovdp/test_config", []byte("junk"), 0644)
})
AfterEach(func() {
err := os.RemoveAll("/tmp/sriovdp")
Expand All @@ -88,7 +87,7 @@ var _ = Describe("Resource manager", func() {
if testErr != nil {
panic(testErr)
}
testErr = ioutil.WriteFile("/tmp/sriovdp/test_config", []byte(`{
testErr = os.WriteFile("/tmp/sriovdp/test_config", []byte(`{
"resourceList": [{
"resourceName": "intel_sriov_netdevice",
"selectors": {
Expand Down Expand Up @@ -159,7 +158,7 @@ var _ = Describe("Resource manager", func() {
if err != nil {
panic(err)
}
err = ioutil.WriteFile("/tmp/sriovdp/test_config", []byte(`{
err = os.WriteFile("/tmp/sriovdp/test_config", []byte(`{
"resourceList": [{
"resourceName": "invalid-name",
"selectors": {
Expand All @@ -186,7 +185,7 @@ var _ = Describe("Resource manager", func() {
if err != nil {
panic(err)
}
err = ioutil.WriteFile("/tmp/sriovdp/test_config", []byte(`{
err = os.WriteFile("/tmp/sriovdp/test_config", []byte(`{
"resourceList": [{
"resourceName": "duplicate",
"selectors": {
Expand Down Expand Up @@ -220,7 +219,7 @@ var _ = Describe("Resource manager", func() {
if err != nil {
panic(err)
}
err = ioutil.WriteFile("/tmp/sriovdp/test_config", []byte(`{
err = os.WriteFile("/tmp/sriovdp/test_config", []byte(`{
"resourceList": [{
"resourceName": "wrong_config",
"selectors": {
Expand Down
69 changes: 61 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/k8snetworkplumbingwg/sriov-network-device-plugin

go 1.13
go 1.17
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why thre is 1.17 instead of 1.18?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is no 1.18 version in go.mod files yet


require (
github.com/Mellanox/rdmamap v1.0.0
Expand All @@ -10,17 +10,70 @@ require (
github.com/jaypipes/pcidb v0.5.0
github.com/k8snetworkplumbingwg/govdpa v0.1.3
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.1.1-0.20201119153432-9d213757d22d
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.1
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
google.golang.org/grpc v1.40.0
k8s.io/kubelet v0.24.0
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/containernetworking/cni v0.7.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.10.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // 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/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mitchellh/go-homedir v1.0.0 // 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/nxadm/tail v1.4.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.4.1 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/grpc v1.28.1
k8s.io/kubelet v0.18.1
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
k8s.io/api v0.24.0 // indirect
k8s.io/apimachinery v0.24.0 // indirect
k8s.io/client-go v0.24.0 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace (
Expand Down
Loading