Change etcd to agnhost

Signed-off-by: Shogo Hida <shogo.hida@gmail.com>
This commit is contained in:
Shogo Hida 2023-02-16 00:49:28 +09:00
parent e18fa74551
commit 58ae449604

View File

@ -525,7 +525,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: 6379,
Service: nil, Service: nil,
}, },
}, },
@ -534,7 +534,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)
}) })
@ -548,14 +548,14 @@ var _ = SIGDescribe("Probing container", func() {
livenessProbe := &v1.Probe{ livenessProbe := &v1.Probe{
ProbeHandler: v1.ProbeHandler{ ProbeHandler: v1.ProbeHandler{
GRPC: &v1.GRPCAction{ GRPC: &v1.GRPCAction{
Port: 2333, // this port is wrong Port: 6333, // this port is wrong
}, },
}, },
InitialDelaySeconds: probeTestInitialDelaySeconds * 4, InitialDelaySeconds: probeTestInitialDelaySeconds * 4,
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)
}) })
@ -630,7 +630,7 @@ done
podClient := e2epod.NewPodClient(f) podClient := e2epod.NewPodClient(f)
terminationGracePeriod := int64(30) terminationGracePeriod := int64(30)
script := ` script := `
_term() { _term() {
rm -f /tmp/ready rm -f /tmp/ready
rm -f /tmp/liveness rm -f /tmp/liveness
sleep 20 sleep 20
@ -641,7 +641,7 @@ trap _term SIGTERM
touch /tmp/ready touch /tmp/ready
touch /tmp/liveness touch /tmp/liveness
while true; do while true; do
echo \"hello\" echo \"hello\"
sleep 10 sleep 10
done done
@ -1036,27 +1036,26 @@ 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" agnhostLocalhostAddress := "127.0.0.1"
if framework.TestContext.ClusterIsIPv6() { if framework.TestContext.ClusterIsIPv6() {
etcdLocalhostAddress = "::1" agnhostLocalhostAddress = "::1"
} }
etcdURL := fmt.Sprintf("http://%s", net.JoinHostPort(etcdLocalhostAddress, "2379")) agnhostURL := fmt.Sprintf("http://%s", net.JoinHostPort(agnhostLocalhostAddress, "6379"))
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", "/usr/local/bin/agnhost",
"--listen-client-urls", "--listen-client-urls",
"http://0.0.0.0:2379", //should listen on all addresses "http://0.0.0.0:6379", //should listen on all addresses
"--advertise-client-urls", "--advertise-client-urls",
etcdURL, agnhostURL,
}, },
// 2380 is an automatic peer URL Ports: []v1.ContainerPort{{ContainerPort: int32(6379)}},
Ports: []v1.ContainerPort{{ContainerPort: int32(2379)}, {ContainerPort: int32(2380)}},
LivenessProbe: livenessProbe, LivenessProbe: livenessProbe,
ReadinessProbe: readinessProbe, ReadinessProbe: readinessProbe,
}, },