K8SPXC-1159: Wrong cluster status when invalid user password applied #1543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
user password applied.
CHANGE DESCRIPTION
Problem:
When a user applies an invalid password (rejected by MySQL), we return the error and set the cluster to
Error
state.But in the next reconcile loop, we don't return the error from
r.reconcileUsers
and move on with the reconciliation, we then set the status toReady
. This results in a flipping cluster status, like this:The reason why we end up in the ready state again is when handling users we check if the cluster is ready and only then proceed and since now it is in the
Error
state, we just return nil and don't do anything.But now again in the next reconciliation, the cluster is
Ready
, we proceed with updating the user pass that is still invalid, we return an error and the cluster ends up again in theError
state. That's how we end up flipping like this.Solution:
Now when checking if the cluster is ready or not before handling users, we also check if the invalid password was applied, if it is, we proceed with handling the user to try updating it again. We check the error message in the status to see if the error is an invalid password.
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability