mirror of https://github.com/k3s-io/k3s
Merge pull request #76006 from atoato88/fix-golint-e2e-framework-s
Fix golint failures of e2e/framework/statefulset_utils.gok3s-v1.15.3
commit
20cece67b5
|
@ -278,7 +278,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
By("Creating a new StatefulSet")
|
By("Creating a new StatefulSet")
|
||||||
ss := framework.NewStatefulSet("ss2", ns, headlessSvcName, 3, nil, nil, labels)
|
ss := framework.NewStatefulSet("ss2", ns, headlessSvcName, 3, nil, nil, labels)
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{
|
ss.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{
|
||||||
Type: apps.RollingUpdateStatefulSetStrategyType,
|
Type: apps.RollingUpdateStatefulSetStrategyType,
|
||||||
RollingUpdate: func() *apps.RollingUpdateStatefulSetStrategy {
|
RollingUpdate: func() *apps.RollingUpdateStatefulSetStrategy {
|
||||||
|
@ -489,7 +489,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
By("Creating a new StatefulSet")
|
By("Creating a new StatefulSet")
|
||||||
ss := framework.NewStatefulSet("ss2", ns, headlessSvcName, 3, nil, nil, labels)
|
ss := framework.NewStatefulSet("ss2", ns, headlessSvcName, 3, nil, nil, labels)
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{
|
ss.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{
|
||||||
Type: apps.OnDeleteStatefulSetStrategyType,
|
Type: apps.OnDeleteStatefulSetStrategyType,
|
||||||
}
|
}
|
||||||
|
@ -581,7 +581,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
By("Creating stateful set " + ssName + " in namespace " + ns)
|
By("Creating stateful set " + ssName + " in namespace " + ns)
|
||||||
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, psLabels)
|
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, psLabels)
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss, err = c.AppsV1().StatefulSets(ns).Create(ss)
|
ss, err = c.AppsV1().StatefulSets(ns).Create(ss)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
@ -589,14 +589,14 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
||||||
|
|
||||||
By("Confirming that stateful set scale up will halt with unhealthy stateful pod")
|
By("Confirming that stateful set scale up will halt with unhealthy stateful pod")
|
||||||
sst.BreakHttpProbe(ss)
|
sst.BreakHTTPProbe(ss)
|
||||||
sst.WaitForRunningAndNotReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndNotReady(*ss.Spec.Replicas, ss)
|
||||||
sst.WaitForStatusReadyReplicas(ss, 0)
|
sst.WaitForStatusReadyReplicas(ss, 0)
|
||||||
sst.UpdateReplicas(ss, 3)
|
sst.UpdateReplicas(ss, 3)
|
||||||
sst.ConfirmStatefulPodCount(1, ss, 10*time.Second, true)
|
sst.ConfirmStatefulPodCount(1, ss, 10*time.Second, true)
|
||||||
|
|
||||||
By("Scaling up stateful set " + ssName + " to 3 replicas and waiting until all of them will be running in namespace " + ns)
|
By("Scaling up stateful set " + ssName + " to 3 replicas and waiting until all of them will be running in namespace " + ns)
|
||||||
sst.RestoreHttpProbe(ss)
|
sst.RestoreHTTPProbe(ss)
|
||||||
sst.WaitForRunningAndReady(3, ss)
|
sst.WaitForRunningAndReady(3, ss)
|
||||||
|
|
||||||
By("Verifying that stateful set " + ssName + " was scaled up in order")
|
By("Verifying that stateful set " + ssName + " was scaled up in order")
|
||||||
|
@ -622,14 +622,14 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
sst.BreakHttpProbe(ss)
|
sst.BreakHTTPProbe(ss)
|
||||||
sst.WaitForStatusReadyReplicas(ss, 0)
|
sst.WaitForStatusReadyReplicas(ss, 0)
|
||||||
sst.WaitForRunningAndNotReady(3, ss)
|
sst.WaitForRunningAndNotReady(3, ss)
|
||||||
sst.UpdateReplicas(ss, 0)
|
sst.UpdateReplicas(ss, 0)
|
||||||
sst.ConfirmStatefulPodCount(3, ss, 10*time.Second, true)
|
sst.ConfirmStatefulPodCount(3, ss, 10*time.Second, true)
|
||||||
|
|
||||||
By("Scaling down stateful set " + ssName + " to 0 replicas and waiting until none of pods will run in namespace" + ns)
|
By("Scaling down stateful set " + ssName + " to 0 replicas and waiting until none of pods will run in namespace" + ns)
|
||||||
sst.RestoreHttpProbe(ss)
|
sst.RestoreHTTPProbe(ss)
|
||||||
sst.Scale(ss, 0)
|
sst.Scale(ss, 0)
|
||||||
|
|
||||||
By("Verifying that stateful set " + ssName + " was scaled down in reverse order")
|
By("Verifying that stateful set " + ssName + " was scaled down in reverse order")
|
||||||
|
@ -662,7 +662,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, psLabels)
|
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, psLabels)
|
||||||
ss.Spec.PodManagementPolicy = apps.ParallelPodManagement
|
ss.Spec.PodManagementPolicy = apps.ParallelPodManagement
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
@ -670,25 +670,25 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
||||||
|
|
||||||
By("Confirming that stateful set scale up will not halt with unhealthy stateful pod")
|
By("Confirming that stateful set scale up will not halt with unhealthy stateful pod")
|
||||||
sst.BreakHttpProbe(ss)
|
sst.BreakHTTPProbe(ss)
|
||||||
sst.WaitForRunningAndNotReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndNotReady(*ss.Spec.Replicas, ss)
|
||||||
sst.WaitForStatusReadyReplicas(ss, 0)
|
sst.WaitForStatusReadyReplicas(ss, 0)
|
||||||
sst.UpdateReplicas(ss, 3)
|
sst.UpdateReplicas(ss, 3)
|
||||||
sst.ConfirmStatefulPodCount(3, ss, 10*time.Second, false)
|
sst.ConfirmStatefulPodCount(3, ss, 10*time.Second, false)
|
||||||
|
|
||||||
By("Scaling up stateful set " + ssName + " to 3 replicas and waiting until all of them will be running in namespace " + ns)
|
By("Scaling up stateful set " + ssName + " to 3 replicas and waiting until all of them will be running in namespace " + ns)
|
||||||
sst.RestoreHttpProbe(ss)
|
sst.RestoreHTTPProbe(ss)
|
||||||
sst.WaitForRunningAndReady(3, ss)
|
sst.WaitForRunningAndReady(3, ss)
|
||||||
|
|
||||||
By("Scale down will not halt with unhealthy stateful pod")
|
By("Scale down will not halt with unhealthy stateful pod")
|
||||||
sst.BreakHttpProbe(ss)
|
sst.BreakHTTPProbe(ss)
|
||||||
sst.WaitForStatusReadyReplicas(ss, 0)
|
sst.WaitForStatusReadyReplicas(ss, 0)
|
||||||
sst.WaitForRunningAndNotReady(3, ss)
|
sst.WaitForRunningAndNotReady(3, ss)
|
||||||
sst.UpdateReplicas(ss, 0)
|
sst.UpdateReplicas(ss, 0)
|
||||||
sst.ConfirmStatefulPodCount(0, ss, 10*time.Second, false)
|
sst.ConfirmStatefulPodCount(0, ss, 10*time.Second, false)
|
||||||
|
|
||||||
By("Scaling down stateful set " + ssName + " to 0 replicas and waiting until none of pods will run in namespace" + ns)
|
By("Scaling down stateful set " + ssName + " to 0 replicas and waiting until none of pods will run in namespace" + ns)
|
||||||
sst.RestoreHttpProbe(ss)
|
sst.RestoreHTTPProbe(ss)
|
||||||
sst.Scale(ss, 0)
|
sst.Scale(ss, 0)
|
||||||
sst.WaitForStatusReplicas(ss, 0)
|
sst.WaitForStatusReplicas(ss, 0)
|
||||||
})
|
})
|
||||||
|
@ -788,7 +788,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||||
By("Creating statefulset " + ssName + " in namespace " + ns)
|
By("Creating statefulset " + ssName + " in namespace " + ns)
|
||||||
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, labels)
|
ss := framework.NewStatefulSet(ssName, ns, headlessSvcName, 1, nil, nil, labels)
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
||||||
|
@ -1083,7 +1083,7 @@ func pollReadWithTimeout(statefulPod statefulPodTester, statefulPodNumber int, k
|
||||||
// PVCs and one using no storage.
|
// PVCs and one using no storage.
|
||||||
func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
||||||
sst := framework.NewStatefulSetTester(c)
|
sst := framework.NewStatefulSetTester(c)
|
||||||
sst.SetHttpProbe(ss)
|
sst.SetHTTPProbe(ss)
|
||||||
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
ss, err := c.AppsV1().StatefulSets(ns).Create(ss)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
sst.WaitForRunningAndReady(*ss.Spec.Replicas, ss)
|
||||||
|
@ -1102,7 +1102,7 @@ func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
||||||
currentRevision))
|
currentRevision))
|
||||||
}
|
}
|
||||||
sst.SortStatefulPods(pods)
|
sst.SortStatefulPods(pods)
|
||||||
err = sst.BreakPodHttpProbe(ss, &pods.Items[1])
|
err = sst.BreakPodHTTPProbe(ss, &pods.Items[1])
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
ss, pods = sst.WaitForPodNotReady(ss, pods.Items[1].Name)
|
ss, pods = sst.WaitForPodNotReady(ss, pods.Items[1].Name)
|
||||||
newImage := NewNginxImage
|
newImage := NewNginxImage
|
||||||
|
@ -1124,7 +1124,7 @@ func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
||||||
By("Updating Pods in reverse ordinal order")
|
By("Updating Pods in reverse ordinal order")
|
||||||
pods = sst.GetPodList(ss)
|
pods = sst.GetPodList(ss)
|
||||||
sst.SortStatefulPods(pods)
|
sst.SortStatefulPods(pods)
|
||||||
err = sst.RestorePodHttpProbe(ss, &pods.Items[1])
|
err = sst.RestorePodHTTPProbe(ss, &pods.Items[1])
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
ss, pods = sst.WaitForPodReady(ss, pods.Items[1].Name)
|
ss, pods = sst.WaitForPodReady(ss, pods.Items[1].Name)
|
||||||
ss, pods = sst.WaitForRollingUpdate(ss)
|
ss, pods = sst.WaitForRollingUpdate(ss)
|
||||||
|
@ -1150,7 +1150,7 @@ func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
By("Rolling back to a previous revision")
|
By("Rolling back to a previous revision")
|
||||||
err = sst.BreakPodHttpProbe(ss, &pods.Items[1])
|
err = sst.BreakPodHTTPProbe(ss, &pods.Items[1])
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
ss, pods = sst.WaitForPodNotReady(ss, pods.Items[1].Name)
|
ss, pods = sst.WaitForPodNotReady(ss, pods.Items[1].Name)
|
||||||
priorRevision := currentRevision
|
priorRevision := currentRevision
|
||||||
|
@ -1169,7 +1169,7 @@ func rollbackTest(c clientset.Interface, ns string, ss *apps.StatefulSet) {
|
||||||
By("Rolling back update in reverse ordinal order")
|
By("Rolling back update in reverse ordinal order")
|
||||||
pods = sst.GetPodList(ss)
|
pods = sst.GetPodList(ss)
|
||||||
sst.SortStatefulPods(pods)
|
sst.SortStatefulPods(pods)
|
||||||
sst.RestorePodHttpProbe(ss, &pods.Items[1])
|
sst.RestorePodHTTPProbe(ss, &pods.Items[1])
|
||||||
ss, pods = sst.WaitForPodReady(ss, pods.Items[1].Name)
|
ss, pods = sst.WaitForPodReady(ss, pods.Items[1].Name)
|
||||||
ss, pods = sst.WaitForRollingUpdate(ss)
|
ss, pods = sst.WaitForRollingUpdate(ss)
|
||||||
Expect(ss.Status.CurrentRevision).To(Equal(priorRevision),
|
Expect(ss.Status.CurrentRevision).To(Equal(priorRevision),
|
||||||
|
|
|
@ -43,11 +43,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Poll interval for StatefulSet tests
|
// StatefulSetPoll is a poll interval for StatefulSet tests
|
||||||
StatefulSetPoll = 10 * time.Second
|
StatefulSetPoll = 10 * time.Second
|
||||||
// Timeout interval for StatefulSet operations
|
// StatefulSetTimeout is a timeout interval for StatefulSet operations
|
||||||
StatefulSetTimeout = 10 * time.Minute
|
StatefulSetTimeout = 10 * time.Minute
|
||||||
// Timeout for stateful pods to change state
|
// StatefulPodTimeout is a timeout for stateful pods to change state
|
||||||
StatefulPodTimeout = 5 * time.Minute
|
StatefulPodTimeout = 5 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -468,16 +468,15 @@ func (s *StatefulSetTester) WaitForPartitionedRollingUpdate(set *apps.StatefulSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
} else {
|
}
|
||||||
for i := int(*set.Spec.Replicas) - 1; i >= partition; i-- {
|
for i := int(*set.Spec.Replicas) - 1; i >= partition; i-- {
|
||||||
if pods.Items[i].Labels[apps.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
|
if pods.Items[i].Labels[apps.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
|
||||||
Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
|
Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
|
||||||
pods.Items[i].Namespace,
|
pods.Items[i].Namespace,
|
||||||
pods.Items[i].Name,
|
pods.Items[i].Name,
|
||||||
set.Status.UpdateRevision,
|
set.Status.UpdateRevision,
|
||||||
pods.Items[i].Labels[apps.StatefulSetRevisionLabel])
|
pods.Items[i].Labels[apps.StatefulSetRevisionLabel])
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@ -485,7 +484,7 @@ func (s *StatefulSetTester) WaitForPartitionedRollingUpdate(set *apps.StatefulSe
|
||||||
return set, pods
|
return set, pods
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForRunningAndReady waits for numStatefulPods in ss to be Running and not Ready.
|
// WaitForRunningAndNotReady waits for numStatefulPods in ss to be Running and not Ready.
|
||||||
func (s *StatefulSetTester) WaitForRunningAndNotReady(numStatefulPods int32, ss *apps.StatefulSet) {
|
func (s *StatefulSetTester) WaitForRunningAndNotReady(numStatefulPods int32, ss *apps.StatefulSet) {
|
||||||
s.WaitForRunning(numStatefulPods, 0, ss)
|
s.WaitForRunning(numStatefulPods, 0, ss)
|
||||||
}
|
}
|
||||||
|
@ -502,15 +501,15 @@ var httpProbe = &v1.Probe{
|
||||||
FailureThreshold: 1,
|
FailureThreshold: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHttpProbe sets the pod template's ReadinessProbe for Nginx StatefulSet containers.
|
// SetHTTPProbe sets the pod template's ReadinessProbe for Nginx StatefulSet containers.
|
||||||
// This probe can then be controlled with BreakHttpProbe() and RestoreHttpProbe().
|
// This probe can then be controlled with BreakHTTPProbe() and RestoreHTTPProbe().
|
||||||
// Note that this cannot be used together with PauseNewPods().
|
// Note that this cannot be used together with PauseNewPods().
|
||||||
func (s *StatefulSetTester) SetHttpProbe(ss *apps.StatefulSet) {
|
func (s *StatefulSetTester) SetHTTPProbe(ss *apps.StatefulSet) {
|
||||||
ss.Spec.Template.Spec.Containers[0].ReadinessProbe = httpProbe
|
ss.Spec.Template.Spec.Containers[0].ReadinessProbe = httpProbe
|
||||||
}
|
}
|
||||||
|
|
||||||
// BreakHttpProbe breaks the readiness probe for Nginx StatefulSet containers in ss.
|
// BreakHTTPProbe breaks the readiness probe for Nginx StatefulSet containers in ss.
|
||||||
func (s *StatefulSetTester) BreakHttpProbe(ss *apps.StatefulSet) error {
|
func (s *StatefulSetTester) BreakHTTPProbe(ss *apps.StatefulSet) error {
|
||||||
path := httpProbe.HTTPGet.Path
|
path := httpProbe.HTTPGet.Path
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return fmt.Errorf("Path expected to be not empty: %v", path)
|
return fmt.Errorf("Path expected to be not empty: %v", path)
|
||||||
|
@ -520,8 +519,8 @@ func (s *StatefulSetTester) BreakHttpProbe(ss *apps.StatefulSet) error {
|
||||||
return s.ExecInStatefulPods(ss, cmd)
|
return s.ExecInStatefulPods(ss, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BreakPodHttpProbe breaks the readiness probe for Nginx StatefulSet containers in one pod.
|
// BreakPodHTTPProbe breaks the readiness probe for Nginx StatefulSet containers in one pod.
|
||||||
func (s *StatefulSetTester) BreakPodHttpProbe(ss *apps.StatefulSet, pod *v1.Pod) error {
|
func (s *StatefulSetTester) BreakPodHTTPProbe(ss *apps.StatefulSet, pod *v1.Pod) error {
|
||||||
path := httpProbe.HTTPGet.Path
|
path := httpProbe.HTTPGet.Path
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return fmt.Errorf("Path expected to be not empty: %v", path)
|
return fmt.Errorf("Path expected to be not empty: %v", path)
|
||||||
|
@ -533,8 +532,8 @@ func (s *StatefulSetTester) BreakPodHttpProbe(ss *apps.StatefulSet, pod *v1.Pod)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestoreHttpProbe restores the readiness probe for Nginx StatefulSet containers in ss.
|
// RestoreHTTPProbe restores the readiness probe for Nginx StatefulSet containers in ss.
|
||||||
func (s *StatefulSetTester) RestoreHttpProbe(ss *apps.StatefulSet) error {
|
func (s *StatefulSetTester) RestoreHTTPProbe(ss *apps.StatefulSet) error {
|
||||||
path := httpProbe.HTTPGet.Path
|
path := httpProbe.HTTPGet.Path
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return fmt.Errorf("Path expected to be not empty: %v", path)
|
return fmt.Errorf("Path expected to be not empty: %v", path)
|
||||||
|
@ -544,8 +543,8 @@ func (s *StatefulSetTester) RestoreHttpProbe(ss *apps.StatefulSet) error {
|
||||||
return s.ExecInStatefulPods(ss, cmd)
|
return s.ExecInStatefulPods(ss, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestorePodHttpProbe restores the readiness probe for Nginx StatefulSet containers in pod.
|
// RestorePodHTTPProbe restores the readiness probe for Nginx StatefulSet containers in pod.
|
||||||
func (s *StatefulSetTester) RestorePodHttpProbe(ss *apps.StatefulSet, pod *v1.Pod) error {
|
func (s *StatefulSetTester) RestorePodHTTPProbe(ss *apps.StatefulSet, pod *v1.Pod) error {
|
||||||
path := httpProbe.HTTPGet.Path
|
path := httpProbe.HTTPGet.Path
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return fmt.Errorf("Path expected to be not empty: %v", path)
|
return fmt.Errorf("Path expected to be not empty: %v", path)
|
||||||
|
@ -574,7 +573,7 @@ func hasPauseProbe(pod *v1.Pod) bool {
|
||||||
// PauseNewPods adds an always-failing ReadinessProbe to the StatefulSet PodTemplate.
|
// PauseNewPods adds an always-failing ReadinessProbe to the StatefulSet PodTemplate.
|
||||||
// This causes all newly-created Pods to stay Unready until they are manually resumed
|
// This causes all newly-created Pods to stay Unready until they are manually resumed
|
||||||
// with ResumeNextPod().
|
// with ResumeNextPod().
|
||||||
// Note that this cannot be used together with SetHttpProbe().
|
// Note that this cannot be used together with SetHTTPProbe().
|
||||||
func (s *StatefulSetTester) PauseNewPods(ss *apps.StatefulSet) {
|
func (s *StatefulSetTester) PauseNewPods(ss *apps.StatefulSet) {
|
||||||
ss.Spec.Template.Spec.Containers[0].ReadinessProbe = pauseProbe
|
ss.Spec.Template.Spec.Containers[0].ReadinessProbe = pauseProbe
|
||||||
}
|
}
|
||||||
|
@ -655,7 +654,7 @@ func (s *StatefulSetTester) WaitForStatusReplicas(ss *apps.StatefulSet, expected
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckServiceName asserts that the ServiceName for ss is equivalent to expectedServiceName.
|
// CheckServiceName asserts that the ServiceName for ss is equivalent to expectedServiceName.
|
||||||
func (p *StatefulSetTester) CheckServiceName(ss *apps.StatefulSet, expectedServiceName string) error {
|
func (s *StatefulSetTester) CheckServiceName(ss *apps.StatefulSet, expectedServiceName string) error {
|
||||||
Logf("Checking if statefulset spec.serviceName is %s", expectedServiceName)
|
Logf("Checking if statefulset spec.serviceName is %s", expectedServiceName)
|
||||||
|
|
||||||
if expectedServiceName != ss.Spec.ServiceName {
|
if expectedServiceName != ss.Spec.ServiceName {
|
||||||
|
@ -869,6 +868,7 @@ func (sp statefulPodsByOrdinal) Less(i, j int) bool {
|
||||||
|
|
||||||
type updateStatefulSetFunc func(*apps.StatefulSet)
|
type updateStatefulSetFunc func(*apps.StatefulSet)
|
||||||
|
|
||||||
|
// UpdateStatefulSetWithRetries updates statfulset template with retries.
|
||||||
func UpdateStatefulSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateStatefulSetFunc) (statefulSet *apps.StatefulSet, err error) {
|
func UpdateStatefulSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateStatefulSetFunc) (statefulSet *apps.StatefulSet, err error) {
|
||||||
statefulSets := c.AppsV1().StatefulSets(namespace)
|
statefulSets := c.AppsV1().StatefulSets(namespace)
|
||||||
var updateErr error
|
var updateErr error
|
||||||
|
|
Loading…
Reference in New Issue