Skip to content
Open
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
23 changes: 23 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ func runStart(cmd *cobra.Command, _ []string) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of warnining, we should merge the
--mount
and
--mount-string flags into

--mount

and if ppl enter --mount true --mount-string /blahblah:/blahblah

we could still support it
with good unit testing we could just transition into "--mount " flag without breaking old syntax users

validateBuiltImageVersion(starter.Runner, ds.Name)

if viper.GetBool(createMount) {
warnAboutMountFlag()
}

if existing != nil && driver.IsKIC(existing.Driver) && viper.GetString(mountString) != "" {
old := ""
if len(existing.ContainerVolumeMounts) > 0 {
Expand Down Expand Up @@ -2099,3 +2103,22 @@ func startNerdctld() {
exit.Error(reason.StartNerdctld, fmt.Sprintf("Failed to set up DOCKER_HOST: %s", rest.Output()), err)
}
}

func warnAboutMountFlag() {
homeDir, err := os.UserHomeDir()
if err != nil {
out.WarningT("Failed to get home directory: {{.err}}", out.V{"err": err})
}

// Detect usage of --mount without --mount-string
if viper.Get(mountString) == "" {
out.WarningT("The --mount flag is ignored.")
out.Styled(style.Tip, "To mount a host folder, please use the --mount-string flag.")
out.Styled(style.Option, "Example: minikube start --mount-string=\"{{.home}}/shared:/mnt/shared\"", out.V{"home": homeDir})
}

// Detect usage of --mount with --mount-string
if viper.Get(mountString) != "" {
out.WarningT("The --mount flag is ignored when --mount-string is specified and is not needed.")
}
}