code: func GetAffinityFromPodAnnotations(annotations map[string]string) (Affinity, error) {
  	var affinity Affinity
  	if len(annotations) > 0 && annotations[AffinityAnnotationKey] != "" {
  		err := json.Unmarshal([]byte(annotations[AffinityAnnotationKey]), &affinity)
  		if err != nil {
  			return affinity, err
  		}
  	}
  	return affinity, nil
  }
docs: // GetAffinityFromPod gets the json serialized affinity data from Pod.Annotations
  // and converts it to the Affinity type in api.