Skip to content

Commit

Permalink
v2: refactor managed decommission
Browse files Browse the repository at this point in the history
Prior to this commit the managed decommission controller was utilizing patterns
akin to the node watcher and decommission controller for connecting to the
admin API. This made it difficult to test via the `RedpandaControllerSuite`
test which was desirable due to the flakey nature (especially when considering
a later commit) of it's corresponding kuttl based test.

This commit refactors the manged decommission controller to leverage the
`ClientFactory` struct used in the redpanda controller which makes it possible
to test in the faster and more easily debuggable `RedpandaControllerSuite`.
  • Loading branch information
chrisseto committed Nov 8, 2024
1 parent 0be37df commit 7c8d7be
Show file tree
Hide file tree
Showing 21 changed files with 285 additions and 400 deletions.
4 changes: 2 additions & 2 deletions acceptance/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.22.7
require (
github.com/cucumber/godog v0.14.1
github.com/go-logr/logr v1.4.2
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70
github.com/redpanda-data/common-go/rpadmin v0.1.9
github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a
github.com/redpanda-data/redpanda-operator/harpoon v0.0.0-00010101000000-000000000000
github.com/redpanda-data/redpanda-operator/operator v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.9.0
Expand Down
6 changes: 2 additions & 4 deletions acceptance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,10 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redpanda-data/common-go/net v0.1.0 h1:JnJioRJuL961r1QXiJQ1tW9+yEaJfu8FpXnUmvQbwNM=
github.com/redpanda-data/common-go/net v0.1.0/go.mod h1:iOdNkjxM7a1T8F3cYHTaKIPFCHzzp/ia6TN+Z+7Tt5w=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b h1:0rC71VXYEjo/5f9pE5oiwRVxUejkIxRrrxwpKferA/s=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.9 h1:X5a95P7Dc+7EaidU7dusWJyiG3eJmk4zJtUttfvhmc4=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20 h1:+zsE3W1V86k2sjAGWOySIlF0xn5R1aXXQBaIdr80F48=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20/go.mod h1:DC42/3+k5PefSo4IalYbDN3yRZrVFP0b69+gC/NwGd4=
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70 h1:zp9erNYgwkQK7YZOE/dluuuYrdrsNDXM1KXR48k0SLg=
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70/go.mod h1:dmmGZo7DuHNnCy0QOykXN2sY9QI8kbdlkSKgIkCT978=
github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a h1:QrCC2sX/A0ffiJEUJmZhDS8/NWJI4rbcbtCC+NQOGZY=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240827155712-244863ea0ae8 h1:uTQKqF8UPNxYxKBJ11VlG6Vt2l9ctkkeXsmmjHUSUG4=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240827155712-244863ea0ae8/go.mod h1:97qkjcMI3gDL+y+aY/w5o0xF2qGHFof6rCXIYjnTalM=
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
Expand Down
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1802,9 +1802,11 @@ github.com/redpanda-data/common-go/net v0.1.1-0.20240429123545-4da3d2b371f7 h1:M
github.com/redpanda-data/common-go/rpadmin v0.1.3/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.4/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.5-0.20240814205445-8e6eb5806561/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/helm-charts v0.0.0-20240911060052-2bf9dd6f0996/go.mod h1:uEMmuH+gTppAsZZNYlUbh6tuxN3fqffWY0Bi8AcE2Zk=
github.com/redpanda-data/helm-charts v0.0.0-20240916201426-9ca3b128bb8e/go.mod h1:uEMmuH+gTppAsZZNYlUbh6tuxN3fqffWY0Bi8AcE2Zk=
github.com/redpanda-data/helm-charts v0.0.0-20241025092026-69353dfce9a1/go.mod h1:dmmGZo7DuHNnCy0QOykXN2sY9QI8kbdlkSKgIkCT978=
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70/go.mod h1:dmmGZo7DuHNnCy0QOykXN2sY9QI8kbdlkSKgIkCT978=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240105044330-c094966ca0cf/go.mod h1:SaSp5/JwdLHu8ZU82wFbXD8/oE4UWB+8ZkjWWreAt7Y=
github.com/rhnvrm/simples3 v0.6.1 h1:H0DJwybR6ryQE+Odi9eqkHuzjYAeJgtGcGtuBwOhsH8=
github.com/rickb777/period v1.0.6 h1:f4TcHBtL/4qa4D44eqgxs7785/kfLKUjRI7XYI2HCvk=
Expand Down
2 changes: 1 addition & 1 deletion harpoon/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/cucumber/godog v0.14.1
github.com/cucumber/messages/go/v21 v21.0.1
github.com/olekukonko/tablewriter v0.0.5
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70
github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e
k8s.io/api v0.30.3
Expand Down
2 changes: 1 addition & 1 deletion harpoon/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redpanda-data/helm-charts v0.0.0-20241030170802-ad1edfc56b70 h1:zp9erNYgwkQK7YZOE/dluuuYrdrsNDXM1KXR48k0SLg=
github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a h1:QrCC2sX/A0ffiJEUJmZhDS8/NWJI4rbcbtCC+NQOGZY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
Expand Down
1 change: 1 addition & 0 deletions operator/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ func Run(
if err = (&redpandacontrollers.ManagedDecommissionReconciler{
Client: mgr.GetClient(),
EventRecorder: mgr.GetEventRecorderFor("ManagedDecommissionReconciler"),
ClientFactory: internalclient.NewFactory(mgr.GetConfig(), mgr.GetClient()),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ManagedDecommission")
return err
Expand Down
2 changes: 1 addition & 1 deletion operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.74.0
github.com/prometheus/client_golang v1.20.0
github.com/prometheus/common v0.55.0
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b
github.com/redpanda-data/common-go/rpadmin v0.1.9
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20
github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240827155712-244863ea0ae8
Expand Down
4 changes: 2 additions & 2 deletions operator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redpanda-data/common-go/net v0.1.0 h1:JnJioRJuL961r1QXiJQ1tW9+yEaJfu8FpXnUmvQbwNM=
github.com/redpanda-data/common-go/net v0.1.0/go.mod h1:iOdNkjxM7a1T8F3cYHTaKIPFCHzzp/ia6TN+Z+7Tt5w=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b h1:0rC71VXYEjo/5f9pE5oiwRVxUejkIxRrrxwpKferA/s=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240916201938-8d748d9ac10b/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.9 h1:X5a95P7Dc+7EaidU7dusWJyiG3eJmk4zJtUttfvhmc4=
github.com/redpanda-data/common-go/rpadmin v0.1.9/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20 h1:+zsE3W1V86k2sjAGWOySIlF0xn5R1aXXQBaIdr80F48=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20/go.mod h1:DC42/3+k5PefSo4IalYbDN3yRZrVFP0b69+gC/NwGd4=
github.com/redpanda-data/flux-controller-shim/helm/shim v0.0.0-20231227162419-a45126310240 h1:rSfpkaQSBkz3uqEMN1ftVEXBMyx0uibyXPHGCp1kRy8=
Expand Down
Loading

0 comments on commit 7c8d7be

Please sign in to comment.