// NewStatefulSet creates a new Webserver StatefulSet for testing. The StatefulSet is named name, is in namespace ns, // statefulPodsMounts are the mounts that will be backed by PVs. podsMounts are the mounts that are mounted directly // to the Pod. labels are the labels that will be usd for the StatefulSet selector. func NewStatefulSet(name, ns, governingSvcName string, replicas int32, statefulPodMounts []v1.VolumeMount, podMounts []v1.VolumeMount, labels map[string]string) *appsv1.StatefulSet { … } // NewStatefulSetPVC returns a PersistentVolumeClaim named name, for testing StatefulSets. func NewStatefulSetPVC(name string) v1.PersistentVolumeClaim { … } func hasPauseProbe(pod *v1.Pod) bool { … } var pauseProbe … type statefulPodsByOrdinal … func (sp statefulPodsByOrdinal) Len() int { … } func (sp statefulPodsByOrdinal) Swap(i, j int) { … } func (sp statefulPodsByOrdinal) Less(i, j int) bool { … } // PauseNewPods adds an always-failing ReadinessProbe to the StatefulSet PodTemplate. // This causes all newly-created Pods to stay Unready until they are manually resumed // with ResumeNextPod(). // Note that this cannot be used together with SetHTTPProbe(). func PauseNewPods(ss *appsv1.StatefulSet) { … } // ResumeNextPod allows the next Pod in the StatefulSet to continue by removing the ReadinessProbe // added by PauseNewPods(), if it's still there. // It fails the test if it finds any pods that are not in phase Running, // or if it finds more than one paused Pod existing at the same time. // This is a no-op if there are no paused pods. func ResumeNextPod(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet) { … } // SortStatefulPods sorts pods by their ordinals func SortStatefulPods(pods *v1.PodList) { … } var statefulPodRegex … func getStatefulPodOrdinal(pod *v1.Pod) int { … }