Skip to content

Instantly share code, notes, and snippets.

@oshoval
Last active November 20, 2024 09:50
Deploy OVN with custom kubevirt (via kubevirt cluster-sync)
export CRI_BIN=${CRI_BIN:-docker}
# cd ovn-k8s
# add the local registry (--local-kind-registry / -lr) to the command
pushd contrib; ./kind.sh --multi-network-enable -ic -nse -ikv -lr -i6; popd
export KUBECONFIG=$(realpath ~/ovn.conf)
# cd kubevirt
export DOCKER_PREFIX=localhost:5000
export KUBEVIRT_PROVIDER=external
make cluster-sync
# copy passt binary that was yield by kubevirt cluster-sync
kubectl delete ds -n kube-system passt-binding-cni || true
for node in $(kubectl get nodes -o custom-columns=:.metadata.name --no-headers); do
${CRI_BIN:-docker} cp ./_out/cmd/cniplugins/kubevirt-passt-binding $node:/opt/cni/bin/network-passt-binding
done
# since kubevirt was deleted as part of cluster-sync we must patch CNAO CR
kubectl -n kubevirt patch kubevirt kubevirt --type=json --patch '[{"op":"add","path":"/spec/configuration/developerConfiguration","value":{"featureGates":[]}},{"op":"add","path":"/spec/configuration/developerConfiguration/featureGates/-","value":"NetworkBindingPlugins"},{"op":"add","path":"/spec/configuration/developerConfiguration/featureGates/-","value":"DynamicPodInterfaceNaming"}]'
passt_binding_image="localhost:5000/network-passt-binding:devel"
kubectl -n kubevirt patch kubevirt kubevirt --type=json --patch '[{"op":"add","path":"/spec/configuration/network","value":{}},{"op":"add","path":"/spec/configuration/network/binding","value":{"passt":{"computeResourceOverhead":{"requests":{"memory":"500Mi"}},"migration":{"method":"link-refresh"},"networkAttachmentDefinition":"default/primary-udn-kubevirt-binding","sidecarImage":"'"${passt_binding_image}"'"}}}]'
kubectl -n kubevirt patch kubevirt kubevirt --type=merge --patch '{"spec":{"configuration":{"virtualMachineOptions":{"disableSerialConsoleLog":{}}}}}'
@oshoval
Copy link
Author

oshoval commented Nov 20, 2024

for managedTap use

passt_binding_image="localhost:5000/network-passt-binding:devel"
kubectl -n kubevirt patch kubevirt kubevirt --type=json --patch '[{"op":"add","path":"/spec/configuration/network","value":{}},{"op":"add","path":"/spec/configuration/network/binding","value":{"passt":{"computeResourceOverhead":{"requests":{"memory":"500Mi"}},"migration":{"method":"link-refresh"},"networkAttachmentDefinition":"default/primary-udn-kubevirt-binding","sidecarImage":"'"${passt_binding_image}"'"},"managedTap":{"domainAttachmentType":"managedTap","migration":{}}}}]'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment