Skip to content

Commit

Permalink
Merge pull request redpanda-data#7518 from r-vasquez/fix-segfault-old…
Browse files Browse the repository at this point in the history
…-nodes

rpk: add nil check for maintenance mode
  • Loading branch information
r-vasquez committed Nov 25, 2022
2 parents 4d75446 + 20cb9e8 commit 29c753e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/go/rpk/pkg/cli/cmd/redpanda/admin/brokers/brokers.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ leader handles the request.
b, err := cl.Broker(cmd.Context(), broker)
out.MaybeDie(err, "unable to initialize admin client: %v", err)

if b.Maintenance.Draining {
// Old brokers (< v22.1) don't have maintenance mode, so we must
// check if b.Maintenance is not nil.
if b.Maintenance != nil && b.Maintenance.Draining {
out.Die(`Node cannot be decommissioned while it is in maintenance mode.
Take the node out of maintenance mode first by running:
rpk cluster maintenance disable %v`, broker)
Expand Down

0 comments on commit 29c753e

Please sign in to comment.