forked from LaconicNetwork/kompose
use empytDir rather then hostPath
On remote cluster or in cloud it can be tricky to get hostPath working as expected by compose
This commit is contained in:
parent
03877dfb60
commit
a97b413279
@ -453,8 +453,6 @@ func configVolumes(service ServiceConfig) ([]api.VolumeMount, []api.Volume) {
|
|||||||
for _, volume := range service.Volumes {
|
for _, volume := range service.Volumes {
|
||||||
character := ":"
|
character := ":"
|
||||||
if strings.Contains(volume, character) {
|
if strings.Contains(volume, character) {
|
||||||
hostDir := volume[0:strings.Index(volume, character)]
|
|
||||||
hostDir = strings.TrimSpace(hostDir)
|
|
||||||
containerDir := volume[strings.Index(volume, character)+1:]
|
containerDir := volume[strings.Index(volume, character)+1:]
|
||||||
containerDir = strings.TrimSpace(containerDir)
|
containerDir = strings.TrimSpace(containerDir)
|
||||||
|
|
||||||
@ -472,11 +470,10 @@ func configVolumes(service ServiceConfig) ([]api.VolumeMount, []api.Volume) {
|
|||||||
volumeName := RandStringBytes(20)
|
volumeName := RandStringBytes(20)
|
||||||
|
|
||||||
volumesMount = append(volumesMount, api.VolumeMount{Name: volumeName, ReadOnly: readonly, MountPath: containerDir})
|
volumesMount = append(volumesMount, api.VolumeMount{Name: volumeName, ReadOnly: readonly, MountPath: containerDir})
|
||||||
p := &api.HostPathVolumeSource{
|
|
||||||
Path: hostDir,
|
emptyDir := &api.EmptyDirVolumeSource{}
|
||||||
}
|
volumeSource := api.VolumeSource{EmptyDir: emptyDir}
|
||||||
//p.Path = hostDir
|
|
||||||
volumeSource := api.VolumeSource{HostPath: p}
|
|
||||||
volumes = append(volumes, api.Volume{Name: volumeName, VolumeSource: volumeSource})
|
volumes = append(volumes, api.Volume{Name: volumeName, VolumeSource: volumeSource})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user