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

Enforce that every condition is initialized to Unknow state explicitly before use #317

Open
gibizer opened this issue Aug 4, 2023 · 0 comments

Comments

@gibizer
Copy link
Contributor

gibizer commented Aug 4, 2023

As we documented in https://github.com/openstack-k8s-operators/docs/blob/main/conditions.md:

When a controller performs a task, before it starts a step condition gets initialized to Status=Unknown e.g. DBReady, DBSync, Endpoint, ServiceRegistered, …

However the current lib-common code:

// If the condition does not exist, add it
if !exists {
*conditions = append(*conditions, *c)
}
does not enforce this and allows creating new conditions in any state. We could change lib-common in a way that panics if a condition is created in other than Unknown state. This will force the service operators to follow the rules. The downside of this approach is that it creates runtime errors so it cannot be detect in build time.

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