-
Notifications
You must be signed in to change notification settings - Fork 347
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
reset command improvements #959
Conversation
a5f2d09
to
7331b07
Compare
The behavior is a bit sketchy. First it gets the role: role := install.GetRoleByStagedKubelet(c.K0sVars.BinDir) This will return "worker" if no installation was detected. Then it proceeds to uninstall both controller and worker: err := install.UninstallService("controller")
if err != nil { ... }
err = install.UninstallService("worker")
if err != nil { ... } I assume one of them will always report the Finally it will proceed to do cleanup based on the I think the best would be to fix the |
@kke |
5c78b71
to
de25ffe
Compare
Lines 67 to 79 in de25ffe
seems to me, it will never return an empty role, but always fall back to "worker". |
Yeah returning "worker" when binaries are not present caused reset to behave weird. |
de25ffe
to
c9b01ad
Compare
f7b04df
to
6308085
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some specific comments.
There's bunch of funcs that are exported but lacks proper comments.
In general this is pretty good, I like the added structure and robustness for the reset/cleanup functionality.
6c3732a
to
3dc58de
Compare
3dc58de
to
6abac98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit about the output:
/ # ./k0s reset
* containerd steps
INFO[2021-06-11 07:15:58] successfully removed k0s containers!
INFO[2021-06-11 07:15:58] no config file given, using defaults
* remove directories step
WARN[2021-06-11 07:15:58] failed to unmount /var/lib/k0s
* CNI leftovers cleanup step
k0s cleanup operations done. To ensure a full reset, a node reboot is recommended.
Error: errors received during clean-up: [failed to delete /var/lib/k0s. err: unlinkat /var/lib/k0s: device or resource busy]
2021-06-11 07:15:58.173736 I | errors received during clean-up: [failed to delete /var/lib/k0s. err: unlinkat /var/lib/k0s: device or resource busy]
The output is now coming from both fmt.Println
and through logrus which makes it bit "messy" IMO. I'd rather have all output through logrus.
…irectories - remove all k0s directories, services - removes service stubs, users - removes controller users, cni - removes CNI leftovers Signed-off-by: Jasmin Gacic <jgacic@mirantis.com>
6abac98
to
5b0ec0d
Compare
There's also direct output from the commands started via os.Exec as the stdout and stderr are piped directly. |
Fixes part of the issue #928.
Reset command will remove service stubs regardless of the role installed.
When running reset command without k0s binaries already being unpacked in the data directory reset command is not able to detect which role has already been installed. So reset will now try to remove both service stubs k0scontroller and k0sworker.
Signed-off-by: Jasmin Gacic jgacic@mirantis.com