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

Issue #2416 keep ip address on restart using vm-driver hyperkit #2417

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
2 changes: 2 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const (
mountString = "mount-string"
disableDriverMounts = "disable-driver-mounts"
cacheImages = "cache-images"
uuid = "uuid"
)

var (
Expand Down Expand Up @@ -143,6 +144,7 @@ func runStart(cmd *cobra.Command, args []string) {
KvmNetwork: viper.GetString(kvmNetwork),
Downloader: pkgutil.DefaultDownloader{},
DisableDriverMounts: viper.GetBool(disableDriverMounts),
UUID: viper.GetString(uuid),
}

fmt.Printf("Starting local Kubernetes %s cluster...\n", viper.GetString(kubernetesVersion))
Expand Down
7 changes: 3 additions & 4 deletions pkg/drivers/hyperkit/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"github.com/docker/machine/libmachine/state"
nfsexports "github.com/johanneswuerbach/nfsexports"
hyperkit "github.com/moby/hyperkit/go"
"github.com/pborman/uuid"
"github.com/pkg/errors"
pkgdrivers "k8s.io/minikube/pkg/drivers"
commonutil "k8s.io/minikube/pkg/util"
Expand All @@ -59,6 +58,7 @@ type Driver struct {
Cmdline string
NFSShares []string
NFSSharesRoot string
UUID string
}

func NewDriver(hostName, storePath string) *Driver {
Expand Down Expand Up @@ -177,10 +177,9 @@ func (d *Driver) Start() error {
h.Console = hyperkit.ConsoleFile
h.CPUs = d.CPU
h.Memory = d.Memory
h.UUID = d.UUID

// Set UUID
h.UUID = uuid.NewUUID().String()
log.Infof("Generated UUID %s", h.UUID)
log.Infof("Using UUID %s", h.UUID)
mac, err := GetMACAddressFromUUID(h.UUID)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/cluster/cluster_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/docker/machine/drivers/vmwarefusion"
"github.com/docker/machine/libmachine/drivers"
"github.com/pborman/uuid"
"k8s.io/minikube/pkg/drivers/hyperkit"
cfg "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
Expand Down Expand Up @@ -71,6 +72,7 @@ func createHyperkitHost(config MachineConfig) *hyperkit.Driver {
CPU: config.CPUs,
NFSShares: config.NFSShare,
NFSSharesRoot: config.NFSSharesRoot,
UUID: uuid.NewUUID().String(),
Cmdline: "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=" + cfg.GetMachineName(),
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/cluster/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type MachineConfig struct {
DisableDriverMounts bool // Only used by virtualbox and xhyve
NFSShare []string
NFSSharesRoot string
UUID string // Only used by hyperkit to restore the mac address
}

// Config contains machine and k8s config
Expand Down