@@ -360,14 +360,6 @@ func (c *Controller) syncHandler(key string) error {
360
360
return nil
361
361
}
362
362
363
- // In order to work with HPA, the rollout.Spec.Replica field cannot be nil. As a result, the controller will update
364
- // the rollout to have the replicas field set to the default value. see https://github.com/argoproj/argo-rollouts/issues/119
365
- if rollout .Spec .Replicas == nil {
366
- logCtx .Info ("Defaulting .spec.replica to 1" )
367
- r .Spec .Replicas = pointer .Int32Ptr (defaults .DefaultReplicas )
368
- _ , err := c .argoprojclientset .ArgoprojV1alpha1 ().Rollouts (r .Namespace ).Update (ctx , r , metav1.UpdateOptions {})
369
- return err
370
- }
371
363
defer func () {
372
364
duration := time .Since (startTime )
373
365
c .metricsServer .IncRolloutReconcile (r , duration )
@@ -385,6 +377,15 @@ func (c *Controller) syncHandler(key string) error {
385
377
return resolveErr
386
378
}
387
379
380
+ // In order to work with HPA, the rollout.Spec.Replica field cannot be nil. As a result, the controller will update
381
+ // the rollout to have the replicas field set to the default value. see https://github.com/argoproj/argo-rollouts/issues/119
382
+ if rollout .Spec .Replicas == nil {
383
+ logCtx .Info ("Defaulting .spec.replica to 1" )
384
+ r .Spec .Replicas = pointer .Int32Ptr (defaults .DefaultReplicas )
385
+ _ , err := c .argoprojclientset .ArgoprojV1alpha1 ().Rollouts (r .Namespace ).Update (ctx , r , metav1.UpdateOptions {})
386
+ return err
387
+ }
388
+
388
389
err = roCtx .reconcile ()
389
390
if roCtx .newRollout != nil {
390
391
c .writeBackToInformer (roCtx .newRollout )
0 commit comments