statefulSetHistory returns the StatefulSet named name in namespace and all ControllerRevisions in its history.
( apps clientappsv1.AppsV1Interface, namespace, name string)
| 395 | |
| 396 | // statefulSetHistory returns the StatefulSet named name in namespace and all ControllerRevisions in its history. |
| 397 | func statefulSetHistory( |
| 398 | apps clientappsv1.AppsV1Interface, |
| 399 | namespace, name string) (*appsv1.StatefulSet, []*appsv1.ControllerRevision, error) { |
| 400 | sts, err := apps.StatefulSets(namespace).Get(context.TODO(), name, metav1.GetOptions{}) |
| 401 | if err != nil { |
| 402 | return nil, nil, fmt.Errorf("failed to retrieve Statefulset %s: %s", name, err.Error()) |
| 403 | } |
| 404 | selector, err := metav1.LabelSelectorAsSelector(sts.Spec.Selector) |
| 405 | if err != nil { |
| 406 | return nil, nil, fmt.Errorf("failed to create selector for StatefulSet %s: %s", name, err.Error()) |
| 407 | } |
| 408 | accessor, err := meta.Accessor(sts) |
| 409 | if err != nil { |
| 410 | return nil, nil, fmt.Errorf("failed to obtain accessor for StatefulSet %s: %s", name, err.Error()) |
| 411 | } |
| 412 | history, err := controlledHistoryV1(apps, namespace, selector, accessor) |
| 413 | if err != nil { |
| 414 | return nil, nil, fmt.Errorf("unable to find history controlled by StatefulSet %s: %v", name, err) |
| 415 | } |
| 416 | return sts, history, nil |
| 417 | } |
| 418 | |
| 419 | // applyDaemonSetHistory returns a specific revision of DaemonSet by applying the given history to a copy of the given DaemonSet |
| 420 | func applyDaemonSetHistory(ds *appsv1.DaemonSet, history *appsv1.ControllerRevision) (*appsv1.DaemonSet, error) { |
no test coverage detected
searching dependent graphs…