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

Cleans up k8s-dqlite state dir and stops it on remove hook #908

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

claudiubelu
Copy link
Contributor

@claudiubelu claudiubelu commented Dec 16, 2024

cfg.Datastore.GetType() may return an empty string if the bootstrap action failed before database.SetClusterConfig has been called. Because of this, we're not removing the state dir for k8s-dqlite, which will be wrongfully removed by setup.K8sDqlite on the next bootstrap attempt.

We're now opportunistically cleaning up the k8s-dqlite related state directory.

If a bootstrap attempt fails, the k8s-dqlite service will still be running, which will cause the next bootstrap attempt to fail, as the k8s-dqlite port will be currently in use.

@claudiubelu claudiubelu requested a review from a team as a code owner December 16, 2024 19:11
@claudiubelu claudiubelu changed the title Cleans up files and removes k8s-dqlite on remove hook Cleans up files and stops k8s-dqlite on remove hook Dec 16, 2024
src/k8s/pkg/k8sd/app/hooks_remove.go Outdated Show resolved Hide resolved
src/k8s/pkg/k8sd/app/hooks_remove.go Outdated Show resolved Hide resolved
src/k8s/pkg/k8sd/app/hooks_remove.go Outdated Show resolved Hide resolved
src/k8s/pkg/k8sd/app/hooks_remove.go Show resolved Hide resolved
cfg.Datastore.GetType() may return an empty string if the bootstrap
action failed before database.SetClusterConfig has been called. Because
of this, we're not removing the state dir for k8s-dqlite, which will be
wrongfully removed by setup.K8sDqlite on the next bootstrap attempt.

We're now opportunistically cleaning up the k8s-dqlite related state
directory.

If a bootstrap attempt fails, the k8s-dqlite service will still be
running, which will cause the next bootstrap attempt to fail, as the
k8s-dqlite port will be currently in use.
@claudiubelu claudiubelu changed the title Cleans up files and stops k8s-dqlite on remove hook Cleans up k8s-dqlite state dir and stops it on remove hook Dec 19, 2024
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.

2 participants