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 dependencies and golang version #36

Merged
merged 1 commit into from
Mar 19, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.21.x]
goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Lint
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Check GRPC
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Run tests
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
# if this fails, run go mod tidy
- name: Check if module files are consistent with code
run: go mod tidy && git diff --exit-code
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Generate coverage report
run: make cov-report
- name: Upload to Coveralls
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the image
FROM golang:1.20 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
15 changes: 8 additions & 7 deletions api/v1alpha1/ippool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logPkg "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

var logger = logPkg.Log.WithName("IPPool-validator")
Expand All @@ -32,29 +33,29 @@ func (r *IPPool) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &IPPool{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *IPPool) ValidateCreate() error {
func (r *IPPool) ValidateCreate() (admission.Warnings, error) {
logger.V(1).Info("validate create", "name", r.Name)
return r.validate()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *IPPool) ValidateUpdate(_ runtime.Object) error {
func (r *IPPool) ValidateUpdate(_ runtime.Object) (admission.Warnings, error) {
logger.V(1).Info("validate update", "name", r.Name)
return r.validate()
}

func (r *IPPool) validate() error {
func (r *IPPool) validate() (admission.Warnings, error) {
errList := r.Validate()
if len(errList) == 0 {
logger.V(1).Info("validation succeed")
return nil
return nil, nil
}
err := errList.ToAggregate()
logger.V(1).Info("validation failed", "reason", err.Error())
return err
return nil, err
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *IPPool) ValidateDelete() error {
return nil
func (r *IPPool) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
7 changes: 4 additions & 3 deletions cmd/ipam-controller/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import (
"k8s.io/component-base/term"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/healthz"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

// register json format for logger
_ "k8s.io/component-base/logs/json/register"
Expand Down Expand Up @@ -113,14 +115,13 @@ func RunController(ctx context.Context, config *rest.Config, opts *options.Optio

mgr, err := ctrl.NewManager(config, ctrl.Options{
Scheme: scheme,
Namespace: opts.IPPoolsNamespace,
MetricsBindAddress: opts.MetricsAddr,
Port: 9443,
Metrics: metricsserver.Options{BindAddress: opts.MetricsAddr},
HealthProbeBindAddress: opts.ProbeAddr,
LeaderElection: opts.EnableLeaderElection,
LeaderElectionNamespace: opts.LeaderElectionNamespace,
LeaderElectionID: "dd1643cf.nvidia.com",
LeaderElectionReleaseOnCancel: true,
Cache: cache.Options{DefaultNamespaces: map[string]cache.Config{opts.IPPoolsNamespace: {}}},
})

if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions cmd/ipam-node/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ import (
"k8s.io/component-base/term"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/healthz"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

// register json format for logger
_ "k8s.io/component-base/logs/json/register"
Expand Down Expand Up @@ -137,10 +139,9 @@ func RunNodeDaemon(ctx context.Context, config *rest.Config, opts *options.Optio

mgr, err := ctrl.NewManager(config, ctrl.Options{
Scheme: scheme,
Namespace: opts.PoolsNamespace,
MetricsBindAddress: opts.MetricsAddr,
Port: 9443,
Metrics: metricsserver.Options{BindAddress: opts.MetricsAddr},
HealthProbeBindAddress: opts.ProbeAddr,
Cache: cache.Options{DefaultNamespaces: map[string]cache.Config{opts.PoolsNamespace: {}}},
})
if err != nil {
logger.Error(err, "unable to initialize manager")
Expand Down
111 changes: 55 additions & 56 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,89 +1,88 @@
module github.com/Mellanox/nvidia-k8s-ipam

go 1.20
go 1.21

require (
github.com/containernetworking/cni v1.1.2
github.com/go-logr/logr v1.2.4
github.com/go-logr/logr v1.4.1
github.com/gofrs/flock v0.8.1
github.com/google/renameio/v2 v2.0.0
github.com/google/uuid v1.3.0
github.com/k8snetworkplumbingwg/cni-log v0.0.0-20230321145726-634c593dd11f
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.6
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.3
google.golang.org/grpc v1.56.2
google.golang.org/protobuf v1.31.0
k8s.io/api v0.26.4
k8s.io/apimachinery v0.26.4
k8s.io/client-go v0.26.4
k8s.io/component-base v0.26.4
k8s.io/component-helpers v0.26.4
k8s.io/klog/v2 v2.90.1
sigs.k8s.io/controller-runtime v0.14.6
github.com/google/uuid v1.6.0
github.com/k8snetworkplumbingwg/cni-log v0.0.0-20230801160229-b6e062c9e0f2
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/component-base v0.29.3
k8s.io/component-helpers v0.29.3
k8s.io/klog/v2 v2.120.1
sigs.k8s.io/controller-runtime v0.17.2
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230323073829-e72429f035bd // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/moby/term v0.5.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/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/kube-openapi v0.0.0-20230308215209-15aac26d736a // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
k8s.io/apiextensions-apiserver v0.29.3 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading
Loading