MCPcopy
hub / github.com/kubernetes/kubectl / statefulSetHistory

Function statefulSetHistory

pkg/polymorphichelpers/history.go:397–417  ·  view source on GitHub ↗

statefulSetHistory returns the StatefulSet named name in namespace and all ControllerRevisions in its history.

(
	apps clientappsv1.AppsV1Interface,
	namespace, name string)

Source from the content-addressed store, hash-verified

395
396// statefulSetHistory returns the StatefulSet named name in namespace and all ControllerRevisions in its history.
397func 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
420func applyDaemonSetHistory(ds *appsv1.DaemonSet, history *appsv1.ControllerRevision) (*appsv1.DaemonSet, error) {

Callers 3

ViewHistoryMethod · 0.85
GetHistoryMethod · 0.85
RollbackMethod · 0.85

Calls 3

controlledHistoryV1Function · 0.85
GetMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…