Merge pull request #115800 from shogohida/switch-image-in-grpc-probe-tests-to-agnhost

Switch image in gRPC probe tests to agnhost
This commit is contained in:
Kubernetes Prow Robot 2023-02-18 10:19:36 -08:00 committed by GitHub
commit d6fe718e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"net"
"net/url" "net/url"
"strings" "strings"
"time" "time"
@ -525,7 +524,7 @@ var _ = SIGDescribe("Probing container", func() {
livenessProbe := &v1.Probe{ livenessProbe := &v1.Probe{
ProbeHandler: v1.ProbeHandler{ ProbeHandler: v1.ProbeHandler{
GRPC: &v1.GRPCAction{ GRPC: &v1.GRPCAction{
Port: 2379, Port: 5000,
Service: nil, Service: nil,
}, },
}, },
@ -534,7 +533,7 @@ var _ = SIGDescribe("Probing container", func() {
FailureThreshold: 1, FailureThreshold: 1,
} }
pod := gRPCServerPodSpec(nil, livenessProbe, "etcd") pod := gRPCServerPodSpec(nil, livenessProbe, "agnhost")
RunLivenessTest(ctx, f, pod, 0, defaultObservationTimeout) RunLivenessTest(ctx, f, pod, 0, defaultObservationTimeout)
}) })
@ -555,7 +554,7 @@ var _ = SIGDescribe("Probing container", func() {
TimeoutSeconds: 5, // default 1s can be pretty aggressive in CI environments with low resources TimeoutSeconds: 5, // default 1s can be pretty aggressive in CI environments with low resources
FailureThreshold: 1, FailureThreshold: 1,
} }
pod := gRPCServerPodSpec(nil, livenessProbe, "etcd") pod := gRPCServerPodSpec(nil, livenessProbe, "agnhost")
RunLivenessTest(ctx, f, pod, 1, defaultObservationTimeout) RunLivenessTest(ctx, f, pod, 1, defaultObservationTimeout)
}) })
@ -1036,27 +1035,18 @@ func runReadinessFailTest(ctx context.Context, f *framework.Framework, pod *v1.P
} }
func gRPCServerPodSpec(readinessProbe, livenessProbe *v1.Probe, containerName string) *v1.Pod { func gRPCServerPodSpec(readinessProbe, livenessProbe *v1.Probe, containerName string) *v1.Pod {
etcdLocalhostAddress := "127.0.0.1"
if framework.TestContext.ClusterIsIPv6() {
etcdLocalhostAddress = "::1"
}
etcdURL := fmt.Sprintf("http://%s", net.JoinHostPort(etcdLocalhostAddress, "2379"))
return &v1.Pod{ return &v1.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "test-grpc-" + string(uuid.NewUUID())}, ObjectMeta: metav1.ObjectMeta{Name: "test-grpc-" + string(uuid.NewUUID())},
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Name: containerName, Name: containerName,
Image: imageutils.GetE2EImage(imageutils.Etcd), Image: imageutils.GetE2EImage(imageutils.Agnhost),
Command: []string{ Command: []string{
"/usr/local/bin/etcd", "/agnhost",
"--listen-client-urls", "grpc-health-checking",
"http://0.0.0.0:2379", //should listen on all addresses
"--advertise-client-urls",
etcdURL,
}, },
// 2380 is an automatic peer URL Ports: []v1.ContainerPort{{ContainerPort: int32(5000)}, {ContainerPort: int32(8080)}},
Ports: []v1.ContainerPort{{ContainerPort: int32(2379)}, {ContainerPort: int32(2380)}},
LivenessProbe: livenessProbe, LivenessProbe: livenessProbe,
ReadinessProbe: readinessProbe, ReadinessProbe: readinessProbe,
}, },