Skip to content

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

@gibizer

Description

@gibizer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions