controlledHistories returns all ControllerRevisions in namespace that selected by selector and owned by accessor
( apps clientappsv1.AppsV1Interface, namespace string, selector labels.Selector, accessor metav1.Object)
| 351 | |
| 352 | // controlledHistories returns all ControllerRevisions in namespace that selected by selector and owned by accessor |
| 353 | func controlledHistory( |
| 354 | apps clientappsv1.AppsV1Interface, |
| 355 | namespace string, |
| 356 | selector labels.Selector, |
| 357 | accessor metav1.Object) ([]*appsv1.ControllerRevision, error) { |
| 358 | var result []*appsv1.ControllerRevision |
| 359 | historyList, err := apps.ControllerRevisions(namespace).List(context.TODO(), metav1.ListOptions{LabelSelector: selector.String()}) |
| 360 | if err != nil { |
| 361 | return nil, err |
| 362 | } |
| 363 | for i := range historyList.Items { |
| 364 | history := historyList.Items[i] |
| 365 | // Only add history that belongs to the API object |
| 366 | if metav1.IsControlledBy(&history, accessor) { |
| 367 | result = append(result, &history) |
| 368 | } |
| 369 | } |
| 370 | return result, nil |
| 371 | } |
| 372 | |
| 373 | // daemonSetHistory returns the DaemonSet named name in namespace and all ControllerRevisions in its history. |
| 374 | func daemonSetHistory( |
no test coverage detected
searching dependent graphs…