Skip to content

Commit

Permalink
Add check-cluster-up script for KinD providers
Browse files Browse the repository at this point in the history
This script is similar to check-cluster-up script we run on
check-provision lanes.

It perform sanity check on the cluster, dump the nodes network
config and run Kubevirt conformance tests.
It support the following env vars:
- RUN_KUBEVIRT_CONFORMANCE
  Controls running Kubevirt conformance tests, default is 'false'
- SONOBUOY_EXTRA_ARGS
  This var content is passed to sonobuoy run command.

How to use:
export RUN_KUBEVIRT_CONFORMANCE="true"
export SONOBUOY_EXTRA_ARGS="--plugin-env kubevirt-conformance.E2E_FOCUS=sig-network"
./cluster-up/cluster/kind/check-cluster-up.sh

This script will be used by SR-IOV lane prow job command.
It will prevent bad changes to SRIOV provider to get in
And save the hassle to crease secondary PR's to debug a change
agaisnt kubevirt/kubevirt.

Signed-off-by: Or Mergi <[email protected]>
  • Loading branch information
ormergi committed Aug 9, 2021
1 parent 2dc4a38 commit 0ae3219
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 0 deletions.
88 changes: 88 additions & 0 deletions cluster-up/cluster/kind-1.19-sriov/conformance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"Description": "DEFAULT",
"UUID": "c3bc7d76-6ce8-4c8a-8bcb-5c7ae5fb22a3",
"Version": "v0.50.0",
"ResultsDir": "/tmp/sonobuoy",
"Resources": [
"apiservices",
"certificatesigningrequests",
"clusterrolebindings",
"clusterroles",
"componentstatuses",
"configmaps",
"controllerrevisions",
"cronjobs",
"customresourcedefinitions",
"daemonsets",
"deployments",
"endpoints",
"ingresses",
"jobs",
"leases",
"limitranges",
"mutatingwebhookconfigurations",
"namespaces",
"networkpolicies",
"nodes",
"persistentvolumeclaims",
"persistentvolumes",
"poddisruptionbudgets",
"pods",
"podlogs",
"podsecuritypolicies",
"podtemplates",
"priorityclasses",
"replicasets",
"replicationcontrollers",
"resourcequotas",
"rolebindings",
"roles",
"servergroups",
"serverversion",
"serviceaccounts",
"services",
"statefulsets",
"storageclasses",
"validatingwebhookconfigurations",
"volumeattachments"
],
"Filters": {
"Namespaces": ".*",
"LabelSelector": ""
},
"Limits": {
"PodLogs": {
"Namespaces": "",
"SonobuoyNamespace": true,
"FieldSelectors": [],
"LabelSelector": "",
"Previous": false,
"SinceSeconds": null,
"SinceTime": null,
"Timestamps": false,
"TailLines": null,
"LimitBytes": null,
"LimitSize": "",
"LimitTime": ""
}
},
"QPS": 30,
"Burst": 50,
"Server": {
"bindaddress": "0.0.0.0",
"bindport": 8080,
"advertiseaddress": "",
"timeoutseconds": 10800
},
"Plugins": null,
"PluginSearchPath": [
"./plugins.d",
"/etc/sonobuoy/plugins.d",
"~/sonobuoy/plugins.d"
],
"Namespace": "sonobuoy",
"WorkerImage": "projects.registry.vmware.com/sonobuoy/sonobuoy:v0.50.0",
"ImagePullPolicy": "IfNotPresent",
"ImagePullSecrets": "",
"ProgressUpdatesPort": "8099"
}
76 changes: 76 additions & 0 deletions cluster-up/cluster/kind/check-cluster-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
#
# This file is part of the KubeVirt project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2021 Red Hat, Inc.

set -exuo pipefail

SCRIPT_PATH=$(dirname "$(realpath "$0")")

kubevirtci_path="$(realpath "${SCRIPT_PATH}/../../..")/"
PROVIDER_PATH="${kubevirtci_path}/cluster-up/cluster/${KUBEVIRT_PROVIDER}"

RUN_KUBEVIRT_CONFORMANCE=${RUN_KUBEVIRT_CONFORMANCE:-"false"}

(
cd $kubevirtci_path
kubectl="./cluster-up/kubectl.sh"
echo "Wait for pods to be ready.."
timeout 5m bash -c "until ${kubectl} wait --for=condition=Ready pod --timeout=30s --all -A; do sleep 1; done"
timeout 5m bash -c "until ${kubectl} wait --for=condition=Ready pod --timeout=30s -n kube-system --all; do sleep 1; done"
${kubectl} get nodes
${kubectl} get pods -A
echo ""

nodes=$(${kubectl} get no --no-headers | awk '{print $1}')
for node in $nodes; do
node_exec="docker exec ${node}"
echo "[$node] network interfaces status:"
${node_exec} ip a
echo ""
echo "[$node] route table:"
${node_exec} ip r
echo ""
echo "[$node] hosts file:"
${node_exec} cat /etc/hosts
echo ""
echo "[$node] resolve config:"
${node_exec} cat /etc/resolv.conf
echo ""
done

if [ "$RUN_KUBEVIRT_CONFORMANCE" == "true" ]; then
nightly_build_base_url="https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt"
latest=$(curl -L "${nightly_build_base_url}/latest")

echo "Deploy latest nighly build Kubevirt"
if [ $(kubectl get kubevirts -n kubevirt kubevirt -ojsonpath='{.status.phase}') != "Deployed"; then
${kubectl} apply -f "${nightly_build_base_url}/${latest}/kubevirt-operator.yaml"
${kubectl} apply -f "${nightly_build_base_url}/${latest}/kubevirt-cr.yaml"
fi
${kubectl} wait -n kubevirt kv kubevirt --for condition=Available --timeout 15m

echo "Run latest nighly build Kubevirt conformance tests"
kubevirt_plugin="--plugin ${nightly_build_base_url}/${latest}/conformance.yaml"
SONOBUOY_EXTRA_ARGS="${kubevirt_plugin} ${SONOBUOY_EXTRA_ARGS}"

commit=$(curl -L "${nightly_build_base_url}/${latest}/commit")
container_tag="--plugin-env kubevirt-conformance.CONTAINER_TAG=${latest}_${commit:0:9}"
SONOBUOY_EXTRA_ARGS="${container_tag} ${SONOBUOY_EXTRA_ARGS}"

hack/conformance.sh ${PROVIDER_PATH}/conformance.json
fi
)

0 comments on commit 0ae3219

Please sign in to comment.