Repository navigation
Conversation
ader1990
force-pushed
the
cluster_api_upgrade_to_betav2_clean_node_removal
branch
2 times, most recently
from
October 2, 2026 07:51
e2cec17 to
84771d3
Compare
In case of the node removal, the workflow was the following: 1. remove the node from microcluster 2. remove the machine This workflow has the big problem that step 1 destroys the node without cleaning it up first (without cordon, drain, volume detachment). Also, another major problem is that step 1 is async, and step 2 can actually be done in a more eager manner, and the underlying hardware aka machine can be wiped out before the actual remove of the node by snap-k8s can be done safely. In addition, step 1 will block the capi operator in doing the cordon, drain and volume detachment, as the node will be removed in an eager manner as well. This what-if workflow has to be changed to one that performs in a logical safe way: 1. add the pre-remove annotation for all machines 1. remove the machine -> this triggers the machine removal -> capi makes sure that the cordon, drain, volume detachment is done safely. After the cordon, drain, volume detachment is complete, capi waits for the pre-remove annotation to be removed. 2. ck8s machine controller waits until the cordon, drain, volume detachment is done by veryfing the conditions. Then, it verifies that CAPI set the waiting for pre-remove hook to be executed. Once CAPI set that condition on the machine, ck8s machine controller takes over and issues the remove the node from microcluster. Then, it verifies that the node has been properly removed. Then, it remove the pre-remove anotation from that machine. There is currently a gap in snap-k8s API - there is currently no API to verify that the node has been properly removed. This feature needs to be implemented. Until then, ck8s machine controller can only blindly try to execute the node removal a few times, making sure that the node has been removed via this "hack". Signed-off-by: Adrian Vladu <adrian.vladu@canonical.com> Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
ader1990
force-pushed
the
cluster_api_upgrade_to_betav2_clean_node_removal
branch
from
October 6, 2026 09:45
aaeaa7a to
b51ab9a
Compare
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
ader1990
marked this pull request as ready for review
October 9, 2026 12:22
ader1990
marked this pull request as draft
October 9, 2026 12:23
This was referenced Oct 13, 2026
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.
In case of the node removal, the workflow was the following:
This workflow has the big problem that step 1 destroys the node
without cleaning it up first (without cordon, drain, volume detachment).
Also, another major problem is that step 1 is async, and step 2 can
actually be done in a more eager manner, and the underlying hardware aka machine
can be wiped out before the actual remove of the node by snap-k8s can be
done safely.
In addition, step 1 will block the capi operator in doing the cordon, drain and
volume detachment, as the node will be removed in an eager manner as well.
This what-if workflow has to be changed to one that performs in a logical safe way:
cordon, drain, volume detachment is done safely. After the cordon, drain, volume detachment
is complete, capi waits for the pre-remove annotation to be removed.
veryfing the conditions. Then, it verifies that CAPI set the waiting for pre-remove hook to
be executed. Once CAPI set that condition on the machine, ck8s machine controller takes over
and issues the remove the node from microcluster. Then, it verifies that the node has been
properly removed. Then, it remove the pre-remove anotation from that machine.
There is currently a gap in snap-k8s API - there is currently no API to verify that the node
has been properly removed. This feature needs to be implemented. Until then, ck8s machine
controller can only blindly try to execute the node removal a few times, making sure that
the node has been removed via this "hack".