changed `--docker-volume` flag logic to work from `--mount-string` and `--mount` flags

pull/8159/head
Asare Worae 2020-06-25 09:16:04 +02:00
parent 59de926bf1
commit 134ec1b144
3 changed files with 6 additions and 8 deletions

View File

@ -101,7 +101,6 @@ const (
deleteOnFailure = "delete-on-failure"
forceSystemd = "force-systemd"
kicBaseImage = "base-image"
dockerVolume = "docker-volume"
)
// initMinikubeFlags includes commandline flags for minikube.
@ -191,9 +190,6 @@ func initDriverFlags() {
startCmd.Flags().String(hypervVirtualSwitch, "", "The hyperv virtual switch name. Defaults to first found. (hyperv driver only)")
startCmd.Flags().Bool(hypervUseExternalSwitch, false, "Whether to use external switch over Default Switch if virtual switch not explicitly specified. (hyperv driver only)")
startCmd.Flags().String(hypervExternalAdapter, "", "External Adapter on which external switch will be created if no external switch is found. (hyperv driver only)")
// docker
startCmd.Flags().StringSlice(dockerVolume, []string{}, "Volumes to mount from host into the minikube container on start. (format: [host-src:]container-dest[:<options>], the comma-delimited options are [rw|ro], [Z], [srhared|rslave|rprivate]) (docker driver only)")
}
// initNetworkingFlags inits the commandline flags for connectivity related flags for start
@ -300,7 +296,6 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
DockerOpt: config.DockerOpt,
InsecureRegistry: insecureRegistry,
RegistryMirror: registryMirror,
DockerVolume: viper.GetStringSlice(dockerVolume),
HostOnlyCIDR: viper.GetString(hostOnlyCIDR),
HypervVirtualSwitch: viper.GetString(hypervVirtualSwitch),
HypervUseExternalSwitch: viper.GetBool(hypervUseExternalSwitch),
@ -336,6 +331,9 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
},
}
cc.VerifyComponents = interpretWaitFlag(*cmd)
if viper.GetBool(createMount) {
cc.VolumeMounts = []string{viper.GetString(mountString)}
}
}
r, err := cruntime.New(cruntime.Config{Type: cc.KubernetesConfig.ContainerRuntime})

View File

@ -51,7 +51,7 @@ type ClusterConfig struct {
HyperkitVpnKitSock string // Only used by the Hyperkit driver
HyperkitVSockPorts []string // Only used by the Hyperkit driver
DockerEnv []string // Each entry is formatted as KEY=VALUE.
DockerVolume []string
VolumeMounts []string
InsecureRegistry []string
RegistryMirror []string
HostOnlyCIDR string // Only used by the virtualbox driver

View File

@ -56,8 +56,8 @@ func init() {
}
func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
mounts := make([]oci.Mount, len(cc.DockerVolume))
for i, spec := range cc.DockerVolume {
mounts := make([]oci.Mount, len(cc.VolumeMounts))
for i, spec := range cc.VolumeMounts {
var err error
mounts[i], err = oci.ParseMountString(spec)
if err != nil {