Skip to content

Commit

Permalink
Added lastUpdate state update to ensure that synchronized commits dis…
Browse files Browse the repository at this point in the history
…play a succeeded status
  • Loading branch information
kenji-fukasawa committed Mar 28, 2023
1 parent ebbf9cb commit d89cf06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/controller/stack/stack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ func (r *ReconcileStack) Reconcile(ctx context.Context, request reconcile.Reques
reqLogger.Info("Commit hash unchanged. Will poll again.", "pollFrequencySeconds", resyncFreqSeconds)
// Reconcile every resyncFreqSeconds to check for new commits to the branch.
instance.Status.MarkReadyCondition() // FIXME: should this reflect the previous update state?
// Ensure lastUpdate state is updated if previous sync failure occurred
if instance.Status.LastUpdate.State != shared.SucceededStackStateMessage {
instance.Status.LastUpdate.State = shared.SucceededStackStateMessage
instance.Status.LastUpdate.LastResyncTime = metav1.Now()
}
return reconcile.Result{RequeueAfter: time.Duration(resyncFreqSeconds) * time.Second}, nil
}

Expand All @@ -644,6 +649,11 @@ func (r *ReconcileStack) Reconcile(ctx context.Context, request reconcile.Reques
reqLogger.Info("Commit hash unchanged. Will poll again.", "pollFrequencySeconds", resyncFreqSeconds)
// Reconcile every resyncFreqSeconds to check for new commits to the branch.
instance.Status.MarkReadyCondition() // FIXME: should this reflect the previous update state?
// Ensure lastUpdate state is updated if previous sync failure occurred
if instance.Status.LastUpdate.State != shared.SucceededStackStateMessage {
instance.Status.LastUpdate.State = shared.SucceededStackStateMessage
instance.Status.LastUpdate.LastResyncTime = metav1.Now()
}
return reconcile.Result{RequeueAfter: time.Duration(resyncFreqSeconds) * time.Second}, nil
}

Expand All @@ -659,6 +669,11 @@ func (r *ReconcileStack) Reconcile(ctx context.Context, request reconcile.Reques
reqLogger.Info("Commit hash unchanged. Will poll again.", "pollFrequencySeconds", resyncFreqSeconds)
// Reconcile every resyncFreqSeconds to check for new commits to the branch.
instance.Status.MarkReadyCondition() // FIXME: should this reflect the previous update state?
// Ensure lastUpdate state is updated if previous sync failure occurred
if instance.Status.LastUpdate.State != shared.SucceededStackStateMessage {
instance.Status.LastUpdate.State = shared.SucceededStackStateMessage
instance.Status.LastUpdate.LastResyncTime = metav1.Now()
}
return reconcile.Result{RequeueAfter: time.Duration(resyncFreqSeconds) * time.Second}, nil
}

Expand Down

0 comments on commit d89cf06

Please sign in to comment.