code: func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) {
  	if len(pod.Labels) == 0 {
  		return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name)
  	}
  
  	list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything())
  	if err != nil {
  		return nil, err
  	}
  
  	var rss []*apps.ReplicaSet
  	for _, rs := range list {
  		if rs.Namespace != pod.Namespace {
  			continue
  		}
  		selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector)
  		if err != nil {
  			return nil, fmt.Errorf("invalid selector: %v", err)
  		}
  
  		// If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything.
  		if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
  			continue
  		}
  		rss = append(rss, rs)
  	}
  
  	if len(rss) == 0 {
  		return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
  	}
  
  	return rss, nil
  }
docs: // GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod.
  // Only the one specified in the Pod's ControllerRef will actually manage it.
  // Returns an error only if no matching ReplicaSets are found.