Skip to content

Commit 812c762

Browse files
author
Joshua Reed
committed
Randomly pick worker zones.
1 parent e74e151 commit 812c762

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

controllers/cloudstackmachine_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controllers
1919
import (
2020
"context"
2121
"fmt"
22+
"math/rand"
2223
"reflect"
2324
"time"
2425

@@ -172,6 +173,9 @@ func (r *CloudStackMachineReconciler) reconcile(
172173
zones[zidx] = zoneID
173174
zidx++
174175
}
176+
rand.Seed(time.Now().Unix())
177+
randNum := (rand.Int() % len(csCluster.Spec.Zones))
178+
csMachine.Status.ZoneID = zones[randNum]
175179
}
176180

177181
secret := &corev1.Secret{}

0 commit comments

Comments
 (0)