Merge pull request #9239 from afbjorklund/podman-storage

Add podman storage warning to match docker
pull/9267/head
Medya Ghazizadeh 2020-09-16 14:53:56 -07:00 committed by GitHub
commit dc0b1aaa3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View File

@ -36,6 +36,7 @@ import (
"github.com/juju/mutex"
"github.com/pkg/errors"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
@ -218,17 +219,32 @@ func postStartValidations(h *host.Host, drvName string) {
glog.Warningf("error getting command runner: %v", err)
}
var kind reason.Kind
var name string
if drvName == oci.Docker {
kind = reason.RsrcInsufficientDockerStorage
name = "Docker"
}
if drvName == oci.Podman {
kind = reason.RsrcInsufficientPodmanStorage
name = "Podman"
}
if name == "" {
glog.Warningf("unknown KIC driver: %v", drvName)
return
}
// make sure /var isn't full, as pod deployments will fail if it is
percentageFull, err := DiskUsed(r, "/var")
if err != nil {
glog.Warningf("error getting percentage of /var that is free: %v", err)
}
if percentageFull >= 99 {
exit.Message(reason.RsrcInsufficientDockerStorage, `Docker is out of disk space! (/var is at {{.p}}% of capacity)`, out.V{"p": percentageFull})
exit.Message(kind, `{{.n}} is out of disk space! (/var is at {{.p}}% of capacity)`, out.V{"n": name, "p": percentageFull})
}
if percentageFull >= 85 {
out.WarnReason(reason.RsrcInsufficientDockerStorage, `Docker is nearly out of disk space, which may cause deployments to fail! ({{.p}}% of capacity)`, out.V{"p": percentageFull})
out.WarnReason(kind, `{{.n}} is nearly out of disk space, which may cause deployments to fail! ({{.p}}% of capacity)`, out.V{"n": name, "p": percentageFull})
}
}

View File

@ -176,6 +176,15 @@ var (
3. Run "minikube ssh -- docker system prune" if using the docker container runtime`,
Issues: []int{9024},
}
RsrcInsufficientPodmanStorage = Kind{
ID: "RSRC_PODMAN_STORAGE",
ExitCode: ExInsufficientStorage,
Advice: `Try at least one of the following to free up space on the device:
1. Run "sudo podman system prune" to remove unused podman data
2. Run "minikube ssh -- docker system prune" if using the docker container runtime`,
Issues: []int{9024},
}
RsrcInsufficientStorage = Kind{ID: "RSRC_INSUFFICIENT_STORAGE", ExitCode: ExInsufficientStorage, Style: style.UnmetRequirement}