...

Package statefulset

import "k8s.io/kubernetes/test/e2e/framework/statefulset"
Overview
Index

Overview ▾

Index ▾

Constants
func CheckHostname(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet) error
func CheckMount(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, mountPath string) error
func CheckServiceName(ss *appsv1.StatefulSet, expectedServiceName string) error
func CreateStatefulSet(ctx context.Context, c clientset.Interface, manifestPath, ns string) *appsv1.StatefulSet
func DeleteAllStatefulSets(ctx context.Context, c clientset.Interface, ns string)
func ExecInStatefulPods(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, cmd string) error
func GetPodList(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet) *v1.PodList
func NewStatefulSet(name, ns, governingSvcName string, replicas int32, statefulPodMounts []v1.VolumeMount, podMounts []v1.VolumeMount, labels map[string]string) *appsv1.StatefulSet
func NewStatefulSetPVC(name string) v1.PersistentVolumeClaim
func PauseNewPods(ss *appsv1.StatefulSet)
func Restart(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet)
func ResumeNextPod(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet)
func Saturate(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet)
func Scale(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, count int32) (*appsv1.StatefulSet, error)
func SortStatefulPods(pods *v1.PodList)
func UpdateReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, count int32)
func WaitForPodReady(ctx context.Context, c clientset.Interface, set *appsv1.StatefulSet, podName string) (*appsv1.StatefulSet, *v1.PodList)
func WaitForRunning(ctx context.Context, c clientset.Interface, numPodsRunning, numPodsReady int32, ss *appsv1.StatefulSet)
func WaitForRunningAndReady(ctx context.Context, c clientset.Interface, numStatefulPods int32, ss *appsv1.StatefulSet)
func WaitForState(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, until func(*appsv1.StatefulSet, *v1.PodList) (bool, error))
func WaitForStatusAvailableReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)
func WaitForStatusReadyReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)
func WaitForStatusReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)

Package files

const.go fixtures.go rest.go wait.go

Constants

const (
    // StatefulSetPoll is a poll interval for StatefulSet tests
    StatefulSetPoll = 10 * time.Second
    // StatefulSetTimeout is a timeout interval for StatefulSet operations
    StatefulSetTimeout = 10 * time.Minute
    // StatefulPodTimeout is a timeout for stateful pods to change state
    StatefulPodTimeout = 5 * time.Minute
)

func CheckHostname

func CheckHostname(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet) error

CheckHostname verifies that all Pods in ss have the correct Hostname. If the returned error is not nil than verification failed.

func CheckMount

func CheckMount(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, mountPath string) error

CheckMount checks that the mount at mountPath is valid for all Pods in ss.

func CheckServiceName

func CheckServiceName(ss *appsv1.StatefulSet, expectedServiceName string) error

CheckServiceName asserts that the ServiceName for ss is equivalent to expectedServiceName.

func CreateStatefulSet

func CreateStatefulSet(ctx context.Context, c clientset.Interface, manifestPath, ns string) *appsv1.StatefulSet

CreateStatefulSet creates a StatefulSet from the manifest at manifestPath in the Namespace ns using kubectl create.

func DeleteAllStatefulSets

func DeleteAllStatefulSets(ctx context.Context, c clientset.Interface, ns string)

DeleteAllStatefulSets deletes all StatefulSet API Objects in Namespace ns.

func ExecInStatefulPods

func ExecInStatefulPods(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, cmd string) error

ExecInStatefulPods executes cmd in all Pods in ss. If a error occurs it is returned and cmd is not execute in any subsequent Pods.

func GetPodList

func GetPodList(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet) *v1.PodList

GetPodList gets the current Pods in ss.

func NewStatefulSet

func NewStatefulSet(name, ns, governingSvcName string, replicas int32, statefulPodMounts []v1.VolumeMount, podMounts []v1.VolumeMount, labels map[string]string) *appsv1.StatefulSet

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 NewStatefulSetPVC

func NewStatefulSetPVC(name string) v1.PersistentVolumeClaim

NewStatefulSetPVC returns a PersistentVolumeClaim named name, for testing StatefulSets.

func PauseNewPods

func PauseNewPods(ss *appsv1.StatefulSet)

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 Restart

func Restart(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet)

Restart scales ss to 0 and then back to its previous number of replicas.

func ResumeNextPod

func ResumeNextPod(ctx context.Context, c clientset.Interface, 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 Saturate

func Saturate(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet)

Saturate waits for all Pods in ss to become Running and Ready.

func Scale

func Scale(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, count int32) (*appsv1.StatefulSet, error)

Scale scales ss to count replicas.

func SortStatefulPods

func SortStatefulPods(pods *v1.PodList)

SortStatefulPods sorts pods by their ordinals

func UpdateReplicas

func UpdateReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, count int32)

UpdateReplicas updates the replicas of ss to count.

func WaitForPodReady

func WaitForPodReady(ctx context.Context, c clientset.Interface, set *appsv1.StatefulSet, podName string) (*appsv1.StatefulSet, *v1.PodList)

WaitForPodReady waits for the Pod named podName in set to exist and have a Ready condition.

func WaitForRunning

func WaitForRunning(ctx context.Context, c clientset.Interface, numPodsRunning, numPodsReady int32, ss *appsv1.StatefulSet)

WaitForRunning waits for numPodsRunning in ss to be Running and for the first numPodsReady ordinals to be Ready.

func WaitForRunningAndReady

func WaitForRunningAndReady(ctx context.Context, c clientset.Interface, numStatefulPods int32, ss *appsv1.StatefulSet)

WaitForRunningAndReady waits for numStatefulPods in ss to be Running and Ready.

func WaitForState

func WaitForState(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, until func(*appsv1.StatefulSet, *v1.PodList) (bool, error))

WaitForState periodically polls for the ss and its pods until the until function returns either true or an error

func WaitForStatusAvailableReplicas

func WaitForStatusAvailableReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)

WaitForStatusAvailableReplicas waits for the ss.Status.Available to be equal to expectedReplicas

func WaitForStatusReadyReplicas

func WaitForStatusReadyReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)

WaitForStatusReadyReplicas waits for the ss.Status.ReadyReplicas to be equal to expectedReplicas

func WaitForStatusReplicas

func WaitForStatusReplicas(ctx context.Context, c clientset.Interface, ss *appsv1.StatefulSet, expectedReplicas int32)

WaitForStatusReplicas waits for the ss.Status.Replicas to be equal to expectedReplicas