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

Mirror order conditions as False, Unknown, True #204

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

gibizer
Copy link
Contributor

@gibizer gibizer commented Mar 6, 2023

This is a breaking change on Conditions.Mirror(). Originally this call ordered conditions as False, True, Unknown then picked the first of that list to reflect. However all the use cases (we see) assume that if there is reasourceA that depends on the status of resourceB then resourceA reconciler calls:

  resourceB.Status.Conditions.Mirror(ResourceBSpecificSubConditionOfA)

and expects that the call returns the most sever non True condition if any or return a True condition otherwise. So the original behavior that returned True even if there was Unknown condition was unexpected.

This patch changes the order of the status to False, Unknown, True. But keeps the original logic that if the ReadyCondition is True then the rest of the conditions are ignored even if there are False conditions in the list.

gibizer added a commit to gibizer/nova-operator that referenced this pull request Mar 6, 2023
The lib-common PR
openstack-k8s-operators/lib-common#204 fixed
the behavior of Conditions.Mirror(). So this patch checks if the fix
needs any adaptation from nova-operator.
@gibizer
Copy link
Contributor Author

gibizer commented Mar 6, 2023

/hold
I want to see that the behavior change I noticed in nova-operator after this lib-common change are OK openstack-k8s-operators/nova-operator#283

@gibizer gibizer marked this pull request as draft March 6, 2023 12:27
gibizer added a commit to gibizer/nova-operator that referenced this pull request Mar 6, 2023
The lib-common PR
openstack-k8s-operators/lib-common#204 fixed
the behavior of Conditions.Mirror(). So it now returns any Unknown
condition before any True condition (except ReadyCondition True).

It seems that our tests incorrectly assumed that NovaAPI becomes Ready
after the StatefulSet is Ready. But in reality NovaAPI creates the
KeystoneEndpoint *after* the StatefulSet is ready. So these tests passed
only because of the original bug in the Mirror code returned a True
condition from NovaAPI when it had DeploymentReady=True and
KeystoneEndpointReady=Unknown status. As the bug is fixed now the test
needs to make sure the KeystoneEndpoints are ready before it can expect
that NovaAPI is ready.
@gibizer
Copy link
Contributor Author

gibizer commented Mar 6, 2023

/unhold
openstack-k8s-operators/nova-operator#283 now shows that nova-operator actually have a bug before this fix. And after this fix the test needs to be adapted as it made wrong assumptions.

@gibizer gibizer marked this pull request as ready for review March 6, 2023 13:05
Copy link
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, as we discussed on slack, just two comments on the tests

modules/common/condition/funcs_test.go Outdated Show resolved Hide resolved
modules/common/condition/funcs_test.go Outdated Show resolved Hide resolved
This is a breaking change on Conditions.Mirror(). Originally this call
ordered conditions as False, True, Unknown then picked the first of that
list to reflect. However all the use cases (we see) assume that if there
is reasourceA that depends on the status of resourceB then resourceA
reconciler calls:

  resourceB.Status.Mirror(ResourceBSpecificSubConditionOfA)

and expects that the call returns the most sever non True condition if any
or return a True condition otherwise. So the original behavior that
returned True even if there was Unknown condition was unexpected.

This patch changes the order of the status to False, Unknown, True. But
keeps the original logic that if the ReadyCondition is True then the
rest of the conditions are ignored even if there are False conditions in
the list.
@gibizer gibizer force-pushed the conditions-ordering branch from 9ba5716 to 3c60f35 Compare March 6, 2023 13:51
Copy link
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@stuggi stuggi merged commit ec7de82 into openstack-k8s-operators:master Mar 6, 2023
gibizer added a commit to gibizer/nova-operator that referenced this pull request Mar 7, 2023
The lib-common PR
openstack-k8s-operators/lib-common#204 fixed
the behavior of Conditions.Mirror(). So it now returns any Unknown
condition before any True condition (except ReadyCondition True).

It seems that our tests incorrectly assumed that NovaAPI becomes Ready
after the StatefulSet is Ready. But in reality NovaAPI creates the
KeystoneEndpoint *after* the StatefulSet is ready. So these tests passed
only because of the original bug in the Mirror code returned a True
condition from NovaAPI when it had DeploymentReady=True and
KeystoneEndpointReady=Unknown status. As the bug is fixed now the test
needs to make sure the KeystoneEndpoints are ready before it can expect
that NovaAPI is ready.
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

Successfully merging this pull request may close these issues.

3 participants