From 290b3a17b7614469e273b59c8d6982f76270e0fc Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 3 Jun 2024 12:44:23 -0600 Subject: [PATCH] Fix out of bound Signed-off-by: Florent Poinsard --- .../vitessbackupschedule/vitessbackupschedule_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/vitessbackupschedule/vitessbackupschedule_controller.go b/pkg/controller/vitessbackupschedule/vitessbackupschedule_controller.go index 8db92664..4ce56b21 100644 --- a/pkg/controller/vitessbackupschedule/vitessbackupschedule_controller.go +++ b/pkg/controller/vitessbackupschedule/vitessbackupschedule_controller.go @@ -552,7 +552,7 @@ func (r *ReconcileVitessBackupsSchedule) getVtctldServiceName(ctx context.Contex } if len(svcList.Items) > 0 { - service := svcList.Items[rand.IntN(len(svcList.Items)-1)] + service := svcList.Items[rand.IntN(len(svcList.Items))] svcName = service.Name for _, port := range service.Spec.Ports { if port.Name == planetscalev2.DefaultGrpcPortName {