Skip to content

Commit

Permalink
add: appwrapper condition check for scale-up
Browse files Browse the repository at this point in the history
  • Loading branch information
VanillaSpoon committed Dec 11, 2023
1 parent fafee56 commit 85d8604
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions controllers/appwrapper_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,24 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, nil
}

demandPerInstanceType := r.discoverInstanceTypes(ctx, &appwrapper)
if ocmSecretRef := r.Config.OCMSecretRef; ocmSecretRef != nil {
return r.scaleMachinePool(ctx, &appwrapper, demandPerInstanceType)
} else {
switch strings.ToLower(r.Config.MachineSetsStrategy) {
case "reuse":
return r.reconcileReuseMachineSet(ctx, &appwrapper, demandPerInstanceType)
case "duplicate":
return r.reconcileCreateMachineSet(ctx, &appwrapper, demandPerInstanceType)
status := appwrapper.Status.State
allconditions := appwrapper.Status.Conditions
for _, condition := range allconditions {
if status == "Pending" && strings.Contains(condition.Message, "Insufficient") {
demandPerInstanceType := r.discoverInstanceTypes(ctx, &appwrapper)
if ocmSecretRef := r.Config.OCMSecretRef; ocmSecretRef != nil {
return r.scaleMachinePool(ctx, &appwrapper, demandPerInstanceType)
} else {
switch strings.ToLower(r.Config.MachineSetsStrategy) {
case "reuse":
return r.reconcileReuseMachineSet(ctx, &appwrapper, demandPerInstanceType)
case "duplicate":
return r.reconcileCreateMachineSet(ctx, &appwrapper, demandPerInstanceType)
}
}
}
}

return ctrl.Result{}, nil
}

Expand Down

0 comments on commit 85d8604

Please sign in to comment.