Skip to content

Commit 32922f4

Browse files
authored
Merge pull request #9412 from Asarew/fix-panic-on-updating-mount-after-creation
fix panic when updating mount-string with KiC driver after cluster creation without mount configuration
2 parents e573b92 + 93bbf4c commit 32922f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: cmd/minikube/cmd/start.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,15 @@ func runStart(cmd *cobra.Command, args []string) {
231231

232232
if existing != nil && driver.IsKIC(existing.Driver) {
233233
if viper.GetBool(createMount) {
234-
mount := viper.GetString(mountString)
235-
if len(existing.ContainerVolumeMounts) != 1 || existing.ContainerVolumeMounts[0] != mount {
234+
old := ""
235+
if len(existing.ContainerVolumeMounts) > 0 {
236+
old = existing.ContainerVolumeMounts[0]
237+
}
238+
if mount := viper.GetString(mountString); old != mount {
236239
exit.Message(reason.GuestMountConflict, "Sorry, {{.driver}} does not allow mounts to be changed after container creation (previous mount: '{{.old}}', new mount: '{{.new}})'", out.V{
237240
"driver": existing.Driver,
238241
"new": mount,
239-
"old": existing.ContainerVolumeMounts[0],
242+
"old": old,
240243
})
241244
}
242245
}

0 commit comments

Comments
 (0)