Merge pull request #118 from janetkuo/remove-hostpath

Remove hostPath and print warnings
This commit is contained in:
Janet Kuo 2016-08-23 22:19:04 -07:00 committed by GitHub
commit 9c03ae9cf4
2 changed files with 3 additions and 5 deletions

View File

@ -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})
}

View File

@ -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