fixed unwanted spinning up of mount deamon when using KIC drivers, and added same host mounted volumes logic for the Podman driver

pull/8159/head
Asare Worae 2020-07-23 11:47:16 +02:00
parent 52e19e1bc9
commit a31e359b01
5 changed files with 18 additions and 6 deletions

View File

@ -323,8 +323,8 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
},
}
cc.VerifyComponents = interpretWaitFlag(*cmd)
if viper.GetBool(createMount) {
cc.VolumeMounts = []string{viper.GetString(mountString)}
if viper.GetBool(createMount) && driver.IsKIC(drvName) {
cc.ContainerVolumeMounts = []string{viper.GetString(mountString)}
}
cnm, err := cni.New(cc)
if err != nil {

View File

@ -43,7 +43,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.
VolumeMounts []string
ContainerVolumeMounts []string // Only used by container drivers: Docker, Podman
InsecureRegistry []string
RegistryMirror []string
HostOnlyCIDR string // Only used by the virtualbox driver

View File

@ -133,7 +133,9 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
}
var wg sync.WaitGroup
go configureMounts(&wg)
if !driver.IsKIC(starter.Cfg.Driver) {
go configureMounts(&wg)
}
wg.Add(1)
go func() {

View File

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

View File

@ -59,10 +59,20 @@ func init() {
}
func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
mounts := make([]oci.Mount, len(cc.ContainerVolumeMounts))
for i, spec := range cc.ContainerVolumeMounts {
var err error
mounts[i], err = oci.ParseMountString(spec)
if err != nil {
return nil, err
}
}
return kic.NewDriver(kic.Config{
MachineName: driver.MachineName(cc, n),
StorePath: localpath.MiniPath(),
ImageDigest: strings.Split(cc.KicBaseImage, "@")[0], // for podman does not support docker images references with both a tag and digest.
Mounts: mounts,
CPU: cc.CPUs,
Memory: cc.Memory,
OCIBinary: oci.Podman,