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

Add warning if disk image is missing features #6978

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ import (
// KubernetesContainerPrefix is the prefix of each kubernetes container
const KubernetesContainerPrefix = "k8s_"

type ErrISOFeature struct {
missing string
}

func NewErrISOFeature(missing string) *ErrISOFeature {
return &ErrISOFeature{
missing: missing,
}
}
func (e *ErrISOFeature) Error() string {
return e.missing
}

// Docker contains Docker runtime state
type Docker struct {
Socket string
Expand Down Expand Up @@ -278,7 +291,7 @@ func (r *Docker) Preload(k8sVersion string) error {

c := exec.Command("which", "lz4")
if _, err := r.Runner.RunCmd(c); err != nil {
return errors.Wrapf(err, "check lz4 available.")
return NewErrISOFeature("lz4")
}

// Copy over tarball into host
Expand Down
8 changes: 7 additions & 1 deletion pkg/minikube/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ func configureRuntimes(runner cruntime.CommandRunner, drvName string, k8s config
}
if !driver.IsKIC(drvName) {
if err := cr.Preload(k8s.KubernetesVersion); err != nil {
glog.Errorf("Failed to preload container runtime %s: %v, falling back to caching images", cr.Name(), err)
switch err.(type) {
case *cruntime.ErrISOFeature:
out.T(out.Tip, "Existing disk is missing new features ({{.error}}). To upgrade, run 'minikube delete'", out.V{"error": err})
default:
glog.Warningf("%s preload failed: %v, falling back to caching images", cr.Name(), err)
}

if err := machine.CacheImagesForBootstrapper(k8s.ImageRepository, k8s.KubernetesVersion, viper.GetString(cmdcfg.Bootstrapper)); err != nil {
exit.WithError("Failed to cache images", err)
}
Expand Down