code: func (dc *DeploymentController) getDeploymentForPod(pod *v1.Pod) *apps.Deployment {
  	// Find the owning replica set
  	var rs *apps.ReplicaSet
  	var err error
  	controllerRef := metav1.GetControllerOf(pod)
  	if controllerRef == nil {
  		// No controller owns this Pod.
  		return nil
  	}
  	if controllerRef.Kind != apps.SchemeGroupVersion.WithKind("ReplicaSet").Kind {
  		// Not a pod owned by a replica set.
  		return nil
  	}
  	rs, err = dc.rsLister.ReplicaSets(pod.Namespace).Get(controllerRef.Name)
  	if err != nil || rs.UID != controllerRef.UID {
  		klog.V(4).Infof("Cannot get replicaset %q for pod %q: %v", controllerRef.Name, pod.Name, err)
  		return nil
  	}
  
  	// Now find the Deployment that owns that ReplicaSet.
  	controllerRef = metav1.GetControllerOf(rs)
  	if controllerRef == nil {
  		return nil
  	}
  	return dc.resolveControllerRef(rs.Namespace, controllerRef)
  }
docs: // getDeploymentForPod returns the deployment managing the given Pod.