Migrate to IsControlledBy from meta/v1 package

This commit is contained in:
Mikhail Mazurskiy
2017-08-02 20:36:58 +10:00
parent 042b5642b9
commit 32b78aebf2
5 changed files with 13 additions and 17 deletions

View File

@@ -271,11 +271,10 @@ func controlledHistories(c externalclientset.Interface, namespace, name string)
}
for i := range historyList.Items {
history := historyList.Items[i]
// Skip history that doesn't belong to the DaemonSet
if controllerRef := metav1.GetControllerOf(&history); controllerRef == nil || controllerRef.UID != ds.UID {
continue
// Only add history that belongs to the DaemonSet
if metav1.IsControlledBy(&history, ds) {
result = append(result, &history)
}
result = append(result, &history)
}
return ds, result, nil
}