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 simmilar to what we have on check-provision
lanes, it will verify that the cluster is healthy and
run conformance tests.

This script will be used on SR-IOV lane prow job command
in order to prevent bad changes to SR-IOV provider.

Signed-off-by: Or Mergi <[email protected]>
  • Loading branch information
ormergi committed Jul 19, 2021
1 parent d028ddb commit 12878b9
Show file tree
Hide file tree
Showing 2 changed files with 163 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": "057cfeb1-e982-417a-a1ba-c2088d8ba96d",
"Version": "v0.52.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": 21600
},
"Plugins": null,
"PluginSearchPath": [
"./plugins.d",
"/etc/sonobuoy/plugins.d",
"~/sonobuoy/plugins.d"
],
"Namespace": "sonobuoy",
"WorkerImage": "projects.registry.vmware.com/sonobuoy/sonobuoy:v0.52.0",
"ImagePullPolicy": "IfNotPresent",
"ImagePullSecrets": "",
"ProgressUpdatesPort": "8099"
}
75 changes: 75 additions & 0 deletions cluster-up/cluster/kind/check-cluster-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/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
echo "[$node] network interfaces status:"
docker exec ${node} ip a
echo ""
echo "[$node] route table:"
docker exec ${node} ip r
echo ""
echo "[$node] hosts file:"
docker exec ${node} cat /etc/hosts
echo ""
echo "[$node] resolve config:"
docker exec ${node} cat /etc/resolv.conf
echo ""
done

echo "Run conformance tests"
conformance_config=${PROVIDER_PATH}/conformance.json
if [ -f "${conformance_config}" ]; then
if [ "$RUN_KUBEVIRT_CONFORMANCE" == "true" ]; then
echo "Deploy Kubevirt"
LATEST=$(curl -L "https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/latest")
${kubectl} apply -f "https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-operator.yaml"
${kubectl} apply -f "https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-cr.yaml"

${kubectl} wait -n kubevirt kv kubevirt --for condition=Available --timeout 15m

echo "Run Kubevirt conformance tests"
export SONOBUOY_EXTRA_ARGS="--plugin https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/conformance.yaml"
hack/conformance.sh $conformance_config
fi

echo "Run K8S conformance tests"
export SONOBUOY_EXTRA_ARGS="--plugin systemd-logs --plugin e2e"
hack/conformance.sh $conformance_config
fi
)

0 comments on commit 12878b9

Please sign in to comment.