Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubevirtci 1.25 provider #872

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cluster-provision/k8s/1.25/base
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
centos8
55 changes: 55 additions & 0 deletions cluster-provision/k8s/1.25/bind_device_to_vfio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

set -ex

if [ "$1" != "--vendor" ]; then
echo "No vendor provided"
exit 1
fi
vendor=$2

function get_device_driver() {
local dev_driver=$(readlink $driver_path)
echo "${dev_driver##*/}"
}

# find the PCI address of the device by vendor_id:product_id
pci_address=(`lspci -D -d ${vendor}`)
pci_address="${pci_address[0]}"
dev_sysfs_path="/sys/bus/pci/devices/$pci_address"

if [[ ! -d $dev_sysfs_path ]]; then
echo "Error: PCI address ${pci_address} does not exist!" 1>&2
exit 1
fi

if [[ ! -d "$dev_sysfs_path/iommu/" ]]; then
echo "Error: No vIOMMU found in the VM" 1>&2
exit 1
fi

# set device driver path
driver_path="${dev_sysfs_path}/driver"
driver_override="${dev_sysfs_path}/driver_override"

# load the vfio-pci module
modprobe -i vfio-pci


driver=$(get_device_driver)

if [[ "$driver" != "vfio-pci" ]]; then

# unbind from the original device driver
echo ${pci_address} > "${driver_path}/unbind"
# bind the device to vfio-pci driver
echo "vfio-pci" > ${driver_override}
echo $pci_address > /sys/bus/pci/drivers/vfio-pci/bind
fi

# The device should now be using the vfio-pci driver
new_driver=$(get_device_driver)
if [[ $new_driver != "vfio-pci" ]]; then
echo "Error: Failed to bind to vfio-pci driver" 1>&2
exit 1
fi
88 changes: 88 additions & 0 deletions cluster-provision/k8s/1.25/conformance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"Description": "DEFAULT",
"UUID": "424db535-cd5d-4968-9667-0b11c6fd380c",
"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": "sonobuoy/sonobuoy:v0.50.0",
"ImagePullPolicy": "IfNotPresent",
"ImagePullSecrets": "",
"ProgressUpdatesPort": "8099"
}
10 changes: 10 additions & 0 deletions cluster-provision/k8s/1.25/extra-pre-pull-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
quay.io/kubevirtci/grafana-grafana:7.5.4
quay.io/kubevirtci/install-cni:1.10.0
quay.io/kubevirtci/operator:1.10.0
quay.io/kubevirtci/pilot:1.10.0
quay.io/kubevirtci/proxyv2:1.10.0
quay.io/prometheus-operator/prometheus-config-reloader:v0.47.0
quay.io/calico/cni:v3.18.0
quay.io/calico/kube-controllers:v3.18.0
quay.io/calico/node:v3.18.0
quay.io/calico/pod2daemon-flexvol:v3.18.0
54 changes: 54 additions & 0 deletions cluster-provision/k8s/1.25/fetch-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

set -euo pipefail

function usage() {
cat <<EOF
Usage: $0 <k8s-cluster-dir> [source-image-list]

Fetches all images from the cluster provision source and manifests. Returns a list that is sorted and
without double entries.

If source-image-list is provided this is taken as an input and added to the result.

EOF
}

function check_args() {
if [ "$#" -lt 1 ]; then
usage
exit 1
fi
if [ ! -d "$1" ]; then
usage
echo "Directory $1 does not exist"
exit 1
fi
}

function main() {
check_args "$@"

temp_file=$(mktemp)
trap 'rm -f "${temp_file}"' EXIT SIGINT SIGTERM

provision_dir="$1"
image_regex='([a-z0-9\_\.]+[/-]?)+(@sha256)?:[a-z0-9\_\.\-]+'
image_regex_w_double_quotes='"?'"${image_regex}"'"?'

(
# Avoid bailing out because of nothing found in scripts part
set +e
find "$provision_dir" -type f -name '*.sh' -print0 |
xargs -0 grep -iE '(docker|podman)[ _]pull[^ ]+ '"${image_regex_w_double_quotes}"
find "$provision_dir" -type f -name '*.yaml' -print0 |
xargs -0 grep -iE '(image|value): '"${image_regex_w_double_quotes}"
set -e
# last `grep -v` is necessary to avoid trying to pre pull istio "images", as the regex also matches on values
# from the generated istio deployment manifest
) | grep -ioE "${image_regex_w_double_quotes}"'$' | grep -v '.svc:' >>"${temp_file}"

sed -E 's/"//g' "${temp_file}" | sort | uniq
}

main "$@"
49 changes: 49 additions & 0 deletions cluster-provision/k8s/1.25/istio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
set -xe

source /var/lib/kubevirtci/shared_vars.sh

export PATH=$ISTIO_BIN_DIR:$PATH

kubectl --kubeconfig /etc/kubernetes/admin.conf create ns istio-system
istioctl --kubeconfig /etc/kubernetes/admin.conf --hub quay.io/kubevirtci operator init

istio_manifests_dir=/opt/istio
mkdir -p /opt/istio
cat <<EOF >$istio_manifests_dir/istio-operator.tpl.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istio-operator
spec:
profile: demo
hub: quay.io/kubevirtci
components:
cni:
enabled: true
namespace: kube-system
values:
global:
jwtPolicy: first-party-jwt
cni:
chained: \$ISTIO_CNI_CHAINED
cniBinDir: /opt/cni/bin
cniConfDir: \$ISTIO_CNI_CONF_DIR
excludeNamespaces:
- istio-system
- kube-system
logLevel: debug
EOF

# generate istio-operator for usage with cnao enabled
ISTIO_CNI_CHAINED=false ISTIO_CNI_CONF_DIR=/etc/cni/multus/net.d envsubst < $istio_manifests_dir/istio-operator.tpl.yaml > $istio_manifests_dir/istio-operator-with-cnao.cr.yaml
cat <<EOF >>$istio_manifests_dir/istio-operator-with-cnao.yaml
cniConfFileName: "istio-cni.conf"
sidecarInjectorWebhook:
injectedAnnotations:
"k8s.v1.cni.cncf.io/networks": istio-cni
EOF

# generate istio-operator cr for usage without cnao
ISTIO_CNI_CHAINED=true ISTIO_CNI_CONF_DIR=/etc/cni/net.d envsubst < $istio_manifests_dir/istio-operator.tpl.yaml > $istio_manifests_dir/istio-operator.cr.yaml
Loading