Avoid using resource status for reconcile logic #420
Labels
bugzilla/valid-bug
Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting.
v1.x
Issues related to features added after v1.0
Using a ClusterCatalog object's status for the catalogd controller's reconcile logic is an anti-pattern we should avoid.
We currently read from ClusterCatalog status to determine whether a catalog is ready to be polled again
examples:
Reading from Status for comparing ObservedGeneration of conditions with current generation
catalogd/internal/controllers/core/clustercatalog_controller.go
Lines 242 to 246 in 29d21c7
Using
LastSuccessfulPollAttempt
from status to calculate when to poll nextcatalogd/internal/controllers/core/clustercatalog_controller.go
Line 252 in 29d21c7
The status field should ideally be treated as a write-only field by the controller - we should update the controller so it can track information about a ClusterCatalog's current state without having to reference the ClusterCatalog's status field, as reading from Status may read to non-deterministic behavior if reconciler runs in quick succession.
Follow up based on #384 (comment)
See https://book.kubebuilder.io/reference/good-practices, https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
The text was updated successfully, but these errors were encountered: