Skip to content

Commit

Permalink
fix: not upating status even replicas changed (#366)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
whynowy authored Sep 21, 2021
1 parent 50742ca commit 57a1634
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion manager/controllers/step_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func (r *StepReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.

desiredReplicas := int(step.Spec.Replicas)

oldStatus := step.Status.DeepCopy()
if currentReplicas != desiredReplicas || step.Status.Selector == "" {
log.Info("replicas changed", "currentReplicas", currentReplicas, "desiredReplicas", desiredReplicas)
step.Status.Replicas = uint32(desiredReplicas)
Expand All @@ -138,7 +139,6 @@ func (r *StepReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.

selector, _ := labels.Parse(dfv1.KeyPipelineName + "=" + pipelineName + "," + dfv1.KeyStepName + "=" + stepName)
hash := util.MustHash(hash{runnerImage, step.Spec.WithOutReplicas()}) // we must remove data (e.g. replicas) which does not change the pod, otherwise it would cause the pod to be re-created all the time
oldStatus := step.Status.DeepCopy()
step.Status.Phase, step.Status.Reason, step.Status.Message = dfv1.StepUnknown, "", ""
step.Status.Selector = selector.String()

Expand Down

0 comments on commit 57a1634

Please sign in to comment.