Detect external bootc status changes via fsnotify (milestone 4d)#59
Open
alicefr wants to merge 10 commits into
Open
Detect external bootc status changes via fsnotify (milestone 4d)#59alicefr wants to merge 10 commits into
alicefr wants to merge 10 commits into
Conversation
8021bcf to
74c721d
Compare
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Rewrite the reconciler to detect image mismatches between spec.desiredImage and the booted image, stage via bootc switch in a background goroutine. Once, it finished to staged the image, the termination of the goroutine triggers once more the reconciliation loop which will detect that the system requires a reboot. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Replace raw JSON bytes with a bootc.Status struct in the test fake. Status() serializes the struct via json.Marshal, and Stage() auto-mutates the status (staging sets Staged). Reboot() records the call for test assertions. Add newBootcStatus() and newBootEntry() helpers to build test state without verbose JSON constants. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Replace the bootcStatusFull JSON constant with newBootcStatus() struct construction. Tighten the error assertion to match the exact error chain. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Add envtest cases for the daemon reconciler state machine: - TestStagingTriggered: image mismatch triggers bootc stage - TestStagingError: stage failure sets Degraded condition - TestAlreadyStaged: skip stage when image already staged - TestRebootingSet: reboot triggered when desiredImageState is Booted - TestRollback: restage when desired image changes - TestCancelInflightStage: spec change cancels in-flight stage Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
The TestUpdateReboot verifies that the upgrades to the new image is successfully performed. It starts by patching the desiredImage to a new one. Then, the BootcNode should have the Rebooting condition. After the reboot the node should be schedulable, proving that the uncordon was successful. Additionally, the test verifies that the image is the one we built for upgrades by checking the existance of the file /usr/share/update-marker. We don't detect the Staged condition since the transition between the phase Rebooting can happen very quickly. This is already covered by the env test and it can be verified when the rollout is paused. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
The daemon runs bootc switch which downloads the images. This operations requires consumes additional memory limits, otherwise it gets OOM killed. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Add a StatusWatcher component that detects external bootc status changes via fsnotify on /proc/1/root/ostree/bootc (with fallback to /proc/1/root/sysroot/state/deploy for composefs), plus a configurable polling interval as a safety net. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
Add --poll-interval flag to the daemon binary and wire the StatusWatcher channel into the reconciler as a second WatchesRawSource alongside switchDone. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Alice Frosi <afrosi@redhat.com>
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.
Bootc changes are detected via fsnotify or via a polling mechanism.
This is built on top of #50