forked from LaconicNetwork/kompose
Merge pull request #118 from janetkuo/remove-hostpath
Remove hostPath and print warnings
This commit is contained in:
commit
9c03ae9cf4
@ -192,10 +192,9 @@ func ConfigVolumes(service kobject.ServiceConfig) ([]api.VolumeMount, []api.Volu
|
||||
volumesMount = append(volumesMount, api.VolumeMount{Name: name, ReadOnly: readonly, MountPath: container})
|
||||
|
||||
if len(host) > 0 {
|
||||
volumeSource = api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: host}}
|
||||
} else {
|
||||
volumeSource = api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}
|
||||
logrus.Warningf("Volume mount on the host %q isn't supported - ignoring path on the host", host)
|
||||
}
|
||||
volumeSource = api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}
|
||||
|
||||
volumes = append(volumes, api.Volume{Name: name, VolumeSource: volumeSource})
|
||||
}
|
||||
|
||||
@ -153,8 +153,7 @@ func checkPodTemplate(config kobject.ServiceConfig, template api.PodTemplateSpec
|
||||
if !equalStringSlice(config.Args, container.Args) {
|
||||
return fmt.Errorf("Found different container args: %#v vs. %#v", config.Args, container.Args)
|
||||
}
|
||||
if len(template.Spec.Volumes) == 0 || len(template.Spec.Volumes[0].Name) == 0 ||
|
||||
(template.Spec.Volumes[0].VolumeSource.HostPath == nil && template.Spec.Volumes[0].VolumeSource.EmptyDir == nil) {
|
||||
if len(template.Spec.Volumes) == 0 || len(template.Spec.Volumes[0].Name) == 0 || template.Spec.Volumes[0].VolumeSource.EmptyDir == nil {
|
||||
return fmt.Errorf("Found incorrect volumes: %v vs. %#v", config.Volumes, template.Spec.Volumes)
|
||||
}
|
||||
// We only set controller labels here and k8s server will take care of other defaults, such as selectors
|
||||
|
||||
Loading…
Reference in New Issue
Block a user