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

@@ -580,8 +580,7 @@ func ListReplicaSets(deployment *extensions.Deployment, getRSList RsListFunc) ([
// Only include those whose ControllerRef matches the Deployment.
owned := make([]*extensions.ReplicaSet, 0, len(all))
for _, rs := range all {
controllerRef := controller.GetControllerOf(rs)
if controllerRef != nil && controllerRef.UID == deployment.UID {
if metav1.IsControlledBy(rs, deployment) {
owned = append(owned, rs)
}
}
@@ -604,8 +603,7 @@ func ListReplicaSetsInternal(deployment *internalextensions.Deployment, getRSLis
// Only include those whose ControllerRef matches the Deployment.
filtered := make([]*internalextensions.ReplicaSet, 0, len(all))
for _, rs := range all {
controllerRef := controller.GetControllerOf(rs)
if controllerRef != nil && controllerRef.UID == deployment.UID {
if metav1.IsControlledBy(rs, deployment) {
filtered = append(filtered, rs)
}
}
@@ -638,7 +636,7 @@ func ListPods(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet
owned := &v1.PodList{Items: make([]v1.Pod, 0, len(all.Items))}
for i := range all.Items {
pod := &all.Items[i]
controllerRef := controller.GetControllerOf(pod)
controllerRef := metav1.GetControllerOf(pod)
if controllerRef != nil && rsMap[controllerRef.UID] {
owned.Items = append(owned.Items, *pod)
}