Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up controlnode if machine related to K0sControlPlane is deleted #790

Merged

Conversation

apedriza
Copy link
Contributor

@apedriza apedriza commented Oct 22, 2024

Fix #768

Follow up PR to k0sproject/k0s#5128. We need to use machine name as ControlNode name in order to be able to delete it when applies

@apedriza apedriza requested a review from a team as a code owner October 22, 2024 10:56
@apedriza apedriza marked this pull request as draft October 22, 2024 10:56
@@ -406,6 +406,10 @@ func (c *K0sController) reconcileMachines(ctx context.Context, cluster *clusterv
return replicasToReport, fmt.Errorf("error marking controlnode to leave: %w", err)
}

if err := c.deleteControlNode(ctx, name, kubeClient); err != nil {
Copy link
Contributor Author

@apedriza apedriza Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makhov I did not see logic reacting to this https://github.com/k0sproject/k0smotron/blob/main/internal/controller/controlplane/helper.go#L182-L189 so I thought is safe to remove controlnode at this point. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it's too early, let's do it at the very end, after the machine object is deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@apedriza apedriza marked this pull request as ready for review October 22, 2024 11:03
@apedriza apedriza force-pushed the remove_controlnodes_related_to_machines branch from 7a79ac1 to 3b75585 Compare October 23, 2024 11:03
@apedriza apedriza requested a review from makhov October 28, 2024 16:54
@apedriza apedriza merged commit 9e78c1f into k0sproject:main Oct 31, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clean up controlnodes and etcdmembers after Machine removal
3 participants