Browse code

Scheduler predicates test should run without node constraints

Upstream does not set up a cluster that imposes default selectors, so
all selector predicate tests in e2e are allowed to schedule on all
nodes, not just app nodes.

Clayton Coleman authored on 2016/12/27 05:48:33
Showing 1 changed files
... ...
@@ -181,6 +181,10 @@ func createTestingNS(baseName string, c *kclient.Client, labels map[string]strin
181 181
 		addRoleToE2EServiceAccounts(osClient, []kapi.Namespace{*ns}, bootstrappolicy.ViewRoleName)
182 182
 	}
183 183
 
184
+	if isPackage("/kubernetes/test/e2e/scheduler_predicates.go") {
185
+		allowAllNodeScheduling(c, ns.Name)
186
+	}
187
+
184 188
 	return ns, err
185 189
 }
186 190
 
... ...
@@ -200,6 +204,25 @@ func checkSuiteSkips() {
200 200
 
201 201
 var longRetry = wait.Backoff{Steps: 100}
202 202
 
203
+// allowAllNodeScheduling sets the annotation on namespace that allows all nodes to be scheduled onto.
204
+func allowAllNodeScheduling(c *kclient.Client, namespace string) {
205
+	err := kclient.RetryOnConflict(longRetry, func() error {
206
+		ns, err := c.Namespaces().Get(namespace)
207
+		if err != nil {
208
+			return err
209
+		}
210
+		if ns.Annotations == nil {
211
+			ns.Annotations = make(map[string]string)
212
+		}
213
+		ns.Annotations["openshift.io/node-selector"] = ""
214
+		_, err = c.Namespaces().Update(ns)
215
+		return err
216
+	})
217
+	if err != nil {
218
+		FatalErr(err)
219
+	}
220
+}
221
+
203 222
 func addE2EServiceAccountsToSCC(c *kclient.Client, namespaces []kapi.Namespace, sccName string) {
204 223
 	// Because updates can race, we need to set the backoff retries to be > than the number of possible
205 224
 	// parallel jobs starting at once. Set very high to allow future high parallelism.