Skip to content

Commit

Permalink
Add lastUpdate state update to ensure that synchronized commits displ…
Browse files Browse the repository at this point in the history
…ay a succeeded status (#429)
  • Loading branch information
kenji-fukasawa authored May 2, 2023
1 parent e3f9416 commit 73af6e6
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 @@ -27,6 +27,8 @@ Update to [Pulumi SDK v3.65.0](https://github.com/pulumi/pulumi/releases/tag/v3.
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 73af6e6

Please sign in to comment.