-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix minikube mount --kill #15778
Comments
The issue comes from the fact that the kill flag relies on a mechanism(k8s.io/minikube/cmd/minikube/cmd.killMountProcess) Instead, The code for
|
also relying on lock.Writefile as the configureMounts() implementation would not be enough:
Perhaps we could use a lock.AppendToFile()? |
The delete mechanism called by the --kill flag logic inside the minikube mount command, relies on a .mount-process file inside the .minikube dotfolder in home directory. For this to work, the mount should've been instantiated by some mechanism that also creates the file; like k8s.io/minikube/pkg/minikube/node.configureMounts() To just add the local.WriteFile() logic from configureMounts() is not enough for the usecase in kubernetes#15778: user's consequent "minikube mount" calls would break the cleaning logic, since the file's content gets overwritten at each new call. So on subsequent minikube mounts, a call to "minikube mount --kill=true" would remove just the last pid, leaving the other mounts unaltered, and no trace of them in any place...(leak?) For the same mechanism to work here, we should rely on some local.AppendFile() function, to add separated pids consequently. This way only "minikube mount" would use this new append logic, leaving unaltered the other functions. We now have a new behaviour for the .mount-process file, in order to address this, we should modify the delete logic from cmd/minikube/cmd/delete.go -- killProcess(), so that we can both kill a single pid, as well as multiple space-separated pids in the same way. ... Ah yes.. we're slightly modifying the "minikube mount" RunE anon function, in order to write the pid into the .mount-process file; as well as modifying cluster.Mount()'s signature to accept the pid. That should be more than safe, since cluster.Mount() is used only here
The delete mechanism called by the --kill flag logic inside the minikube mount command, relies on a .mount-process file inside the .minikube dotfolder in home directory. For this to work, the mount should've been instantiated by some mechanism that also creates the file; like k8s.io/minikube/pkg/minikube/node.configureMounts() To just add the local.WriteFile() logic from configureMounts() is not enough for the usecase in kubernetes#15778: user's consequent "minikube mount" calls would break the cleaning logic, since the file's content gets overwritten at each new call. So on subsequent minikube mounts, a call to "minikube mount --kill=true" would remove just the last pid, leaving the other mounts unaltered, and no trace of them in any place...(leak?) For the same mechanism to work here, we should rely on some local.AppendFile() function, to add separated pids consequently. This way only "minikube mount" would use this new append logic, leaving unaltered the other functions. We now have a new behaviour for the .mount-process file, in order to address this, we should modify the delete logic from cmd/minikube/cmd/delete.go -- killProcess(), so that we can both kill a single pid, as well as multiple space-separated pids in the same way. ... Ah yes.. we're slightly modifying the "minikube mount" RunE anon function, in order to write the pid into the .mount-process file; as well as modifying cluster.Mount()'s signature to accept the pid. That should be more than safe, since cluster.Mount() is used only here
The delete mechanism called by the --kill flag logic inside the minikube mount command, relies on a .mount-process file inside the .minikube dotfolder in home directory. For this to work, the mount should've been instantiated by some mechanism that also creates the file; like k8s.io/minikube/pkg/minikube/node.configureMounts() To just add the local.WriteFile() logic from configureMounts() is not enough for the usecase in kubernetes#15778: user's consequent "minikube mount" calls would break the cleaning logic, since the file's content gets overwritten at each new call. So on subsequent minikube mounts, a call to "minikube mount --kill=true" would remove just the last pid, leaving the other mounts unaltered, and no trace of them in any place...(leak?) For the same mechanism to work here, we should rely on some local.AppendFile() function, to add separated pids consequently. This way only "minikube mount" would use this new append logic, leaving unaltered the other functions. We now have a new behaviour for the .mount-process file, in order to address this, we should modify the delete logic from cmd/minikube/cmd/delete.go -- killProcess(), so that we can both kill a single pid, as well as multiple space-separated pids in the same way. ... Ah yes.. we're slightly modifying the "minikube mount" RunE anon function, in order to write the pid into the .mount-process file; as well as modifying cluster.Mount()'s signature to accept the pid. That should be more than safe, since cluster.Mount() is used only here
What Happened?
minikube mount --kill should kill all already mount processes spwan by minikube
to reproduce
try to mount 3 different folders
minikube mount -p minikube /tmp:/a1
minikube mount -p minikube /tmp:/a2
minikube mount -p minikube /tmp:/a3
and then
minikube mount --kill=true
and expect there be no process
ps aux | grep "minikube mount"
Attach the log file
n/a
Operating System
None
Driver
None
The text was updated successfully, but these errors were encountered: