Fix nil pointer issue when making mounts for container

This commit is contained in:
xiangpengzhao 2016-12-17 03:35:56 -05:00
parent 9ba4a0effc
commit db97cba291

View File

@ -110,8 +110,8 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h
for _, mount := range container.VolumeMounts { for _, mount := range container.VolumeMounts {
mountEtcHostsFile = mountEtcHostsFile && (mount.MountPath != etcHostsPath) mountEtcHostsFile = mountEtcHostsFile && (mount.MountPath != etcHostsPath)
vol, ok := podVolumes[mount.Name] vol, ok := podVolumes[mount.Name]
if !ok { if !ok || vol.Mounter == nil {
glog.Warningf("Mount cannot be satisfied for container %q, because the volume is missing: %q", container.Name, mount) glog.Warningf("Mount cannot be satisfied for container %q, because the volume is missing or the volume mounter is nil: %q", container.Name, mount)
continue continue
} }