code: func MakePayload(mappings []v1.KeyToPath, configMap *v1.ConfigMap, defaultMode *int32, optional bool) (map[string]volumeutil.FileProjection, error) {
  	if defaultMode == nil {
  		return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
  	}
  
  	payload := make(map[string]volumeutil.FileProjection, (len(configMap.Data) + len(configMap.BinaryData)))
  	var fileProjection volumeutil.FileProjection
  
  	if len(mappings) == 0 {
  		for name, data := range configMap.Data {
  			fileProjection.Data = []byte(data)
  			fileProjection.Mode = *defaultMode
  			payload[name] = fileProjection
  		}
  		for name, data := range configMap.BinaryData {
  			fileProjection.Data = data
  			fileProjection.Mode = *defaultMode
  			payload[name] = fileProjection
  		}
  	} else {
  		for _, ktp := range mappings {
  			if stringData, ok := configMap.Data[ktp.Key]; ok {
  				fileProjection.Data = []byte(stringData)
  			} else if binaryData, ok := configMap.BinaryData[ktp.Key]; ok {
  				fileProjection.Data = binaryData
  			} else {
  				if optional {
  					continue
  				}
  				return nil, fmt.Errorf("configmap references non-existent config key: %s", ktp.Key)
  			}
  
  			if ktp.Mode != nil {
  				fileProjection.Mode = *ktp.Mode
  			} else {
  				fileProjection.Mode = *defaultMode
  			}
  			payload[ktp.Path] = fileProjection
  		}
  	}
  
  	return payload, nil
  }
docs: // MakePayload function is exported so that it can be called from the projection volume driver