diff --git a/controllers/nova_controller.go b/controllers/nova_controller.go index 575e378d3..a2ce1aa55 100644 --- a/controllers/nova_controller.go +++ b/controllers/nova_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" "fmt" + "sort" "strings" batchv1 "k8s.io/api/batch/v1" @@ -309,12 +310,16 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul // iteration order is undefined we need to make sure that cell0 is the // first to allow dependency handling during ensureCell calls. orderedCellNames := []string{novav1.Cell0Name} + sortedCellNames := []string{} for cellName := range instance.Spec.CellTemplates { if cellName != novav1.Cell0Name { - orderedCellNames = append(orderedCellNames, cellName) + sortedCellNames = append(sortedCellNames, cellName) } } + sort.Strings(sortedCellNames) + orderedCellNames = append(orderedCellNames, sortedCellNames...) + // Create the Cell DBs. Note that we are not returning on error or if the // DB creation is still in progress. We move forward with whatever we can // and relay on the watch to get reconciled if some of the resources change