Skip to content

Commit

Permalink
The podman driver should not be run as root
Browse files Browse the repository at this point in the history
Use sudo for the podman commands instead
  • Loading branch information
afbjorklund committed Apr 13, 2020
1 parent d734118 commit c70c085
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion hack/jenkins/linux_integration_tests_podman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ JOB_NAME="Podman_Linux"

mkdir -p cron && gsutil -qm rsync "gs://minikube-builds/${MINIKUBE_LOCATION}/cron" cron || echo "FAILED TO GET CRON FILES"
sudo install cron/cleanup_and_reboot_Linux.sh /etc/cron.hourly/cleanup_and_reboot || echo "FAILED TO INSTALL CLEANUP"
SUDO_PREFIX="sudo -E "

EXTRA_ARGS="--container-runtime=containerd"

Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/kic/oci/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func dockerSystemInfo() (dockerSysInfo, error) {
// podmanSysInfo returns podman system info --format '{{json .}}'
func podmanSystemInfo() (podmanSysInfo, error) {
var ps podmanSysInfo
cmd := exec.Command(Podman, "system", "info", "--format", "'{{json .}}'")
cmd := exec.Command("sudo", Podman, "system", "info", "--format", "'{{json .}}'")
out, err := cmd.CombinedOutput()
if err != nil {
return ps, errors.Wrap(err, "get podman system info")
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func BareMetal(name string) bool {

// NeedsRoot returns true if driver needs to run with root privileges
func NeedsRoot(name string) bool {
return name == None || name == Podman
return name == None
}

// NeedsPortForward returns true if driver is unable provide direct IP connectivity
Expand Down
4 changes: 2 additions & 2 deletions pkg/minikube/registry/drvs/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func status() registry.State {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

cmd := exec.CommandContext(ctx, oci.Podman, "version", "-f", "{{.Version}}")
cmd := exec.CommandContext(ctx, "sudo", oci.Podman, "version", "-f", "{{.Version}}")
o, err := cmd.CombinedOutput()
output := string(o)
if err != nil {
Expand All @@ -89,7 +89,7 @@ func status() registry.State {
// Allow no more than 3 seconds for querying state
ctx, cancel = context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
err = exec.CommandContext(ctx, oci.Podman, "info").Run()
err = exec.CommandContext(ctx, "sudo", oci.Podman, "info").Run()
if err != nil {
return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Podman is not running or taking too long to respond. Try: restarting podman."}
}
Expand Down

0 comments on commit c70c085

Please sign in to comment.