Add warning if disk image is missing features

pull/6978/head
Thomas Stromberg 2020-03-10 07:39:42 -07:00
parent 4f5c882ca4
commit a470d1cf9a
2 changed files with 21 additions and 2 deletions

View File

@ -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
@ -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

View File

@ -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)
}