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

preload: improve solution message when there is no space left on device #9316

Merged
merged 8 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
21 changes: 11 additions & 10 deletions cmd/minikube/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const (
Irrelevant = "Irrelevant"

// New status modes, based roughly on HTTP/SMTP standards
InsufficientStorage = reason.ExInsufficientStorage

// 1xx signifies a transitional state. If retried, it will soon return a 2xx, 4xx, or 5xx
Starting = 100
Pausing = 101
Expand All @@ -84,18 +86,18 @@ const (
Paused = 418 // I'm a teapot!

// 5xx signifies a server-side error (that may be retryable)
Error = 500
InsufficientStorage = 507
Unknown = 520
Error = 500
Unknown = 520
)

var (
codeNames = map[int]string{
100: "Starting",
101: "Pausing",
102: "Unpausing",
110: "Stopping",
103: "Deleting",
reason.ExInsufficientStorage: "InsufficientStorage",
100: "Starting",
101: "Pausing",
102: "Unpausing",
110: "Stopping",
103: "Deleting",

200: "OK",
203: "Warning",
Expand All @@ -105,12 +107,11 @@ var (
418: "Paused",

500: "Error",
507: "InsufficientStorage",
520: "Unknown",
}

codeDetails = map[int]string{
507: "/var is almost out of disk space",
reason.ExInsufficientStorage: "/var is almost out of disk space",
}
)

Expand Down
5 changes: 5 additions & 0 deletions pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import (
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
"k8s.io/minikube/pkg/minikube/download"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/sysinit"
"k8s.io/minikube/pkg/util/retry"
)
Expand Down Expand Up @@ -134,6 +136,9 @@ func (d *Driver) Create() error {
glog.Infof("Starting extracting preloaded images to volume ...")
// Extract preloaded images to container
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, d.NodeConfig.ImageDigest); err != nil {
if strings.Contains(err.Error(), "No space left on device") {
exit.Message(reason.RsrcInsufficientDockerStorage, "preload extraction failed: \"No space left on device\"")
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
}
glog.Infof("Unable to extract preloaded tarball to volume: %v", err)
} else {
glog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
Expand Down
3 changes: 2 additions & 1 deletion test/integration/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/minikube/cmd/minikube/cmd"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/reason"
)

func TestInsufficientStorage(t *testing.T) {
Expand Down Expand Up @@ -84,7 +85,7 @@ func verifyClusterState(t *testing.T, contents []byte) {
t.Fatalf("unmarshalling: %v", err)
}
// verify the status looks as we expect
if cs.StatusCode != cmd.InsufficientStorage {
if cs.StatusCode != reason.ExInsufficientStorage {
t.Fatalf("incorrect status code: %v", cs.StatusCode)
}
if cs.StatusName != "InsufficientStorage" {
Expand Down