Skip to content

Commit 73e7eb5

Browse files
committed
feat: add no-op event log for suspended reconcile
There are edge cases where a reonciliation can be triggered on a suspended Kustomization, mainly through changes in a source. In these cases a "no-op" reconciliation occurs, which can be confusing for the user. This adds separate handling with an more expressive event log message
1 parent dc0e585 commit 73e7eb5

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

internal/controller/kustomization_controller.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,15 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
191191

192192
// Log and emit success event.
193193
if conditions.IsReady(obj) {
194-
msg := fmt.Sprintf("Reconciliation finished in %s, next run in %s",
195-
time.Since(reconcileStart).String(),
196-
obj.Spec.Interval.Duration.String())
194+
var msg string
195+
if obj.Spec.Suspend {
196+
msg = fmt.Sprintf("Reconciliation run as No-Op, %s is suspended", obj.GroupVersionKind().Kind)
197+
} else {
198+
msg = fmt.Sprintf("Reconciliation finished in %s, next run in %s",
199+
time.Since(reconcileStart).String(),
200+
obj.Spec.Interval.Duration.String())
201+
}
202+
197203
log.Info(msg, "revision", obj.Status.LastAttemptedRevision)
198204
r.event(obj, obj.Status.LastAppliedRevision, obj.Status.LastAppliedOriginRevision, eventv1.EventSeverityInfo, msg,
199205
map[string]string{

0 commit comments

Comments
 (0)