@@ -132,7 +132,7 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
132132 return ctrl.Result {}, nil
133133 }
134134
135- demandPerInstanceType := r .discoverInstanceTypes (& appwrapper )
135+ demandPerInstanceType := r .discoverInstanceTypes (ctx , & appwrapper )
136136 if ocmSecretRef := r .Config .OCMSecretRef ; ocmSecretRef != nil {
137137 switch r .MachineType {
138138 case MachineTypeNodePool :
@@ -252,13 +252,16 @@ func (r *AppWrapperReconciler) getOCMSecret(ctx context.Context, secretRef *core
252252 return r .kubeClient .CoreV1 ().Secrets (secretRef .Namespace ).Get (ctx , secretRef .Name , metav1.GetOptions {})
253253}
254254
255- func (r * AppWrapperReconciler ) discoverInstanceTypes (aw * arbv1.AppWrapper ) map [string ]int {
255+ func (r * AppWrapperReconciler ) discoverInstanceTypes (ctx context. Context , aw * arbv1.AppWrapper ) map [string ]int {
256256 demandMapPerInstanceType := make (map [string ]int )
257257 instanceRequired := getInstanceRequired (aw .Labels )
258258 if len (instanceRequired ) < 1 {
259259 if _ , exists := aw .Annotations ["loggedNoInstances" ]; ! exists {
260260 klog .Infof ("Found AW %s that cannot be scaled due to missing orderedinstance label" , aw .ObjectMeta .Name )
261261 r .setAnnotation (aw , "loggedNoInstances" , "true" )
262+ if err := r .Update (ctx , aw ); err != nil {
263+ return nil
264+ }
262265 }
263266 return demandMapPerInstanceType
264267 }
0 commit comments