Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using resource status for reconcile logic #420

Open
ankitathomas opened this issue Sep 27, 2024 · 0 comments
Open

Avoid using resource status for reconcile logic #420

ankitathomas opened this issue Sep 27, 2024 · 0 comments

Comments

@ankitathomas
Copy link
Contributor

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:

if catalog.Spec.Source.Image.Ref != catalog.Status.ResolvedSource.Image.Ref {
,
nextPoll := catalog.Status.ResolvedSource.Image.LastPollAttempt.Add(catalog.Spec.Source.Image.PollInterval.Duration)
if nextPoll.After(time.Now()) && catalog.Generation == catalog.Status.ObservedGeneration {
)

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant