Clean up supervisor images in the database#2535
Open
pipex wants to merge 1 commit into
Open
Conversation
On supervisor v18.2.0, we renamed the supervisor service to `core` in the [supervisor composition](https://github.com/balena-os/balena-supervisor/blob/v18.2.0/docker-compose.yml). That change also updated the [isSupervisor](https://github.com/balena-os/balena-supervisor/blob/v18.2.0/src/lib/supervisor-metadata.ts#L34) filter in the supervisor-metadata module. The problem is that when updating to v18.2.0, the following race condition may happen - The device is on v17.8.5, and the user updates the supervisor on the dashboard to v18.2.0. The target state changes - Before the update-balena-supervisor script can run, supervisor v17.8.5, sees the new `core` service which it not part of its filter list and creates the service and image on the database. - Eventually supervisor v18.2.0 runs, it knows to filter `core` and tries to remove the image, but its using the image itself, so it gets stuck in a loop trying to remove the image and failing. This adds a `isSupervisor` check to the initial application manager image cleanup to avoid the issue happening altogether. If a customer is stuck in the delete loop, updating to this supervisor should fix it. Change-type: patch
Contributor
Author
|
How to test
|
Contributor
Author
|
This works, I tested two scenarios
|
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.
On supervisor v18.2.0, we renamed the supervisor service to
corein the supervisorcomposition. That change also updated the isSupervisor filter in the supervisor-metadata module.
The problem is that when updating to v18.2.0, the following race condition may happen
coreservice which it not part of its filter list and creates the service and image on the database.coreand tries to remove the image, but its using the image itself, so it gets stuck in a loop trying to remove the image and failing.This adds a
isSupervisorcheck to the initial application manager image cleanup to avoid the issue happening altogether.If a customer is stuck in the delete loop, updating to this supervisor should fix it.
Change-type: patch
Release notes
Fixes an issue introduced by the renaming of the supervisor service to
core, where the old supervisor could install thecorecontainer and image, and the new supervisor would not be able to remove the image due to the image being used by the current supervisor container. This change adds a cleanup step to avoid the image delete loop and restore operation.