From e1e355ccfeccf23591d708d9eb0f9854a5fe6af1 Mon Sep 17 00:00:00 2001 From: elasticdotventures Date: Thu, 7 Aug 2025 06:46:56 +0000 Subject: [PATCH] refactor: address reviewer feedback by removing podman binary detection --- cmd/minikube/cmd/podman-env.go | 20 +++++--------------- cmd/minikube/cmd/podman-env_test.go | 4 ++-- site/content/en/docs/commands/podman-env.md | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/cmd/minikube/cmd/podman-env.go b/cmd/minikube/cmd/podman-env.go index 819af7680f..a860aa808b 100644 --- a/cmd/minikube/cmd/podman-env.go +++ b/cmd/minikube/cmd/podman-env.go @@ -70,7 +70,7 @@ var podmanUnset bool // podmanShellCfgSet generates context variables for "podman-env" func podmanShellCfgSet(ec PodmanEnvConfig, envMap map[string]string) *PodmanShellConfig { profile := ec.profile - const usgPlz = "To point your shell to minikube's podman docker-compatible service, run:" + const usgPlz = "To point your shell to minikube's Podman Docker-compatible service, run:" usgCmd := fmt.Sprintf("minikube -p %s podman-env", profile) s := &PodmanShellConfig{ Config: *shell.CfgSet(ec.EnvConfig, usgPlz, usgCmd), @@ -86,20 +86,13 @@ func podmanShellCfgSet(ec PodmanEnvConfig, envMap map[string]string) *PodmanShel return s } -// isPodmanAvailable checks if podman command is available -func isPodmanAvailable(r command.Runner) bool { - if _, err := r.RunCmd(exec.Command("which", "podman")); err != nil { - return false - } - - return true -} // podmanEnvCmd represents the podman-env command var podmanEnvCmd = &cobra.Command{ Use: "podman-env", - Short: "Configure environment to use minikube's Podman service", - Long: `Sets up Docker client env variables to use minikube's Podman Docker-compatible service.`, + Short: "Configure environment to use minikube's Podman Docker-compatible service", + Long: `Sets up Docker client env variables to use minikube's Podman Docker-compatible service. +Uses Docker client against Podman's Docker API compatibility - no podman binary required.`, Run: func(_ *cobra.Command, _ []string) { sh := shell.EnvConfig{ Shell: shell.ForceShell, @@ -136,14 +129,11 @@ var podmanEnvCmd = &cobra.Command{ } r := co.CP.Runner - if ok := isPodmanAvailable(r); !ok { - exit.Message(reason.EnvPodmanUnavailable, `The podman service within '{{.cluster}}' is not active`, out.V{"cluster": cname}) - } d := co.CP.Host.Driver hostIP := co.CP.IP.String() - // Use Docker API compatibility - podman supports Docker API on port 2376 + // Use Docker API compatibility - Docker client connects to Docker-compatible API port := constants.DockerDaemonPort noProxy := false diff --git a/cmd/minikube/cmd/podman-env_test.go b/cmd/minikube/cmd/podman-env_test.go index c01b83e857..25c0d5156f 100644 --- a/cmd/minikube/cmd/podman-env_test.go +++ b/cmd/minikube/cmd/podman-env_test.go @@ -40,7 +40,7 @@ export DOCKER_TLS_VERIFY="1" export DOCKER_CERT_PATH="/certs" export MINIKUBE_ACTIVE_PODMAN="bash" -# To point your shell to minikube's podman docker-compatible service, run: +# To point your shell to minikube's Podman Docker-compatible service, run: # eval $(minikube -p bash podman-env) `, `unset DOCKER_HOST; @@ -58,7 +58,7 @@ export DOCKER_TLS_VERIFY="1" export DOCKER_CERT_PATH="/certs" export MINIKUBE_ACTIVE_PODMAN="bash" -# To point your shell to minikube's podman docker-compatible service, run: +# To point your shell to minikube's Podman Docker-compatible service, run: # eval $(minikube -p bash podman-env) `, `unset DOCKER_HOST; diff --git a/site/content/en/docs/commands/podman-env.md b/site/content/en/docs/commands/podman-env.md index d205066f3c..b540c4e2d7 100644 --- a/site/content/en/docs/commands/podman-env.md +++ b/site/content/en/docs/commands/podman-env.md @@ -6,7 +6,7 @@ description: > ## Requirements -- **Podman version 4.9.2 or newer is required.** +- **Recent Podman version with Docker API compatibility is required.** - **Docker client is required** - `podman-env` uses Docker's client to communicate with Podman's Docker-compatible API. - The `podman-env` command configures Docker client environment variables to connect to minikube's Podman service via its Docker-compatible API.