Skip to content

Commit 530a8a0

Browse files
Merge pull request #366 from ritmun/allow-pods
remove operators from webhook check
2 parents 2e8ad82 + 3041d7a commit 530a8a0

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

test/e2e/managed_cluster_validating_webhooks_test.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package osde2etests
55

66
import (
77
"context"
8-
"slices"
98
"strconv"
109
"strings"
1110
"time"
@@ -247,47 +246,6 @@ var _ = Describe("Managed Cluster Validating Webhooks", Ordered, func() {
247246
Expect(err).NotTo(HaveOccurred())
248247
}, SpecTimeout(createPodWaitDuration.Seconds()+deletePodWaitDuration.Seconds()))
249248

250-
It("prevents operators workloads from being scheduled on worker or master nodes", func(ctx context.Context) {
251-
operators := map[string]string{
252-
"cloud-ingress-operator": "openshift-cloud-ingress-operator",
253-
"configure-alertmanager-operator": "openshift-monitoring",
254-
"custom-domains-operator": "openshift-custom-domains-operator",
255-
"managed-velero-operator": "openshift-velero",
256-
"must-gather-operator": "openshift-must-gather-operator",
257-
"osd-metrics-exporter": "openshift-osd-metrics",
258-
"rbac-permissions-operator": "openshift-rbac-permissions",
259-
}
260-
261-
var podList v1.PodList
262-
err := client.WithNamespace(metav1.NamespaceAll).List(ctx, &podList)
263-
Expect(err).ShouldNot(HaveOccurred(), "unable to list pods")
264-
Expect(len(podList.Items)).To(BeNumerically(">", 0), "found no pods")
265-
266-
var nodeList v1.NodeList
267-
selectInfraNodes := resources.WithLabelSelector(labels.FormatLabels(map[string]string{"node-role.kubernetes.io": "infra"}))
268-
err = client.List(ctx, &nodeList, selectInfraNodes)
269-
Expect(err).ShouldNot(HaveOccurred(), "unable to list infra nodes ")
270-
271-
nodeNames := []string{}
272-
for _, node := range nodeList.Items {
273-
nodeNames = append(nodeNames, node.GetName())
274-
}
275-
276-
violators := []string{}
277-
for _, pod := range podList.Items {
278-
for operator, namespace := range operators {
279-
if pod.GetNamespace() != namespace {
280-
continue
281-
}
282-
if strings.HasPrefix(pod.GetName(), operator) && !strings.HasPrefix(pod.GetName(), operator+"-registry") {
283-
if !slices.Contains(nodeNames, pod.Spec.NodeName) {
284-
violators = append(violators, pod.GetNamespace()+"/"+pod.GetName())
285-
}
286-
}
287-
}
288-
}
289-
Expect(violators).To(HaveLen(0), "found pods in violation %v", violators)
290-
})
291249
})
292250

293251
Describe("sre-techpreviewnoupgrade-validation", func() {

0 commit comments

Comments
 (0)