Skip to content

Commit c459fea

Browse files
authored
Merge pull request #9414 from prezha/delete-context-when-stopped
Delete context when stopped
2 parents 2c638c5 + c63de60 commit c459fea

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

cmd/minikube/cmd/stop.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ func stopProfile(profile string) int {
114114
}
115115

116116
if !keepActive {
117-
if err := kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()); err != nil {
118-
exit.Error(reason.HostKubeconfigUnset, "update config", err)
117+
if err := kubeconfig.DeleteContext(profile, kubeconfig.PathFromEnv()); err != nil {
118+
exit.Error(reason.HostKubeconfigDeleteCtx, "delete ctx", err)
119119
}
120120
}
121121

pkg/minikube/reason/reason.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,18 @@ var (
200200
Issues: []int{9165},
201201
}
202202

203-
HostCurrentUser = Kind{ID: "HOST_CURRENT_USER", ExitCode: ExHostConfig}
204-
HostDelCache = Kind{ID: "HOST_DEL_CACHE", ExitCode: ExHostError}
205-
HostKillMountProc = Kind{ID: "HOST_KILL_MOUNT_PROC", ExitCode: ExHostError}
206-
HostKubeconfigUnset = Kind{ID: "HOST_KUBECNOFIG_UNSET", ExitCode: ExHostConfig}
207-
HostKubeconfigUpdate = Kind{ID: "HOST_KUBECONFIG_UPDATE", ExitCode: ExHostConfig}
208-
HostKubectlProxy = Kind{ID: "HOST_KUBECTL_PROXY", ExitCode: ExHostError}
209-
HostMountPid = Kind{ID: "HOST_MOUNT_PID", ExitCode: ExHostError}
210-
HostPathMissing = Kind{ID: "HOST_PATH_MISSING", ExitCode: ExHostNotFound}
211-
HostPathStat = Kind{ID: "HOST_PATH_STAT", ExitCode: ExHostError}
212-
HostPurge = Kind{ID: "HOST_PURGE", ExitCode: ExHostError}
213-
HostSaveProfile = Kind{ID: "HOST_SAVE_PROFILE", ExitCode: ExHostConfig}
203+
HostCurrentUser = Kind{ID: "HOST_CURRENT_USER", ExitCode: ExHostConfig}
204+
HostDelCache = Kind{ID: "HOST_DEL_CACHE", ExitCode: ExHostError}
205+
HostKillMountProc = Kind{ID: "HOST_KILL_MOUNT_PROC", ExitCode: ExHostError}
206+
HostKubeconfigUnset = Kind{ID: "HOST_KUBECNOFIG_UNSET", ExitCode: ExHostConfig}
207+
HostKubeconfigUpdate = Kind{ID: "HOST_KUBECONFIG_UPDATE", ExitCode: ExHostConfig}
208+
HostKubeconfigDeleteCtx = Kind{ID: "HOST_KUBECONFIG_DELETE_CTX", ExitCode: ExHostConfig}
209+
HostKubectlProxy = Kind{ID: "HOST_KUBECTL_PROXY", ExitCode: ExHostError}
210+
HostMountPid = Kind{ID: "HOST_MOUNT_PID", ExitCode: ExHostError}
211+
HostPathMissing = Kind{ID: "HOST_PATH_MISSING", ExitCode: ExHostNotFound}
212+
HostPathStat = Kind{ID: "HOST_PATH_STAT", ExitCode: ExHostError}
213+
HostPurge = Kind{ID: "HOST_PURGE", ExitCode: ExHostError}
214+
HostSaveProfile = Kind{ID: "HOST_SAVE_PROFILE", ExitCode: ExHostConfig}
214215

215216
ProviderNotFound = Kind{ID: "PROVIDER_NOT_FOUND", ExitCode: ExProviderNotFound}
216217
ProviderUnavailable = Kind{ID: "PROVIDER_UNAVAILABLE", ExitCode: ExProviderNotFound, Style: style.Shrug}

0 commit comments

Comments
 (0)