Skip to content

Commit 169b65d

Browse files
committed
Bump dependencies and fix deprecated API usage
Bump Go module dependencies (from PR k8snetworkplumbingwg#1027): - github.com/jaypipes/ghw v0.21.2 -> v0.22.0 - github.com/onsi/ginkgo/v2 v2.27.3 -> v2.28.1 - github.com/onsi/gomega v1.38.3 -> v1.39.0 - github.com/coreos/go-systemd/v22 v22.6.0 -> v22.7.0 - github.com/google/renameio/v2 v2.0.1 -> v2.0.2 - github.com/prometheus-operator/prometheus-operator v0.87.1 -> v0.89.0 - sigs.k8s.io/controller-runtime v0.22.4 -> v0.23.1 - k8s.io/api, apimachinery, client-go, etc. v0.34.3 -> v0.35.0 - Various indirect dependency bumps (golang.org/x/*, etc.) Fix compilation and lint issues caused by the bumps: - openstack_test.go: ghw v0.22.0 changed ghw.Network function signature from func(opts ...*option.Option) to func(args ...any). Update the test mock and remove unused github.com/jaypipes/ghw/pkg/option import. - drain_controller*.go, main.go: controller-runtime v0.23.1 deprecated GetEventRecorderFor (old events API). Migrate to GetEventRecorder (new events API) and update recorder.Event() calls to recorder.Eventf() with the new events.EventRecorder interface signature. - service.go: go-systemd v22.7.0 deprecated unit.Deserialize. Replace with unit.DeserializeOptions (drop-in replacement). Signed-off-by: sriov-network-operator maintainers
1 parent 95362dc commit 169b65d

File tree

8 files changed

+103
-124
lines changed

8 files changed

+103
-124
lines changed

controllers/drain_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"k8s.io/apimachinery/pkg/api/errors"
2727
"k8s.io/apimachinery/pkg/runtime"
2828
"k8s.io/apimachinery/pkg/types"
29-
"k8s.io/client-go/tools/record"
29+
"k8s.io/client-go/tools/events"
3030
"k8s.io/client-go/util/workqueue"
3131
ctrl "sigs.k8s.io/controller-runtime"
3232
"sigs.k8s.io/controller-runtime/pkg/builder"
@@ -48,13 +48,13 @@ import (
4848
type DrainReconcile struct {
4949
client.Client
5050
Scheme *runtime.Scheme
51-
recorder record.EventRecorder
51+
recorder events.EventRecorder
5252
drainer drain.DrainInterface
5353

5454
drainCheckMutex sync.Mutex
5555
}
5656

57-
func NewDrainReconcileController(client client.Client, Scheme *runtime.Scheme, recorder record.EventRecorder, orchestrator orchestrator.Interface) (*DrainReconcile, error) {
57+
func NewDrainReconcileController(client client.Client, Scheme *runtime.Scheme, recorder events.EventRecorder, orchestrator orchestrator.Interface) (*DrainReconcile, error) {
5858
drainer, err := drain.NewDrainer(orchestrator)
5959
if err != nil {
6060
return nil, err

controllers/drain_controller_helper.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ func (dr *DrainReconcile) handleNodeIdleNodeStateDrainingOrCompleted(ctx context
2626
completed, err := dr.drainer.CompleteDrainNode(ctx, node)
2727
if err != nil {
2828
reqLogger.Error(err, "failed to complete drain on node")
29-
dr.recorder.Event(nodeNetworkState,
29+
dr.recorder.Eventf(nodeNetworkState, nil,
3030
corev1.EventTypeWarning,
3131
"DrainController",
32+
"CompleteDrain",
3233
"failed to drain node")
3334
return ctrl.Result{}, err
3435
}
3536

3637
// if we didn't manage to complete the un drain of the node we retry
3738
if !completed {
3839
reqLogger.Info("complete drain was not completed re queueing the request")
39-
dr.recorder.Event(nodeNetworkState,
40+
dr.recorder.Eventf(nodeNetworkState, nil,
4041
corev1.EventTypeWarning,
4142
"DrainController",
43+
"CompleteDrain",
4244
"node complete drain was not completed")
4345
// TODO: make this time configurable
4446
return reconcile.Result{RequeueAfter: constants.DrainControllerRequeueTime}, nil
@@ -52,9 +54,10 @@ func (dr *DrainReconcile) handleNodeIdleNodeStateDrainingOrCompleted(ctx context
5254
}
5355

5456
reqLogger.Info("completed the un drain for node")
55-
dr.recorder.Event(nodeNetworkState,
57+
dr.recorder.Eventf(nodeNetworkState, nil,
5658
corev1.EventTypeWarning,
5759
"DrainController",
60+
"CompleteDrain",
5861
"node un drain completed")
5962
return ctrl.Result{}, nil
6063
}
@@ -105,19 +108,21 @@ func (dr *DrainReconcile) handleNodeDrainOrReboot(ctx context.Context,
105108
drained, err := dr.drainer.DrainNode(ctx, node, fullNodeDrain, singleNode)
106109
if err != nil {
107110
reqLogger.Error(err, "error trying to drain the node")
108-
dr.recorder.Event(nodeNetworkState,
111+
dr.recorder.Eventf(nodeNetworkState, nil,
109112
corev1.EventTypeWarning,
110113
"DrainController",
114+
"DrainNode",
111115
"failed to drain node")
112116
return reconcile.Result{}, err
113117
}
114118

115119
// if we didn't manage to complete the drain of the node we retry
116120
if !drained {
117121
reqLogger.Info("the nodes was not drained re queueing the request")
118-
dr.recorder.Event(nodeNetworkState,
122+
dr.recorder.Eventf(nodeNetworkState, nil,
119123
corev1.EventTypeWarning,
120124
"DrainController",
125+
"DrainNode",
121126
"node drain operation was not completed")
122127
return reconcile.Result{RequeueAfter: constants.DrainControllerRequeueTime}, nil
123128
}
@@ -130,9 +135,10 @@ func (dr *DrainReconcile) handleNodeDrainOrReboot(ctx context.Context,
130135
}
131136

132137
reqLogger.Info("node drained successfully")
133-
dr.recorder.Event(nodeNetworkState,
138+
dr.recorder.Eventf(nodeNetworkState, nil,
134139
corev1.EventTypeWarning,
135140
"DrainController",
141+
"DrainNode",
136142
"node drain completed")
137143
return ctrl.Result{}, nil
138144
}

controllers/drain_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var _ = Describe("Drain Controller", Ordered, func() {
5757

5858
drainController, err := NewDrainReconcileController(drainKClient,
5959
k8sManager.GetScheme(),
60-
k8sManager.GetEventRecorderFor("operator"),
60+
k8sManager.GetEventRecorder("operator"),
6161
orchestrator)
6262
Expect(err).ToNot(HaveOccurred())
6363
err = drainController.SetupWithManager(k8sManager)

go.mod

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ require (
77
github.com/blang/semver v3.5.1+incompatible
88
github.com/cenkalti/backoff v2.2.1+incompatible
99
github.com/coreos/fcct v0.5.0
10-
github.com/coreos/go-systemd/v22 v22.6.0
10+
github.com/coreos/go-systemd/v22 v22.7.0
1111
github.com/coreos/ignition/v2 v2.25.1
1212
github.com/fsnotify/fsnotify v1.9.0
1313
github.com/go-logr/logr v1.4.3
1414
github.com/go-logr/stdr v1.2.2
1515
github.com/google/go-cmp v0.7.0
16-
github.com/google/renameio/v2 v2.0.1
16+
github.com/google/renameio/v2 v2.0.2
1717
github.com/google/uuid v1.6.0
1818
github.com/hashicorp/go-retryablehttp v0.7.8
19-
github.com/jaypipes/ghw v0.21.2
19+
github.com/jaypipes/ghw v0.22.0
2020
github.com/jaypipes/pcidb v1.1.1
2121
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.7.7
2222
github.com/k8snetworkplumbingwg/sriov-network-device-plugin v0.0.0-20221127172732-a5a7395122e3
2323
github.com/k8snetworkplumbingwg/sriovnet v1.2.0
24-
github.com/onsi/ginkgo/v2 v2.27.3
25-
github.com/onsi/gomega v1.38.3
24+
github.com/onsi/ginkgo/v2 v2.28.1
25+
github.com/onsi/gomega v1.39.0
2626
github.com/openshift-kni/k8sreporter v1.0.7
2727
github.com/openshift/api v0.0.0-20251202143230-02f6733e651c
2828
github.com/openshift/client-go v0.0.0-20251202151200-fb4471581cf8
2929
github.com/ovn-kubernetes/libovsdb v0.8.1
3030
github.com/pkg/errors v0.9.1
31-
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.87.1
32-
github.com/prometheus-operator/prometheus-operator/pkg/client v0.87.1
31+
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.89.0
32+
github.com/prometheus-operator/prometheus-operator/pkg/client v0.89.0
3333
github.com/prometheus/client_model v0.6.2
3434
github.com/prometheus/common v0.67.5
3535
github.com/safchain/ethtool v0.7.0
@@ -41,15 +41,15 @@ require (
4141
go.uber.org/zap v1.27.1
4242
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
4343
gopkg.in/yaml.v3 v3.0.1
44-
k8s.io/api v0.34.3
45-
k8s.io/apiextensions-apiserver v0.34.3
46-
k8s.io/apimachinery v0.34.3
47-
k8s.io/client-go v0.34.3
48-
k8s.io/code-generator v0.34.3
44+
k8s.io/api v0.35.0
45+
k8s.io/apiextensions-apiserver v0.35.0
46+
k8s.io/apimachinery v0.35.0
47+
k8s.io/client-go v0.35.0
48+
k8s.io/code-generator v0.35.0
4949
k8s.io/klog/v2 v2.130.1
5050
k8s.io/kubectl v0.34.3
5151
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
52-
sigs.k8s.io/controller-runtime v0.22.4
52+
sigs.k8s.io/controller-runtime v0.23.1
5353
sigs.k8s.io/yaml v1.6.0
5454
)
5555

@@ -99,11 +99,10 @@ require (
9999
github.com/go-playground/universal-translator v0.18.1 // indirect
100100
github.com/go-playground/validator/v10 v10.26.0 // indirect
101101
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
102-
github.com/gogo/protobuf v1.3.2 // indirect
103102
github.com/golang/glog v1.2.5 // indirect
104103
github.com/google/btree v1.1.3 // indirect
105104
github.com/google/gnostic-models v0.7.0 // indirect
106-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
105+
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
107106
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
108107
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
109108
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -128,9 +127,9 @@ require (
128127
github.com/nxadm/tail v1.4.11 // indirect
129128
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
130129
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
131-
github.com/prometheus/client_golang v1.22.0 // indirect
132-
github.com/prometheus/procfs v0.15.1 // indirect
133-
github.com/rogpeppe/go-internal v1.13.1 // indirect
130+
github.com/prometheus/client_golang v1.23.2 // indirect
131+
github.com/prometheus/procfs v0.16.1 // indirect
132+
github.com/rogpeppe/go-internal v1.14.1 // indirect
134133
github.com/russross/blackfriday/v2 v2.1.0 // indirect
135134
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
136135
github.com/shopspring/decimal v1.4.0 // indirect
@@ -145,17 +144,16 @@ require (
145144
go.uber.org/multierr v1.11.0 // indirect
146145
go.yaml.in/yaml/v2 v2.4.3 // indirect
147146
go.yaml.in/yaml/v3 v3.0.4 // indirect
148-
golang.org/x/crypto v0.46.0 // indirect
149-
golang.org/x/mod v0.30.0 // indirect
150-
golang.org/x/net v0.48.0 // indirect
147+
golang.org/x/crypto v0.47.0 // indirect
148+
golang.org/x/mod v0.32.0 // indirect
149+
golang.org/x/net v0.49.0 // indirect
151150
golang.org/x/oauth2 v0.34.0 // indirect
152151
golang.org/x/sync v0.19.0 // indirect
153-
golang.org/x/sys v0.39.0 // indirect
154-
golang.org/x/term v0.38.0 // indirect
155-
golang.org/x/text v0.32.0 // indirect
152+
golang.org/x/sys v0.40.0 // indirect
153+
golang.org/x/term v0.39.0 // indirect
154+
golang.org/x/text v0.33.0 // indirect
156155
golang.org/x/time v0.14.0 // indirect
157-
golang.org/x/tools v0.39.0 // indirect
158-
golang.org/x/tools/go/expect v0.1.1-deprecated // indirect
156+
golang.org/x/tools v0.41.0 // indirect
159157
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
160158
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect
161159
google.golang.org/grpc v1.77.0 // indirect
@@ -164,13 +162,13 @@ require (
164162
gopkg.in/inf.v0 v0.9.1 // indirect
165163
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9 // indirect
166164
k8s.io/cli-runtime v0.34.3 // indirect
167-
k8s.io/component-base v0.34.3 // indirect
168-
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
165+
k8s.io/component-base v0.35.0 // indirect
166+
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect
169167
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
170168
k8s.io/kubelet v0.34.1 // indirect
171169
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
172170
sigs.k8s.io/kustomize/api v0.20.1 // indirect
173171
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
174172
sigs.k8s.io/randfill v1.0.0 // indirect
175-
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
173+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
176174
)

0 commit comments

Comments
 (0)