@@ -102,19 +102,21 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
102
102
if appwrapper .Status .State == arbv1 .AppWrapperStateEnqueued || appwrapper .Status .State == "" {
103
103
demandPerInstanceType := discoverInstanceTypes (& appwrapper )
104
104
//TODO: simplify the looping
105
- if useMachineSets {
106
- if r .canScaleMachineset (ctx , demandPerInstanceType ) {
107
- r .scaleUp (ctx , & appwrapper , demandPerInstanceType )
108
- } else {
109
- klog .Infof ("Cannot scale up replicas max replicas allowed is %v" , maxScaleNodesAllowed )
110
- }
111
- } else {
112
- if canScaleMachinepool (demandPerInstanceType ) {
113
- if err := r .scaleUp (ctx , & appwrapper , demandPerInstanceType ); err != nil {
114
- return ctrl.Result {}, err
105
+ if demandPerInstanceType != nil {
106
+ if useMachineSets {
107
+ if r .canScaleMachineset (ctx , demandPerInstanceType ) {
108
+ r .scaleUp (ctx , & appwrapper , demandPerInstanceType )
109
+ } else {
110
+ klog .Infof ("Cannot scale up replicas max replicas allowed is %v" , maxScaleNodesAllowed )
115
111
}
116
112
} else {
117
- klog .Infof ("Cannot scale up replicas max replicas allowed is %v" , maxScaleNodesAllowed )
113
+ if canScaleMachinepool (demandPerInstanceType ) {
114
+ if err := r .scaleUp (ctx , & appwrapper , demandPerInstanceType ); err != nil {
115
+ return ctrl.Result {}, err
116
+ }
117
+ } else {
118
+ klog .Infof ("Cannot scale up replicas max replicas allowed is %v" , maxScaleNodesAllowed )
119
+ }
118
120
}
119
121
}
120
122
return ctrl.Result {}, nil
0 commit comments