Skip to content

Commit

Permalink
cluster-up, kind, common: Enable TopologyManager for kind-sriov
Browse files Browse the repository at this point in the history
SRIOV tests check topology alignemnt. Currently in kind/sriov kueblet does not attempt to align resources hence topology tests don't really validate anything of interest.
Add topology manager[1] to kubelet config and set its policy to single-numa-node. Together with cpu-manager policy =static, which we already set, kubelet will reject a pod that it is unable to align.
It has been tested sucesfully in a kubevirt/kubevirt PR[2]
[1] https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/
[2] kubevirt/kubevirt#13685

Signed-off-by: Nir Dothan <[email protected]>
  • Loading branch information
nirdothan committed Jan 16, 2025
1 parent 212d3e4 commit 20855e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
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="restricted"
kind_up

configure_registry_proxy
Expand Down
28 changes: 22 additions & 6 deletions cluster-up/cluster/kind/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,20 +311,34 @@ EOF
done
}

function _add_kubeadm_config_patches() {
if [ $KUBEVIRT_WITH_KIND_ETCD_IN_MEMORY == "true" ]; then
cat <<EOF >> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
function _add_kubeadm_config_patches_header() {
cat <<EOF >> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
kubeadmConfigPatches:
- |
EOF
}

function _add_kubeadm_config_patches() {
_add_kubeadm_config_patches_header
if [ $KUBEVIRT_WITH_KIND_ETCD_IN_MEMORY == "true" ]; then
cat <<EOF >> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
kind: ClusterConfiguration
metadata:
name: config
etcd:
local:
dataDir: $ETCD_IN_MEMORY_DATA_DIR
EOF
echo "KIND cluster etcd data will be mounted to RAM on kind nodes: $ETCD_IN_MEMORY_DATA_DIR"
fi
echo "KIND cluster etcd data will be mounted to RAM on kind nodes: $ETCD_IN_MEMORY_DATA_DIR"
fi
if [[ -n "$CONFIG_TOPOLOGY_MANAGER_POLICY" ]]; then
cat <<EOF >> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
---
kind: KubeletConfiguration
topologyManagerPolicy: ${CONFIG_TOPOLOGY_MANAGER_POLICY}
---
EOF
fi
}

function _setup_ipfamily() {
Expand All @@ -339,7 +353,9 @@ EOF

function _prepare_kind_config() {
_add_workers
_add_kubeadm_config_patches
if [[ "$KUBEVIRT_WITH_KIND_ETCD_IN_MEMORY" == "true" || -n "$CONFIG_TOPOLOGY_MANAGER_POLICY" ]]; then
_add_kubeadm_config_patches
fi
_setup_ipfamily
echo "Final KIND config:"
cat ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
Expand Down

0 comments on commit 20855e2

Please sign in to comment.