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

Merged
merged 1 commit into from
Jan 10, 2025

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
@claudiubelu claudiubelu force-pushed the remove-hook-updates branch 2 times, most recently from ac8315e to 589184a Compare December 19, 2024 14:56
@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
Copy link
Member

@berkayoz berkayoz left a comment

Choose a reason for hiding this comment

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

LGTM overall, one minor comment

src/k8s/pkg/k8sd/app/hooks_remove.go Outdated 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.
Copy link
Member

@berkayoz berkayoz left a comment

Choose a reason for hiding this comment

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

LGTM

@berkayoz berkayoz merged commit 91f29ec into canonical:main Jan 10, 2025
18 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.

3 participants