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 8fb3793
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CHANGELOG
image of the same version, fixing [issue
#411](https://github.com/pulumi/pulumi-kubernetes-operator/issues/411)
[#422](https://github.com/pulumi/pulumi-kubernetes-operator/pull/422)
- Added lastUpdate state update to ensure that synchronized commits display a succeeded status.
[#429](https://github.com/pulumi/pulumi-kubernetes-operator/pull/429)

## 1.11.1 (2023-02-08)

Expand Down
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 8fb3793

Please sign in to comment.