Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions test/extended/router/config_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait"
e2eoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
"k8s.io/pod-security-admission/api"
utilpointer "k8s.io/utils/pointer"

routev1 "github.com/openshift/api/route/v1"
Expand Down Expand Up @@ -46,12 +47,9 @@ var _ = g.Describe("[sig-network][Feature:Router][apigroup:route.openshift.io]",
}
})

oc = exutil.NewCLI("router-config-manager")
oc = exutil.NewCLIWithPodSecurityLevel("router-config-manager", api.LevelPrivileged)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specific router operations require privileged mode? This should be documented at least in a code comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we talked, #30741 is built on top of this branch, and I'll describe the reason we are using privileged namespace for the router.


g.BeforeEach(func() {
// the test has been skipped since July 2018 because it was flaking.
// TODO: Fix the test and re-enable it in https://issues.redhat.com/browse/NE-906.
g.Skip("HAProxy dynamic config manager tests skipped in 4.x")
ns = oc.Namespace()

routerImage, err := exutil.FindRouterImage(oc)
Expand Down Expand Up @@ -89,8 +87,8 @@ daemon off;
events { }
http {
server {
listen 8443;
ssl on;
listen 8443 ssl;
listen [::]:8443 ssl;
ssl_certificate /etc/serving-cert/tls.crt;
ssl_certificate_key /etc/serving-cert/tls.key;
server_name "*.svc";
Expand Down Expand Up @@ -350,6 +348,10 @@ http {
},
},
},
{
Name: "ROUTER_IP_V4_V6_MODE",
Value: "v4v6",
},
},
Args: []string{
"--namespace=$(POD_NAMESPACE)",
Expand Down Expand Up @@ -462,7 +464,7 @@ http {
Name: "cert",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: "service-cert",
SecretName: "serving-cert",
},
},
},
Expand Down Expand Up @@ -491,9 +493,6 @@ http {

g.Describe("The HAProxy router", func() {
g.It("should serve the correct routes when running with the haproxy config manager", func() {
// the test has been skipped since July 2018 because it was flaking.
// TODO: Fix the test and re-enable it in https://issues.redhat.com/browse/NE-906.
g.Skip("HAProxy dynamic config manager tests skipped in 4.x")
ns := oc.KubeFramework().Namespace.Name
execPod := exutil.CreateExecPodOrFail(oc.AdminKubeClient(), ns, "execpod")
defer func() {
Expand Down Expand Up @@ -532,7 +531,10 @@ http {
for i := 0; i < 16; i++ {
name := fmt.Sprintf("hapcm-stress-insecure-%d", i)
hostName := fmt.Sprintf("stress.insecure-%d.hapcm.test", i)
err := oc.AsAdmin().Run("expose").Args("service", "insecure-service", "--name", name, "--hostname", hostName, "--labels", "select=haproxy-cfgmgr").Execute()
err := oc.AsAdmin().Run("expose").Args("service", "insecure-service", "--name", name, "--hostname", hostName).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
// --labels on `oc expose` (above) does not override the ones coming from service's selector.
err = oc.AsAdmin().Run("label").Args("route", name, "select=haproxy-cfgmgr").Execute()
o.Expect(err).NotTo(o.HaveOccurred())

err = waitForRouteToRespond(ns, execPod.Name, "http", hostName, "/", routerIP, 0)
Expand Down