code: func mergeVolumes(volumes []api.Volume, podPresets []*settingsv1alpha1.PodPreset) ([]api.Volume, error) {
  	origVolumes := map[string]api.Volume{}
  	for _, v := range volumes {
  		origVolumes[v.Name] = v
  	}
  
  	mergedVolumes := make([]api.Volume, len(volumes))
  	copy(mergedVolumes, volumes)
  
  	var errs []error
  
  	for _, pp := range podPresets {
  		for _, v := range pp.Spec.Volumes {
  			internalVolume := api.Volume{}
  			if err := apiscorev1.Convert_v1_Volume_To_core_Volume(&v, &internalVolume, nil); err != nil {
  				return nil, err
  			}
  			found, ok := origVolumes[v.Name]
  			if !ok {
  				// if we don't already have it append it and continue
  				origVolumes[v.Name] = internalVolume
  				mergedVolumes = append(mergedVolumes, internalVolume)
  				continue
  			}
  
  			// make sure they are identical or throw an error
  			if !reflect.DeepEqual(found, internalVolume) {
  				errs = append(errs, fmt.Errorf("merging volumes for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.Name, v, found))
  			}
  		}
  	}
  
  	err := utilerrors.NewAggregate(errs)
  	if err != nil {
  		return nil, err
  	}
  
  	if len(mergedVolumes) == 0 {
  		return nil, nil
  	}
  
  	return mergedVolumes, err
  }
docs: // 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.