Skip to content

Commit

Permalink
[do not merge] Testing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
abdallahyas committed Jul 14, 2021
1 parent 7ce6ce2 commit f514461
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
6 changes: 6 additions & 0 deletions admin-list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
admin-list:
- mellanox-ci
- abdysn
org-list:
- Mellanox

27 changes: 19 additions & 8 deletions hack/run-e2e-test-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ here="$(dirname "$(readlink --canonicalize "${BASH_SOURCE[0]}")")"
root="$(readlink --canonicalize "$here/..")"
export SRIOV_NETWORK_OPERATOR_IMAGE="${SRIOV_NETWORK_OPERATOR_IMAGE:-sriov-network-operator:latest}"
export SRIOV_NETWORK_CONFIG_DAEMON_IMAGE="${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE:-origin-sriov-network-config-daemon:latest}"
export KUBECONFIG="${KUBECONFIG:-${HOME}/.kube/config}"
export INTERFACES_SWITCHER="${INTERFACES_SWITCHER:-"go"}"
RETRY_MAX=10
INTERVAL=10
TIMEOUT=300
Expand Down Expand Up @@ -50,13 +52,14 @@ retry() {
echo "## checking requirements"
check_requirements
echo "## delete any existing cluster, deploy control & data plane cluster with KinD"
retry kind delete cluster && cat <<EOF | kind create cluster --config=-
retry kind delete cluster && cat <<EOF | kind create cluster --kubeconfig=${KUBECONFIG} --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
EOF
sudo chmod 644 ${KUBECONFIG}
echo "## build operator image"
retry docker build -t "${SRIOV_NETWORK_OPERATOR_IMAGE}" -f "${root}/Dockerfile" "${root}"
echo "## load operator image into KinD"
Expand All @@ -67,8 +70,6 @@ echo "## load daemon image into KinD"
kind load docker-image "${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE}"
echo "## export kube config for utilising locally"
kind export kubeconfig
echo "## exporting KUBECONFIG environment variable to access KinD K8 API server"
export KUBECONFIG="${HOME}/.kube/config"
echo "## wait for coredns"
retry kubectl -n kube-system wait --for=condition=available deploy/coredns --timeout=${TIMEOUT}s
echo "## install multus"
Expand All @@ -85,11 +86,21 @@ echo "## label KinD's control-plane-node as sriov capable"
kubectl label node kind-worker feature.node.kubernetes.io/network-sriov.capable=true --overwrite
echo "## label KinD worker as worker"
kubectl label node kind-worker node-role.kubernetes.io/worker= --overwrite
echo "## retrieving netns path from container"
netns_path="$(docker inspect --format '{{ .NetworkSettings.SandboxKey }}' "${kind_container}")"
echo "## exporting test device '${test_pf_pci_addr}' and test netns path '${netns_path}'"
export TEST_PCI_DEVICE="${test_pf_pci_addr}"
export TEST_NETNS_PATH="${netns_path}"
if [[ "${INTERFACES_SWITCHER}" == "bash_service" ]];then
pf="$(ls /sys/bus/pci/devices/${test_pf_pci_addr}/net)"
cat <<EOF > /etc/vf-switcher/vf-switcher.yaml
- netns: ${kind_container}
pfs:
- ${pf}
EOF
sudo systemctl restart vf-switcher.service
else
echo "## retrieving netns path from container"
netns_path="$(sudo docker inspect --format '{{ .NetworkSettings.SandboxKey }}' "${kind_container}")"
echo "## exporting test device '${test_pf_pci_addr}' and test netns path '${netns_path}'"
export TEST_PCI_DEVICE="${test_pf_pci_addr}"
export TEST_NETNS_PATH="${netns_path}"
fi
echo "## disabling webhooks"
export ENABLE_ADMISSION_CONTROLLER=false
echo "## deploying SRIOV Network Operator"
Expand Down
2 changes: 2 additions & 0 deletions hack/teardown-e2e-kind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ if ! command -v kind &> /dev/null; then
fi

kind delete cluster
sudo systemctl stop vf-switcher.service

0 comments on commit f514461

Please sign in to comment.