// if we don't already have it append it and continue
origVolumeMounts[v.Name]=v
mergedVolumeMounts=append(mergedVolumeMounts,v)
}else{
// make sure they are identical or throw an error
// shall we throw an error for identical volumeMounts ?
if!reflect.DeepEqual(found,v){
errs=append(errs,fmt.Errorf("merging volume mounts for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container",pp.GetName(),v.Name,v,found))
}
}
found,ok=volumeMountsByPath[v.MountPath]
if!ok{
// if we don't already have it append it and continue
volumeMountsByPath[v.MountPath]=v
}else{
// make sure they are identical or throw an error
if!reflect.DeepEqual(found,v){
errs=append(errs,fmt.Errorf("merging volume mounts for %s has a conflict on mount path %s: \n%#v\ndoes not match\n%#v\n in container",pp.GetName(),v.MountPath,v,found))
}
}
}
}
err:=utilerrors.NewAggregate(errs)
iferr!=nil{
returnnil,err
}
returnmergedVolumeMounts,err
}
// mergeVolumes merges given list of Volumes with the volumes injected by given
// podPresets. It returns an error if it detects any conflict during the merge.