Skip to content

Commit

Permalink
Merge pull request openshift-kni#25 from fedepaol/ci-sctp-setup
Browse files Browse the repository at this point in the history
Have a custom pool that matches two out of three nodes.
  • Loading branch information
openshift-merge-robot authored Jan 22, 2020
2 parents 810389e + df22407 commit 73e88c9
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions feature-configs/base/sctp/is_ready.sh
Original file line number Diff line number Diff line change
@@ -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 worker-cnf -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/worker-cnf --for condition=updated --timeout 1s
2 changes: 1 addition & 1 deletion feature-configs/base/sctp/sctp_module_mc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion feature-configs/e2e-gcp/sctp/sctp_module_mc_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
machineconfiguration.openshift.io/role: worker-cnf
name: load-sctp-module
11 changes: 9 additions & 2 deletions functests/sctp/sctp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "quay.io/fpaoline/sctptester:v1.0"
}

sctpNodeSelector = os.Getenv("SCTPTEST_NODE_SELECTOR")
if sctpNodeSelector == "" {
sctpNodeSelector = "node-role.kubernetes.io/worker-cnf="
}
}

var _ = Describe("sctp", func() {
Expand Down
41 changes: 31 additions & 10 deletions hack/setup-test-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,45 @@ 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


# 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 <<EOF | ${OC_TOOL} apply -f -
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: worker-cnf
labels:
worker-cnf: ""
spec:
machineConfigSelector:
matchExpressions:
- {
key: machineconfiguration.openshift.io/role,
operator: In,
values: [worker-cnf, worker],
}
maxUnavailable: null
paused: false
nodeSelector:
matchLabels:
node-role.kubernetes.io/worker-cnf: ""
---
EOF

echo "[INFO]: Pausing"
# TODO patching to prevent https://bugzilla.redhat.com/show_bug.cgi?id=1792749 from happening
# remove this once the bug is fixed
mcps=$(${OC_TOOL} get mcp --no-headers -o custom-columns=":metadata.name")
for mcp in $mcps
do
${OC_TOOL} patch mcp "${mcp}" -p '{"spec":{"paused":true}}' --type=merge
done
done

0 comments on commit 73e88c9

Please sign in to comment.