Repository navigation
Keep the stored lastPhaseTransitionTime when the operator reads a status - #99
Merged
Merged
Conversation
…ransition time Jackson called setPhase while it read a status from the cluster. The API server sends lastPhaseTransitionTime before phase, so the stored time was overwritten with now on each read. 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 #97
CRStatus.setPhasewas a setter with logic: when the phase changed, it setlastPhaseTransitionTimeto now. Jackson also called it while it read a status from the cluster. The API server sendslastPhaseTransitionTimebeforephase, and a newCRStatusstarts asPENDING. So each read of a resource that was notPENDINGoverwrote the stored time with now, and the nextpatchStatuswrote it back. On a test cluster, aClusterConnectionand 16Grantresources that wereREADYsince September all showed the time of the last operator restart.What changed
setPhaseis nowupdatePhase. Jackson does not use it as a setter, so it sets thephasefield directly and keeps the stored time. The logic is the same. A Javadoc gives the reason. This is the same fix as in the Garage Operator (aboutbits/garage-operator@63da164).updatePhase. 24 calls in the reconcilers andBaseReconciler, and 15 in the tests.null. The code never did that.CRStatusTest. It reads a status JSON withlastPhaseTransitionTimebeforephaseand expects the stored time. Other tests check that the same phase keeps a stored time, that a new phase replaces it, and thatupdatePhasecan be chained with the other setters.Consequences
lastPhaseTransitionTimekeeps its value until the phase really changes. Resources that the old version read show the time of that read, not of their last real phase change.Checks that CI cannot do
2026-01-01T00:00:00Zbecomes the current time.