Skip to content

Commit ee0da64

Browse files
committed
updated controller version and litter refactoring
Signed-off-by: Viktor Kramarenko <[email protected]>
1 parent ee3239a commit ee0da64

File tree

10 files changed

+216
-269
lines changed

10 files changed

+216
-269
lines changed

images/agent/src/go.mod

+31-30
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,67 @@ go 1.22.2
44

55
require (
66
github.com/deckhouse/sds-node-configurator/api v0.0.0-20240805103635-969dc811217b
7-
github.com/go-logr/logr v1.4.1
7+
github.com/go-logr/logr v1.4.2
88
github.com/google/go-cmp v0.6.0
9-
github.com/onsi/ginkgo/v2 v2.17.1
10-
github.com/onsi/gomega v1.32.0
9+
github.com/onsi/ginkgo/v2 v2.19.0
10+
github.com/onsi/gomega v1.33.1
1111
github.com/pilebones/go-udev v0.9.0
12-
github.com/prometheus/client_golang v1.18.0
13-
github.com/stretchr/testify v1.8.4
14-
k8s.io/api v0.30.2
15-
k8s.io/apiextensions-apiserver v0.30.1
16-
k8s.io/apimachinery v0.30.2
17-
k8s.io/client-go v0.30.1
18-
k8s.io/klog/v2 v2.120.1
19-
k8s.io/utils v0.0.0-20231127182322-b307cd553661
20-
sigs.k8s.io/controller-runtime v0.18.4
12+
github.com/prometheus/client_golang v1.19.1
13+
github.com/stretchr/testify v1.9.0
14+
k8s.io/api v0.31.0
15+
k8s.io/apiextensions-apiserver v0.31.0
16+
k8s.io/apimachinery v0.31.0
17+
k8s.io/client-go v0.31.0
18+
k8s.io/klog/v2 v2.130.1
19+
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
20+
sigs.k8s.io/controller-runtime v0.19.0
2121
)
2222

2323
require (
2424
github.com/beorn7/perks v1.0.1 // indirect
25-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
26-
github.com/davecgh/go-spew v1.1.1 // indirect
25+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
26+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2727
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
2828
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
2929
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
3030
github.com/fsnotify/fsnotify v1.7.0 // indirect
31+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
3132
github.com/go-openapi/jsonpointer v0.20.0 // indirect
3233
github.com/go-openapi/jsonreference v0.20.2 // indirect
3334
github.com/go-openapi/swag v0.22.4 // indirect
34-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
35+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3536
github.com/gogo/protobuf v1.3.2 // indirect
3637
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3738
github.com/golang/protobuf v1.5.4 // indirect
3839
github.com/google/gnostic-models v0.6.8 // indirect
3940
github.com/google/gofuzz v1.2.0 // indirect
40-
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
41-
github.com/google/uuid v1.4.0 // indirect
41+
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect
42+
github.com/google/uuid v1.6.0 // indirect
4243
github.com/imdario/mergo v0.3.16 // indirect
4344
github.com/josharian/intern v1.0.0 // indirect
4445
github.com/json-iterator/go v1.1.12 // indirect
4546
github.com/mailru/easyjson v0.7.7 // indirect
46-
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
4747
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4848
github.com/modern-go/reflect2 v1.0.2 // indirect
4949
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5050
github.com/pkg/errors v0.9.1 // indirect
51-
github.com/pmezard/go-difflib v1.0.0 // indirect
52-
github.com/prometheus/client_model v0.5.0 // indirect
53-
github.com/prometheus/common v0.45.0 // indirect
54-
github.com/prometheus/procfs v0.12.0 // indirect
51+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
52+
github.com/prometheus/client_model v0.6.1 // indirect
53+
github.com/prometheus/common v0.55.0 // indirect
54+
github.com/prometheus/procfs v0.15.1 // indirect
5555
github.com/spf13/pflag v1.0.5 // indirect
56+
github.com/x448/float16 v0.8.4 // indirect
5657
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
57-
golang.org/x/net v0.23.0 // indirect
58-
golang.org/x/oauth2 v0.15.0 // indirect
59-
golang.org/x/sys v0.18.0 // indirect
60-
golang.org/x/term v0.18.0 // indirect
61-
golang.org/x/text v0.14.0 // indirect
58+
golang.org/x/net v0.26.0 // indirect
59+
golang.org/x/oauth2 v0.21.0 // indirect
60+
golang.org/x/sys v0.21.0 // indirect
61+
golang.org/x/term v0.21.0 // indirect
62+
golang.org/x/text v0.16.0 // indirect
6263
golang.org/x/time v0.5.0 // indirect
63-
golang.org/x/tools v0.18.0 // indirect
64+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
6465
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
65-
google.golang.org/appengine v1.6.8 // indirect
66-
google.golang.org/protobuf v1.33.0 // indirect
66+
google.golang.org/protobuf v1.34.2 // indirect
67+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
6768
gopkg.in/inf.v0 v0.9.1 // indirect
6869
gopkg.in/yaml.v2 v2.4.0 // indirect
6970
gopkg.in/yaml.v3 v3.0.1 // indirect

images/agent/src/go.sum

+64-86
Large diffs are not rendered by default.

images/agent/src/pkg/controller/lvm_logical_volume_extender_watcher.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ func RunLVMLogicalVolumeExtenderWatcherController(
8080
return err
8181
}
8282

83-
err = c.Watch(source.Kind(mgrCache, &v1alpha1.LvmVolumeGroup{}, handler.TypedFuncs[*v1alpha1.LvmVolumeGroup]{
84-
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.RateLimitingInterface) {
83+
err = c.Watch(source.Kind(mgrCache, &v1alpha1.LvmVolumeGroup{}, handler.TypedFuncs[*v1alpha1.LvmVolumeGroup, reconcile.Request]{
84+
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
8585
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeExtenderWatcherController] got a Create event for the LVMVolumeGroup %s", e.Object.GetName()))
8686
request := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: e.Object.GetNamespace(), Name: e.Object.GetName()}}
8787
q.Add(request)
8888
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeExtenderWatcherController] added the LVMVolumeGroup %s to the Reconcilers queue", e.Object.GetName()))
8989
},
90-
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.RateLimitingInterface) {
90+
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
9191
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeExtenderWatcherController] got an Update event for the LVMVolumeGroup %s", e.ObjectNew.GetName()))
9292
request := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: e.ObjectNew.GetNamespace(), Name: e.ObjectNew.GetName()}}
9393
q.Add(request)

images/agent/src/pkg/controller/lvm_logical_volume_watcher.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ func RunLVMLogicalVolumeWatcherController(
156156
return nil, err
157157
}
158158

159-
err = c.Watch(source.Kind(mgr.GetCache(), &v1alpha1.LVMLogicalVolume{}, handler.TypedFuncs[*v1alpha1.LVMLogicalVolume]{
160-
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LVMLogicalVolume], q workqueue.RateLimitingInterface) {
159+
err = c.Watch(source.Kind(mgr.GetCache(), &v1alpha1.LVMLogicalVolume{}, handler.TypedFuncs[*v1alpha1.LVMLogicalVolume, reconcile.Request]{
160+
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LVMLogicalVolume], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
161161
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeWatcherController] got a create event for the LVMLogicalVolume: %s", e.Object.GetName()))
162162
request := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: e.Object.GetNamespace(), Name: e.Object.GetName()}}
163163
q.Add(request)
164164
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeWatcherController] added the request of the LVMLogicalVolume %s to Reconciler", e.Object.GetName()))
165165
},
166166

167-
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LVMLogicalVolume], q workqueue.RateLimitingInterface) {
167+
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LVMLogicalVolume], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
168168
log.Info(fmt.Sprintf("[RunLVMLogicalVolumeWatcherController] got an update event for the LVMLogicalVolume: %s", e.ObjectNew.GetName()))
169169
// TODO: Figure out how to log it in our logger.
170170
if cfg.Loglevel == "4" {

images/agent/src/pkg/controller/lvm_volume_group_watcher.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,16 @@ func RunLVMVolumeGroupWatcherController(
191191
return nil, err
192192
}
193193

194-
err = c.Watch(source.Kind(mgrCache, &v1alpha1.LvmVolumeGroup{}, handler.TypedFuncs[*v1alpha1.LvmVolumeGroup]{
195-
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.RateLimitingInterface) {
194+
err = c.Watch(source.Kind(mgrCache, &v1alpha1.LvmVolumeGroup{}, handler.TypedFuncs[*v1alpha1.LvmVolumeGroup, reconcile.Request]{
195+
CreateFunc: func(_ context.Context, e event.TypedCreateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
196196
log.Info(fmt.Sprintf("[RunLVMVolumeGroupWatcherController] createFunc got a create event for the LVMVolumeGroup, name: %s", e.Object.GetName()))
197197

198198
request := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: e.Object.GetNamespace(), Name: e.Object.GetName()}}
199199
q.Add(request)
200200

201201
log.Info(fmt.Sprintf("[RunLVMVolumeGroupWatcherController] createFunc added a request for the LVMVolumeGroup %s to the Reconcilers queue", e.Object.GetName()))
202202
},
203-
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.RateLimitingInterface) {
203+
UpdateFunc: func(_ context.Context, e event.TypedUpdateEvent[*v1alpha1.LvmVolumeGroup], q workqueue.TypedRateLimitingInterface[reconcile.Request]) {
204204
log.Info(fmt.Sprintf("[RunLVMVolumeGroupWatcherController] UpdateFunc got a update event for the LVMVolumeGroup %s", e.ObjectNew.GetName()))
205205
if !shouldLVGWatcherReconcileUpdateEvent(log, e.ObjectOld, e.ObjectNew) {
206206
log.Info(fmt.Sprintf("[RunLVMVolumeGroupWatcherController] update event for the LVMVolumeGroup %s should not be reconciled as not target changed were made", e.ObjectNew.Name))

images/sds-health-watcher-controller/src/go.mod

+24-24
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ require (
66
github.com/cloudflare/cfssl v1.5.0
77
github.com/deckhouse/deckhouse v1.62.4
88
github.com/deckhouse/sds-node-configurator/api v0.0.0-20240805103635-969dc811217b
9-
github.com/go-logr/logr v1.4.1
10-
github.com/prometheus/client_golang v1.19.0
9+
github.com/go-logr/logr v1.4.2
10+
github.com/prometheus/client_golang v1.19.1
1111
github.com/stretchr/testify v1.9.0
1212
gopkg.in/yaml.v3 v3.0.1
13-
k8s.io/api v0.30.1
14-
k8s.io/apiextensions-apiserver v0.29.4
15-
k8s.io/apimachinery v0.30.2
16-
k8s.io/client-go v0.29.4
17-
k8s.io/klog/v2 v2.120.1
18-
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
19-
sigs.k8s.io/controller-runtime v0.17.3
13+
k8s.io/api v0.31.0
14+
k8s.io/apiextensions-apiserver v0.31.0
15+
k8s.io/apimachinery v0.31.0
16+
k8s.io/client-go v0.31.0
17+
k8s.io/klog/v2 v2.130.1
18+
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
19+
sigs.k8s.io/controller-runtime v0.19.0
2020
)
2121

2222
require (
2323
github.com/Masterminds/semver/v3 v3.2.1 // indirect
2424
github.com/beorn7/perks v1.0.1 // indirect
25-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
26-
github.com/davecgh/go-spew v1.1.1 // indirect
25+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
26+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2727
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
28-
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
2928
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
3029
github.com/fsnotify/fsnotify v1.7.0 // indirect
30+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
3131
github.com/go-openapi/jsonpointer v0.19.6 // indirect
3232
github.com/go-openapi/jsonreference v0.20.2 // indirect
3333
github.com/go-openapi/swag v0.22.5 // indirect
@@ -46,24 +46,24 @@ require (
4646
github.com/modern-go/reflect2 v1.0.2 // indirect
4747
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4848
github.com/pkg/errors v0.9.1 // indirect
49-
github.com/pmezard/go-difflib v1.0.0 // indirect
50-
github.com/prometheus/client_model v0.5.0 // indirect
51-
github.com/prometheus/common v0.48.0 // indirect
52-
github.com/prometheus/procfs v0.12.0 // indirect
49+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
50+
github.com/prometheus/client_model v0.6.1 // indirect
51+
github.com/prometheus/common v0.55.0 // indirect
52+
github.com/prometheus/procfs v0.15.1 // indirect
5353
github.com/spf13/pflag v1.0.5 // indirect
54+
github.com/x448/float16 v0.8.4 // indirect
5455
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
55-
golang.org/x/net v0.23.0 // indirect
56-
golang.org/x/oauth2 v0.17.0 // indirect
57-
golang.org/x/sys v0.19.0 // indirect
58-
golang.org/x/term v0.19.0 // indirect
59-
golang.org/x/text v0.14.0 // indirect
56+
golang.org/x/net v0.26.0 // indirect
57+
golang.org/x/oauth2 v0.21.0 // indirect
58+
golang.org/x/sys v0.21.0 // indirect
59+
golang.org/x/term v0.21.0 // indirect
60+
golang.org/x/text v0.16.0 // indirect
6061
golang.org/x/time v0.5.0 // indirect
6162
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
62-
google.golang.org/appengine v1.6.8 // indirect
63-
google.golang.org/protobuf v1.33.0 // indirect
63+
google.golang.org/protobuf v1.34.2 // indirect
64+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
6465
gopkg.in/inf.v0 v0.9.1 // indirect
6566
gopkg.in/yaml.v2 v2.4.0 // indirect
66-
k8s.io/component-base v0.29.4 // indirect
6767
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
6868
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
6969
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect

0 commit comments

Comments
 (0)