From ede262062921b66d4922398a708d27a763d8a432 Mon Sep 17 00:00:00 2001 From: Federico Paolinelli Date: Tue, 21 Jan 2020 11:52:29 +0100 Subject: [PATCH 1/2] Have a custom pool that matches two out of three nodes. This allows us to perform negative tests. By adding to the worker pool, we'll have all no worker without the features installed. Signed-off-by: Federico Paolinelli --- feature-configs/base/sctp/is_ready.sh | 4 +-- .../e2e-gcp/sctp/sctp_module_mc_patch.yaml | 2 +- hack/setup-test-cluster.sh | 28 ++++++++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/feature-configs/base/sctp/is_ready.sh b/feature-configs/base/sctp/is_ready.sh index f2efd6cf2..7d46ab764 100755 --- a/feature-configs/base/sctp/is_ready.sh +++ b/feature-configs/base/sctp/is_ready.sh @@ -1,8 +1,8 @@ #!/bin/sh # no output means that the new machine config wasn't picked by MCO yet -if [ -z "$(oc get mcp worker -o jsonpath='{.spec.configuration.source[?(@.name=="load-sctp-module")].name}')" ]; then +if [ -z "$(oc get mcp test-pool -o jsonpath='{.spec.configuration.source[?(@.name=="load-sctp-module")].name}')" ]; then exit 1 fi -oc wait mcp/worker --for condition=updated --timeout 1s +oc wait mcp/test-pool --for condition=updated --timeout 1s diff --git a/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml b/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml index 25175363d..84fe99e0e 100644 --- a/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml +++ b/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml @@ -2,5 +2,5 @@ apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: - machineconfiguration.openshift.io/role: worker + machineconfiguration.openshift.io/role: worker-sctp name: load-sctp-module diff --git a/hack/setup-test-cluster.sh b/hack/setup-test-cluster.sh index 9d339bc12..c1e33bd49 100755 --- a/hack/setup-test-cluster.sh +++ b/hack/setup-test-cluster.sh @@ -18,6 +18,32 @@ do ${OC_TOOL} label $node node-role.kubernetes.io/worker-sctp="" done + +# Note: this is intended to be the only pool we apply all mcs to. +# Additional mcs must be added to this poll in the selector +cat < Date: Tue, 21 Jan 2020 16:17:57 +0100 Subject: [PATCH 2/2] Label the deployment workers as worker-cnf and use them in the machine pool Signed-off-by: Federico Paolinelli --- feature-configs/base/sctp/is_ready.sh | 4 ++-- feature-configs/base/sctp/sctp_module_mc.yaml | 2 +- .../e2e-gcp/sctp/sctp_module_mc_patch.yaml | 2 +- functests/sctp/sctp.go | 11 ++++++++-- hack/setup-test-cluster.sh | 21 +++++++------------ 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/feature-configs/base/sctp/is_ready.sh b/feature-configs/base/sctp/is_ready.sh index 7d46ab764..a24f00ae4 100755 --- a/feature-configs/base/sctp/is_ready.sh +++ b/feature-configs/base/sctp/is_ready.sh @@ -1,8 +1,8 @@ #!/bin/sh # no output means that the new machine config wasn't picked by MCO yet -if [ -z "$(oc get mcp test-pool -o jsonpath='{.spec.configuration.source[?(@.name=="load-sctp-module")].name}')" ]; then +if [ -z "$(oc get mcp worker-cnf -o jsonpath='{.spec.configuration.source[?(@.name=="load-sctp-module")].name}')" ]; then exit 1 fi -oc wait mcp/test-pool --for condition=updated --timeout 1s +oc wait mcp/worker-cnf --for condition=updated --timeout 1s diff --git a/feature-configs/base/sctp/sctp_module_mc.yaml b/feature-configs/base/sctp/sctp_module_mc.yaml index f36d9396b..2f6aac083 100644 --- a/feature-configs/base/sctp/sctp_module_mc.yaml +++ b/feature-configs/base/sctp/sctp_module_mc.yaml @@ -2,7 +2,7 @@ apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: - machineconfiguration.openshift.io/role: worker-sctp + machineconfiguration.openshift.io/role: worker-cnf name: load-sctp-module spec: config: diff --git a/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml b/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml index 84fe99e0e..b3bff99c1 100644 --- a/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml +++ b/feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml @@ -2,5 +2,5 @@ apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: - machineconfiguration.openshift.io/role: worker-sctp + machineconfiguration.openshift.io/role: worker-cnf name: load-sctp-module diff --git a/functests/sctp/sctp.go b/functests/sctp/sctp.go index 6c87d9d37..0210242ce 100644 --- a/functests/sctp/sctp.go +++ b/functests/sctp/sctp.go @@ -21,15 +21,22 @@ import ( const mcYaml = "../sctp/sctp_module_mc.yaml" const hostnameLabel = "kubernetes.io/hostname" const testNamespace = "sctptest" -const sctpNodeSelector = "node-role.kubernetes.io/worker-sctp=" -var testerImage string +var ( + testerImage string + sctpNodeSelector string +) func init() { testerImage = os.Getenv("SCTPTEST_IMAGE") if testerImage == "" { testerImage = "fedepaol/sctptest:v1.1" } + + sctpNodeSelector = os.Getenv("SCTPTEST_NODE_SELECTOR") + if sctpNodeSelector == "" { + sctpNodeSelector = "node-role.kubernetes.io/worker-cnf=" + } } var _ = Describe("sctp", func() { diff --git a/hack/setup-test-cluster.sh b/hack/setup-test-cluster.sh index c1e33bd49..5e2503c9e 100755 --- a/hack/setup-test-cluster.sh +++ b/hack/setup-test-cluster.sh @@ -5,17 +5,12 @@ set -e # expect oc to be in PATH by default export OC_TOOL="${OC_TOOL:-oc}" -# Label 1 worker node as worker-rt -echo "[INFO]: Labeling 1 worker node with worker-rt" -node=$(${OC_TOOL} get nodes --selector='node-role.kubernetes.io/worker' -o name | head -1) -${OC_TOOL} label $node node-role.kubernetes.io/worker-rt="" - -# Label 2 worker node as worker-sctp -echo "[INFO]: Labeling 2 worker node with worker-sctp" -nodes=$(${OC_TOOL} get nodes --selector='node-role.kubernetes.io/worker' -o name | sed -n 2,3p) +# Label 2 worker nodes as worker-cnf +echo "[INFO]: Labeling 2 worker nodes with worker-cnf" +nodes=$(${OC_TOOL} get nodes --selector='node-role.kubernetes.io/worker' -o name | sed -n 1,2p) for node in $nodes do - ${OC_TOOL} label $node node-role.kubernetes.io/worker-sctp="" + ${OC_TOOL} label $node node-role.kubernetes.io/worker-cnf="" done @@ -25,22 +20,22 @@ cat <