Repository navigation
Treat a ClusterConnection without status or with a stale status as not ready - #100
Merged
Merged
Conversation
…t ready Before, a missing status threw a NullPointerException outside the try block of each caller, so no status was written. A READY of an older generation also counted, although it says nothing about the new spec. Assisted-by: Claude:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #98
BaseReconciler.getReferencedClusterConnectionread the phase of the referencedClusterConnectionwithout two checks:nullcheck for the status. Before the first reconcile of aClusterConnection, its status isnull, andgetStatus().getPhase()threw aNullPointerException. All ten callers (reconcileandcleanupofDatabase,Schema,Role,GrantandDefaultPrivilege) call the method before theirtryblock, sohandleErrordid not run and no status was written.READYof an older generation also counted. After a change of theClusterConnectionspec, a dependent resource used the new spec before theClusterConnectionreconciler had probed it.What changed
WARNline. The method returns empty when the status isnull("has not been probed yet"), and whenstatus.observedGenerationdiffers frommetadata.generation("changed and has not been probed again yet"). The "not ready yet" line now also showsstatus.phase. This is the same fix as in the Garage Operator (aboutbits/garage-operator@c25e3bb, aboutbits/garage-operator@66ff039).ClusterConnectiondoes not exist, is notREADY, or isREADYfor an older generation. Callers treat this as "not yet", not "broken", and try again after 60 seconds.BaseReconcilerTest. A unit test with the fabric8 mock server covers all five cases: missing, no status, notREADY,READYfor an older generation, andREADYfor the current generation.ClusterConnectionCreatenow waits untilstatus.observedGenerationequalsmetadata.generation, not only until a status exists. TheGrantandDefaultPrivilegecreators apply the sameClusterConnectionseveral times with a new spec, so without this wait the new check made them wait for the 60 second retry.Consequences
ClusterConnection, for example in one Helm release, can now wait 60 seconds for its first successful reconcile. Before, theNullPointerExceptionstarted the JOSDK retry, which came after 2 seconds, but which stopped after 5 attempts. The retry now has no attempt limit.ClusterConnectionspec, its dependent resources reportPENDINGuntil theClusterConnectionreconciler has probed the new spec. They do not watch theClusterConnection, so they find out at their next retry, up to 60 seconds later.Checks that CI cannot do
ClusterConnectionwithout status throws theNullPointerException, and theREADYof an older generation is returned.metadata.generationto 1 on create and keeps the status, because no CRD with a status subresource is registered. The unit test checks this in each case that creates aClusterConnection, so it cannot pass for the wrong reason.Other changes
getReferencedClusterConnectionthrows aNullPointerExceptionfor aClusterConnectionwithout status and ignores its generation #98:RoleReconciler,ClusterConnectionSpec,KubernetesServiceTestandPasswordFingerprintServiceTest. It does not change the behavior.