Merge pull request #50008 from atlassian/meta-controller-ref

Automatic merge from submit-queue

Migrate to controller references helpers in meta/v1

**What this PR does / why we need it**:
This is a follow up for #48319 that migrates all method usages to new methods in meta/v1.

**Special notes for your reviewer**:
Looking at each commit individually might be easier.

**Release note**:
```release-note
NONE
```
/sig api-machinery
/kind cleanup
This commit is contained in:
Kubernetes Submit Queue
2017-08-10 17:07:30 -07:00
committed by GitHub
38 changed files with 93 additions and 212 deletions

View File

@@ -205,7 +205,7 @@ func (dc *DeploymentController) addReplicaSet(obj interface{}) {
}
// If it has a ControllerRef, that's all that matters.
if controllerRef := controller.GetControllerOf(rs); controllerRef != nil {
if controllerRef := metav1.GetControllerOf(rs); controllerRef != nil {
d := dc.resolveControllerRef(rs.Namespace, controllerRef)
if d == nil {
return
@@ -260,8 +260,8 @@ func (dc *DeploymentController) updateReplicaSet(old, cur interface{}) {
return
}
curControllerRef := controller.GetControllerOf(curRS)
oldControllerRef := controller.GetControllerOf(oldRS)
curControllerRef := metav1.GetControllerOf(curRS)
oldControllerRef := metav1.GetControllerOf(oldRS)
controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef)
if controllerRefChanged && oldControllerRef != nil {
// The ControllerRef was changed. Sync the old controller, if any.
@@ -319,7 +319,7 @@ func (dc *DeploymentController) deleteReplicaSet(obj interface{}) {
}
}
controllerRef := controller.GetControllerOf(rs)
controllerRef := metav1.GetControllerOf(rs)
if controllerRef == nil {
// No controller should care about orphans being deleted.
return
@@ -409,7 +409,7 @@ func (dc *DeploymentController) getDeploymentForPod(pod *v1.Pod) *extensions.Dep
// Find the owning replica set
var rs *extensions.ReplicaSet
var err error
controllerRef := controller.GetControllerOf(pod)
controllerRef := metav1.GetControllerOf(pod)
if controllerRef == nil {
// No controller owns this Pod.
return nil
@@ -425,7 +425,7 @@ func (dc *DeploymentController) getDeploymentForPod(pod *v1.Pod) *extensions.Dep
}
// Now find the Deployment that owns that ReplicaSet.
controllerRef = controller.GetControllerOf(rs)
controllerRef = metav1.GetControllerOf(rs)
if controllerRef == nil {
return nil
}
@@ -542,7 +542,7 @@ func (dc *DeploymentController) getPodMapForDeployment(d *extensions.Deployment,
for _, pod := range pods {
// Do not ignore inactive Pods because Recreate Deployments need to verify that no
// Pods from older versions are running before spinning up new Pods.
controllerRef := controller.GetControllerOf(pod)
controllerRef := metav1.GetControllerOf(pod)
if controllerRef == nil {
continue
}