Skip to content

Commit c5fadf0

Browse files
committed
OCPBUGS-44238: Add Readiness Probe to Router Status Tests
Previously, the router was configured without a readiness probe, resulting in racy startup conditions during router status stress tests. Routers would be marked as ready immediately upon starting, causing the waitForReadyReplicaSet function to proceed prematurely. This allowed the next step of route creation to occur before the routers had fully initialized. This often led to the first two routers to fight over the route status while the third router was still starting. As a result, the third router missed observing these early status contentions, leading to more writes to the route status than we were expecting.
1 parent 929fc7c commit c5fadf0

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

test/extended/router/stress.go

+54-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ var _ = g.Describe("[sig-network][Feature:Router][apigroup:route.openshift.io]",
7878
Name: "system:router",
7979
},
8080
}, metav1.CreateOptions{})
81+
// In order to start HAProxy, so that the readiness probe will work, the router needs anyuid.
82+
_, err = oc.AdminKubeClient().RbacV1().RoleBindings(ns).Create(context.Background(), &rbacv1.RoleBinding{
83+
ObjectMeta: metav1.ObjectMeta{
84+
Name: "router-anyuid",
85+
},
86+
Subjects: []rbacv1.Subject{
87+
{
88+
Kind: "ServiceAccount",
89+
Name: "default",
90+
},
91+
},
92+
RoleRef: rbacv1.RoleRef{
93+
Kind: "ClusterRole",
94+
Name: "system:openshift:scc:anyuid",
95+
},
96+
}, metav1.CreateOptions{})
8197
o.Expect(err).NotTo(o.HaveOccurred())
8298
})
8399

@@ -552,11 +568,47 @@ func scaledRouter(name, image string, args []string) *appsv1.ReplicaSet {
552568
Containers: []corev1.Container{
553569
{
554570
Env: []corev1.EnvVar{
555-
{Name: "NAME", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "metadata.name"}}},
571+
{
572+
Name: "NAME", ValueFrom: &corev1.EnvVarSource{
573+
FieldRef: &corev1.ObjectFieldSelector{
574+
FieldPath: "metadata.name",
575+
},
576+
},
577+
},
578+
{
579+
Name: "POD_NAMESPACE",
580+
ValueFrom: &corev1.EnvVarSource{
581+
FieldRef: &corev1.ObjectFieldSelector{
582+
FieldPath: "metadata.namespace",
583+
},
584+
},
585+
},
586+
{
587+
// This is only required because default_pub_keys.pem is the router uses a SHA1
588+
// signature algorithm and an RSA 1024 byte key, so we must specify a valid default
589+
// certificate. See https://github.com/openshift/router/pull/646
590+
Name: "DEFAULT_CERTIFICATE",
591+
Value: defaultPemData,
592+
},
556593
},
557594
Name: "router",
558595
Image: image,
559-
Args: args,
596+
Args: append(args, "--stats-port=1936", "--metrics-type=haproxy"),
597+
Ports: []corev1.ContainerPort{
598+
{
599+
ContainerPort: 1936,
600+
Name: "stats",
601+
Protocol: corev1.ProtocolTCP,
602+
},
603+
},
604+
ReadinessProbe: &corev1.Probe{
605+
ProbeHandler: corev1.ProbeHandler{
606+
HTTPGet: &corev1.HTTPGetAction{
607+
Path: "/healthz/ready",
608+
Port: intstr.FromInt32(1936),
609+
},
610+
},
611+
},
560612
},
561613
},
562614
},

0 commit comments

Comments
 (0)