-
Notifications
You must be signed in to change notification settings - Fork 354
refactor: break up appHealthOrSyncStatusChanged into shared predicates #6035
Description
Context
#5995 introduced appHealthOrSyncStatusChanged() in
pkg/controller/stages/event_handlers.go — a monolithic function that
detects four distinct signals and gates the Stage reconciler's Application
watch:
- Health status change
- Operation phase change (any transition)
- Sync revision change
reconciledAtcrossingfinishedAt(health becomes trustworthy after a hard refresh)
#5832 added typed predicates for the Promotions controller's Application watch:
ArgoCDAppOperationCompleted, ArgoCDAppHealthChanged, ArgoCDAppSyncChanged,
and ArgoCDAppReconciledAfterOperation. Signals 1, 2, and 4 are identical in
both controllers; only signal 3 (sync revision) is Stages-specific.
Proposed refactor
Break appHealthOrSyncStatusChanged() into three exported typed predicates
(parallel to those in pkg/controller/promotions/predicates.go) that can be
shared:
ArgoCDAppHealthChanged— signal 1ArgoCDAppOperationPhaseChanged— signal 2 (any phase change, not just to-completed)ArgoCDAppReconciledAfterOperation— signal 4
Move them to a shared location (e.g. pkg/controller/argocd/predicates.go)
and use them in both the Stages and Promotions watches, replacing the current
inline implementations in each.
Signal 3 (sync revision) remains Stages-only and stays in
event_handlers.go.
Reference
- Discussed in
argocd-waitreview: feat: add argocd-wait promotion step #5832 (comment) - Kent's follow-up note: feat: add argocd-wait promotion step #5832 (comment)