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

Update kubevirtci with new rook ceph, 1.32 lanes #3624

Merged
merged 3 commits into from
Mar 5, 2025
Merged
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
2 changes: 1 addition & 1 deletion automation/ceph-wffc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.30
export TARGET=k8s-1.31
#ensure no hard coded cdi cr in tests.
export RANDOM_CR=true
export KUBEVIRT_STORAGE=rook-ceph-default
Expand Down
2 changes: 1 addition & 1 deletion automation/ceph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.30
export TARGET=k8s-1.31
#ensure no hard coded cdi cr in tests.
export RANDOM_CR=true
export KUBEVIRT_STORAGE=rook-ceph-default
Expand Down
2 changes: 1 addition & 1 deletion automation/destructive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_STORAGE=hpp
export KUBEVIRT_DEPLOY_PROMETHEUS=true
export CDI_E2E_FOCUS=Destructive
Expand Down
2 changes: 1 addition & 1 deletion automation/istio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_STORAGE=hpp
export CDI_E2E_SKIP=Destructive
export KUBEVIRT_DEPLOY_ISTIO=true
Expand Down
2 changes: 1 addition & 1 deletion automation/latest-hpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_STORAGE=hpp
export CDI_E2E_SKIP=Destructive
automation/test.sh
2 changes: 1 addition & 1 deletion automation/nfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_DEPLOY_NFS_CSI=true
export KUBEVIRT_STORAGE=nfs
export CDI_E2E_SKIP=Destructive
Expand Down
2 changes: 1 addition & 1 deletion automation/non-csi-hpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_STORAGE=hpp
export HPP_CLASSIC=true
export CDI_E2E_SKIP=Destructive
Expand Down
2 changes: 1 addition & 1 deletion automation/previous-hpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.30
export TARGET=k8s-1.31
export KUBEVIRT_STORAGE=hpp
export KUBEVIRT_DEPLOY_PROMETHEUS=true
export CDI_E2E_SKIP=Destructive
Expand Down
2 changes: 1 addition & 1 deletion automation/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

set -ex
export TARGET=k8s-1.31
export TARGET=k8s-1.32
export KUBEVIRT_STORAGE=hpp
export MULTI_UPGRADE=true
export CDI_E2E_SKIP=Destructive
Expand Down
3 changes: 2 additions & 1 deletion cluster-up/cluster/ephemeral-provider-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ function _add_common_params() {
params=" --container-suffix=:$KUBEVIRTCI_CONTAINER_SUFFIX $params"
fi

if [[ ${KUBEVIRT_SLIM} == "true" ]]; then
# Currently, the s390x architecture supports only KUBEVIRT_SLIM.
if [[ ${KUBEVIRT_SLIM} == "true" || $(uname -m) == "s390x" ]]; then
params=" --slim $params"
fi
fi
Expand Down
9 changes: 0 additions & 9 deletions cluster-up/cluster/k8s-1.29/provider.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cluster-up/cluster/k8s-provider-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@ function wait_for_kwok_ready() {
fi
}

function configure_cpu_manager() {
if [ ${KUBEVIRT_CPU_MANAGER_POLICY} == "static" ]; then
for node in $($kubectl get nodes -l "node-role.kubernetes.io/worker" --no-headers -o custom-columns=":metadata.name" | tr -d '\r'); do
# FIXME Replace with kubelet config drop ins once all providers are using k8s >= 1.28
# https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/#kubelet-conf-d
$kubectl drain ${node}
$ssh ${node} -- sudo systemctl stop kubelet
# FIXME ${ssh} is broken when using HereDocs, fix and replace this mess if possible.
# https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#configuration
$ssh ${node} -- "sudo rm -f /var/lib/kubelet/cpu_manager_state && sudo echo -e 'cpuManagerPolicy: static\nkubeReserved:\n cpu: \"1\"\n memory: \"1Gi\"\ncpuManagerPolicyOptions:\n full-pcpus-only: \"true\"' | sudo tee -a /var/lib/kubelet/config.yaml && sudo sed -i 's/cpuManagerReconcilePeriod\:\ 0s/cpuManagerReconcilePeriod\:\ 5s/g' /var/lib/kubelet/config.yaml"
$ssh ${node} -- sudo systemctl start kubelet
$kubectl label --overwrite node/${node} cpumanager=true
$kubectl uncordon ${node}
done
fi
}

function up() {
params=$(_add_common_params)
if echo "$params" | grep -q ERROR; then
Expand Down Expand Up @@ -90,7 +73,6 @@ function up() {
$kubectl label node -l $label node-role.kubernetes.io/worker=''

configure_prometheus
configure_cpu_manager

deploy_kwok

Expand Down
1 change: 1 addition & 0 deletions cluster-up/cluster/kind-1.28/provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function up() {
cp $KIND_MANIFESTS_DIR/kind.yaml ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
_add_kubeadm_cpu_manager_config_patch
_add_extra_mounts
_add_extra_portmapping
export CONFIG_WORKER_CPU_MANAGER=true
kind_up

Expand Down
44 changes: 44 additions & 0 deletions cluster-up/cluster/kind-1.31/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# K8S with mdev support in a Kind cluster

Provides a pre-deployed k8s cluster that runs using [kind](https://github.com/kubernetes-sigs/kind) The cluster is completely ephemeral and is recreated on every cluster restart.
The KubeVirt containers are built on the local machine and are then pushed to a registry which is exposed at
`localhost:5000`.

## Bringing the cluster up

The following needs to be executed as root. Please refer to the name of the directory to get the kind version.

```bash
export KUBEVIRT_PROVIDER=kind-x.yz
make cluster-up
```

The cluster can be accessed as usual:

```bash
$ cluster-up/kubectl.sh get nodes
NAME STATUS ROLES AGE
kind-x.yz-control-plane Ready master 6m14s
```

## Bringing the cluster down

```bash
make cluster-down
```

This destroys the whole cluster.

## Setting a custom kind version

In order to use a custom kind image / kind version,
export KIND_NODE_IMAGE, KIND_VERSION before running cluster-up.
For example in order to use kind 0.9.0 (which is based on k8s-1.19.1) use:
```bash
export KIND_NODE_IMAGE="kindest/node:v1.19.1@sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600"
export KIND_VERSION="0.9.0"
```
This allows users to test or use custom images / different kind versions before making them official.
See https://github.com/kubernetes-sigs/kind/releases for details about node images according to the kind version.

- In order to use `make cluster-down` please make sure the right `CLUSTER_NAME` is exported.
47 changes: 47 additions & 0 deletions cluster-up/cluster/kind-1.31/conformance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Description": "DEFAULT",
"UUID": "",
"Version": "v0.56.9",
"ResultsDir": "/tmp/sonobuoy/results",
"Resources": null,
"Filters": {
"Namespaces": ".*",
"LabelSelector": ""
},
"Limits": {
"PodLogs": {
"Namespaces": "kube-system",
"SonobuoyNamespace": true,
"FieldSelectors": [],
"LabelSelector": "",
"Previous": false,
"SinceSeconds": null,
"SinceTime": null,
"Timestamps": false,
"TailLines": null,
"LimitBytes": null
}
},
"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": "sonobuoy/sonobuoy:v0.56.9",
"ImagePullPolicy": "IfNotPresent",
"ImagePullSecrets": "",
"AggregatorPermissions": "clusterAdmin",
"ServiceAccountName": "sonobuoy-serviceaccount",
"ProgressUpdatesPort": "8099",
"SecurityContextMode": "nonroot"
}
1 change: 1 addition & 0 deletions cluster-up/cluster/kind-1.31/image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e
54 changes: 54 additions & 0 deletions cluster-up/cluster/kind-1.31/provider.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -e

DEFAULT_CLUSTER_NAME="kind-1.31"
DEFAULT_HOST_PORT=5000
ALTERNATE_HOST_PORT=5001
export CLUSTER_NAME=${CLUSTER_NAME:-$DEFAULT_CLUSTER_NAME}

if [ $CLUSTER_NAME == $DEFAULT_CLUSTER_NAME ]; then
export HOST_PORT=$DEFAULT_HOST_PORT
else
export HOST_PORT=$ALTERNATE_HOST_PORT
fi

function set_kind_params() {
version=$(cat "${KUBEVIRTCI_PATH}/cluster/$KUBEVIRT_PROVIDER/version")
export KIND_VERSION="${KIND_VERSION:-$version}"

image=$(cat "${KUBEVIRTCI_PATH}/cluster/$KUBEVIRT_PROVIDER/image")
export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-$image}"
}

function configure_registry_proxy() {
[ "$CI" != "true" ] && return

echo "Configuring cluster nodes to work with CI mirror-proxy..."

local -r ci_proxy_hostname="docker-mirror-proxy.kubevirt-prow.svc"
local -r kind_binary_path="${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind"
local -r configure_registry_proxy_script="${KUBEVIRTCI_PATH}/cluster/kind/configure-registry-proxy.sh"

KIND_BIN="$kind_binary_path" PROXY_HOSTNAME="$ci_proxy_hostname" $configure_registry_proxy_script
}

function up() {
cp $KIND_MANIFESTS_DIR/kind.yaml ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
_add_kubeadm_cpu_manager_config_patch
_add_extra_mounts
_add_extra_portmapping
export CONFIG_WORKER_CPU_MANAGER=true
kind_up

configure_registry_proxy

# remove the rancher.io kind default storageClass
_kubectl delete sc standard

echo "$KUBEVIRT_PROVIDER cluster '$CLUSTER_NAME' is ready"
}

set_kind_params

source ${KUBEVIRTCI_PATH}/cluster/kind/common.sh
1 change: 1 addition & 0 deletions cluster-up/cluster/kind-1.31/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.25.0
1 change: 1 addition & 0 deletions cluster-up/cluster/kind-sriov/provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function deploy_sriov() {
function up() {
cp $KIND_MANIFESTS_DIR/kind.yaml ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
export CONFIG_WORKER_CPU_MANAGER=true
export CONFIG_TOPOLOGY_MANAGER_POLICY="single-numa-node"
kind_up

configure_registry_proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ resources:
- sriov-cni-daemonset.yaml
- sriovdp-daemonset.yaml
- sriovdp-config.yaml
patchesJson6902:
patches:
- target:
group: apps
version: v1
kind: DaemonSet
name: kube-sriov-cni-ds-amd64
name: kube-sriov-cni-ds
path: patch-node-selector.yaml
- target:
group: apps
version: v1
kind: DaemonSet
name: kube-sriov-device-plugin-amd64
name: kube-sriov-device-plugin
path: patch-node-selector.yaml
- target:
group: apps
version: v1
kind: DaemonSet
name: kube-sriov-device-plugin-amd64
name: kube-sriov-device-plugin
path: patch-sriovdp-resource-prefix.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- op: add
path: /spec/template/spec/nodeSelector
value: {}
- op: add
path: /spec/template/spec/nodeSelector/$LABEL_KEY
value: "$LABEL_VALUE"
- op: test
path: /spec/template/spec/nodeSelector/$LABEL_KEY
value: "$LABEL_VALUE"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kube-sriov-cni-ds-amd64
name: kube-sriov-cni-ds
namespace: kube-system
labels:
tier: node
Expand All @@ -18,15 +18,16 @@ spec:
tier: node
app: sriov-cni
spec:
nodeSelector:
kubernetes.io/arch: amd64
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
containers:
- name: kube-sriov-cni
image: ghcr.io/k8snetworkplumbingwg/sriov-cni:v2.7.0
image: ghcr.io/k8snetworkplumbingwg/sriov-cni:v2.9.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down
Loading