Skip to content

Commit 4c53b85

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. Adding the readiness probe also revealed that HAProxy was failing to start due to insufficient permissions. The anyuid SCC was added to the router's service account to resolve the issue.
1 parent 929fc7c commit 4c53b85

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

test/extended/router/stress.go

+47-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+
// Router pod needs anyuid, but system:router defaults to the restricted-v2 SCC, which does not provide it.
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,40 @@ 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+
},
556586
},
557587
Name: "router",
558588
Image: image,
559-
Args: args,
589+
Args: append(args, "--stats-port=1936", "--metrics-type=haproxy"),
590+
Ports: []corev1.ContainerPort{
591+
{
592+
ContainerPort: 1936,
593+
Name: "stats",
594+
Protocol: corev1.ProtocolTCP,
595+
},
596+
},
597+
ReadinessProbe: &corev1.Probe{
598+
ProbeHandler: corev1.ProbeHandler{
599+
HTTPGet: &corev1.HTTPGetAction{
600+
Path: "/healthz/ready",
601+
Port: intstr.FromInt32(1936),
602+
},
603+
},
604+
},
560605
},
561606
},
562607
},

0 commit comments

Comments
 (0)