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.
As we documented in https://github.com/openstack-k8s-operators/docs/blob/main/conditions.md:
However the current lib-common code:
lib-common/modules/common/condition/funcs.go
Lines 80 to 83 in 903adc9