code: func MakePayload(mappings []v1.KeyToPath, secret *v1.Secret, 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(secret.Data))
  	var fileProjection volumeutil.FileProjection
  
  	if len(mappings) == 0 {
  		for name, data := range secret.Data {
  			fileProjection.Data = []byte(data)
  			fileProjection.Mode = *defaultMode
  			payload[name] = fileProjection
  		}
  	} else {
  		for _, ktp := range mappings {
  			content, ok := secret.Data[ktp.Key]
  			if !ok {
  				if optional {
  					continue
  				}
  				errMsg := fmt.Sprintf("references non-existent secret key: %s", ktp.Key)
  				klog.Errorf(errMsg)
  				return nil, fmt.Errorf(errMsg)
  			}
  
  			fileProjection.Data = []byte(content)
  			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