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

Disable Non-Active Containers Runtimes #11516

Merged
merged 8 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/minikube/cruntime/cruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ func disableOthers(me Manager, cr CommandRunner) error {
klog.Infof("skipping containerd shutdown because we are bound to it")
continue
}

// runtime is already disabled, nothing to do.
if !r.Active() {
// in case of docker, if other runtime are already not active we are sure it is disabled, nothing to do.
// because #11515 for non-docker runtimes, we gotta ensure Docker is disabled and can not just check if it is not active
// since it is enabled by default in the current base image and it keeps coming back to life
if me.Name() == "Docker" && !r.Active() {
medyagh marked this conversation as resolved.
Show resolved Hide resolved
continue
}

Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (r *Docker) Restart() error {

// Disable idempotently disables Docker on a host
func (r *Docker) Disable() error {
klog.Info("disabling docker service ...")
// because #10373
if err := r.Init.ForceStop("docker.socket"); err != nil {
klog.ErrorS(err, "Failed to stop", "service", "docker.socket")
Expand Down
6 changes: 6 additions & 0 deletions site/content/en/docs/contrib/errorcodes.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ minikube has no current cluster running

"DRV_NOT_DETECTED" (Exit code ExDriverNotFound)

"DRV_NOT_HEALTHY" (Exit code ExDriverNotFound)

"DRV_DOCKER_NOT_RUNNING" (Exit code ExDriverNotFound)

"DRV_AS_ROOT" (Exit code ExDriverPermission)

"DRV_NEEDS_ROOT" (Exit code ExDriverPermission)
Expand Down Expand Up @@ -329,6 +333,8 @@ minikube has no current cluster running

"GUEST_PROVISION" (Exit code ExGuestError)

"GUEST_PROVISION_CONTAINER_EXITED" (Exit code ExGuestError)

"GUEST_START" (Exit code ExGuestError)

"GUEST_STATUS" (Exit code ExGuestError)
Expand Down
3 changes: 3 additions & 0 deletions site/content/en/docs/contrib/tests.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ to check existence of the test file
#### validateCertSync
to check existence of the test certificate

#### validateNotActiveRuntimeDisabled
asserts that for a given runtime, the other runtimes disabled, for example for containerd runtime, docker and crio needs to be not running

#### validateUpdateContextCmd
asserts basic "update-context" command functionality

Expand Down
24 changes: 24 additions & 0 deletions test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func TestFunctional(t *testing.T) {
{"RemoveImage", validateRemoveImage},
{"BuildImage", validateBuildImage},
{"ListImages", validateListImages},
{"NonActiveRuntimeDisabled", validateNotActiveRuntimeDisabled},
}
for _, tc := range tests {
tc := tc
Expand Down Expand Up @@ -1663,6 +1664,29 @@ func validateCertSync(ctx context.Context, t *testing.T, profile string) {
}
}

// validateNotActiveRuntimeDisabled asserts that for a given runtime, the other runtimes disabled, for example for containerd runtime, docker and crio needs to be not running
func validateNotActiveRuntimeDisabled(ctx context.Context, t *testing.T, profile string) {
disableMap := map[string][]string{
"docker": {"crio"},
"containerd": {"docker", "crio"},
"crio": {"docker", "containerd"},
}

expectDisable := disableMap[ContainerRuntime()]
for _, cr := range expectDisable {
// for example: minikube sudo systemctl is-active docker
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", fmt.Sprintf("sudo systemctl is-active %s", cr)))
medyagh marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
t.Logf("output of %s: %v", rr.Output(), err)
ilya-zuyev marked this conversation as resolved.
Show resolved Hide resolved
}
got := rr.Stdout.String()
if !strings.Contains(got, "inactive") {
t.Errorf("For runtime %q: expected %q to be inactive but got %q ", ContainerRuntime(), cr, got)
}

}
}

// validateUpdateContextCmd asserts basic "update-context" command functionality
func validateUpdateContextCmd(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)
Expand Down
4 changes: 3 additions & 1 deletion translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "",
Expand Down Expand Up @@ -226,7 +227,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "Fehler beim Ändern der Berechtigungen für {{.minikube_dir_path}}: {{.error}}",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -274,6 +274,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "minikube zwingen, möglicherweise gefährliche Operationen durchzuführen",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "Gefundene Netzwerkoptionen:",
"Found {{.number}} invalid profile(s) ! ": "",
"Generate command completion for a shell": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "Docker Desktop necesita estar configurado para contenedores Linux para poder usar minikube",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "Docker Desktop tiene solo {{.size}}MiB disponibles, menos que los {{.req}}MiB requeridos por Kubernetes",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "Docker Desktop tiene solo {{.size}}MiB disponibles, puede que encuentres fallas en tus deployments de aplicaciones",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "Docker tiene menos de 2 CPUs disponibles, pero Kubernetes requiere al menos 2 para estar disponible",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "No está disponible Docker dentro de la VM. Intenta usar 'minikube delete' para reestablecer la VM.",
"Docs have been saved at - {{.path}}": "La documentación ha sido guardada en - {{.path}}",
Expand Down Expand Up @@ -231,7 +232,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "No se han podido cambiar los permisos de {{.minikube_dir_path}}: {{.error}}",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -279,6 +279,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "Permite forzar minikube para que realice operaciones potencialmente peligrosas",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "Se han encontrado las siguientes opciones de red:",
"Found {{.number}} invalid profile(s) ! ": "",
"Generate command completion for a shell": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "",
Expand Down Expand Up @@ -228,7 +229,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "Échec de la modification des autorisations pour {{.minikube_dir_path}} : {{.error}}",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -276,6 +276,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "Oblige minikube à réaliser des opérations possiblement dangereuses.",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "Options de réseau trouvées :",
"Found {{.number}} invalid profile(s) ! ": "",
"Generate command completion for a shell": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "ドキュメントは以下のパスに保存されました。{{.path}}",
Expand Down Expand Up @@ -218,7 +219,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "{{.minikube_dir_path}} に対する権限を変更できませんでした。{{.error}}",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "クラスタを削除できませんでしたが、処理を続行します。",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -264,6 +264,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "minikube で危険な可能性のある操作を強制的に実行します",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "ネットワーク オプションが見つかりました",
"Found {{.number}} invalid profile(s) ! ": "",
"Generate command completion for a shell": "シェルのコマンド補完コードを生成します",
Expand Down
4 changes: 3 additions & 1 deletion translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "문서가 다음 경로에 저장되었습니다 - {{.path}}",
Expand Down Expand Up @@ -246,7 +247,6 @@
"Failed to check if machine exists": "머신이 존재하는지 확인하는 데 실패하였습니다",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -296,6 +296,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "네트워크 옵션을 찾았습니다",
"Found {{.number}} invalid profile(s) !": "{{.number}} 개의 무효한 프로필을 찾았습니다",
"Found {{.number}} invalid profile(s) ! ": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "Dokumentacja została zapisana w {{.path}}",
Expand Down Expand Up @@ -236,7 +237,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "Nie udało się zmienić uprawnień pliku {{.minikube_dir_path}}: {{.error}}",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -283,6 +283,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "Wymuś wykonanie potencjalnie niebezpiecznych operacji",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "Wykryto opcje sieciowe:",
"Found {{.number}} invalid profile(s) !": "Wykryto {{.number}} nieprawidłowych profili ! ",
"Found {{.number}} invalid profile(s) ! ": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "",
"Docs have been saved at - {{.path}}": "",
Expand Down Expand Up @@ -212,7 +213,6 @@
"Failed to change permissions for {{.minikube_dir_path}}: {{.error}}": "",
"Failed to check main repository and mirrors for images": "",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -255,6 +255,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "",
"Force minikube to perform possibly dangerous operations": "",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "",
"Found {{.number}} invalid profile(s) ! ": "",
"Generate command completion for a shell": "",
Expand Down
4 changes: 3 additions & 1 deletion translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"Docker Desktop is configured for Windows containers, but Linux containers are required for minikube": "",
"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes": "",
"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.": "",
"Docker container exited prematurely after it was created, consider investigating Docker's performance/health.": "",
"Docker has less than 2 CPUs available, but Kubernetes requires at least 2 to be available": "",
"Docker inside the VM is unavailable. Try running 'minikube delete' to reset the VM.": "虚拟机中的 Docker 不可用,尝试运行 'minikube delete' 来重置虚拟机。",
"Docs have been saved at - {{.path}}": "文档已保存在 - {{.path}}",
Expand Down Expand Up @@ -294,7 +295,6 @@
"Failed to check main repository and mirrors for images": "",
"Failed to check main repository and mirrors for images for images": "无法检测主仓库和镜像仓库中的镜像",
"Failed to configure metallb IP {{.profile}}": "",
"Failed to copying file": "",
"Failed to create file": "",
"Failed to delete cluster {{.name}}, proceeding with retry anyway.": "",
"Failed to delete cluster {{.name}}.": "",
Expand Down Expand Up @@ -348,6 +348,8 @@
"Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect": "强制为指定的 shell 配置环境:[fish, cmd, powershell, tcsh, bash, zsh],默认为 auto-detect",
"Force minikube to perform possibly dangerous operations": "强制 minikube 执行可能有风险的操作",
"Format to print stdout in. Options include: [text,json]": "",
"Found docker, but the docker service isn't running. Try restarting the docker service.": "",
"Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.": "",
"Found network options:": "找到的网络选项:",
"Found {{.number}} invalid profile(s) !": "找到 {{.number}} 个无效的配置文件!",
"Found {{.number}} invalid profile(s) ! ": "",
Expand Down