Skip to content

Instantly share code, notes, and snippets.

@ormergi
Last active July 3, 2022 14:20
Show Gist options
  • Save ormergi/8ac7da8efad3d6b5fe3c57edcc212e1b to your computer and use it in GitHub Desktop.
Save ormergi/8ac7da8efad3d6b5fe3c57edcc212e1b to your computer and use it in GitHub Desktop.
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: sriov-net-vlan100
namespace: default
annotations:
k8s.v1.cni.cncf.io/resourceName: kubevirt.io/sriov_net
spec:
config: |
{
"cniVersion":"0.3.1",
"name":"sriov-network",
"type":"sriov",
"vlan":100,
"spoofchk":"on",
"trust":"off",
"vlanQoS":0,
"link_state":"enable",
"ipam":{}
}
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: sriov-net-vlan200
namespace: default
annotations:
k8s.v1.cni.cncf.io/resourceName: kubevirt.io/sriov_net
spec:
config: |
{
"cniVersion":"0.3.1",
"name":"sriov-network",
"type":"sriov",
"vlan":200,
"spoofchk":"on",
"trust":"off",
"vlanQoS":0,
"link_state":"enable",
"ipam":{}
}
---
kind: VirtualMachineInstance
apiVersion: kubevirt.io/v1alpha3
metadata:
name: sriov-vmi
spec:
domain:
resources:
requests:
memory: "512M"
cpu:
cores: 1
sockets: 1
threads: 1
machine:
type: q35
features:
acpi:
enabled: true
devices:
disks:
- name: disk0
disk:
bus: virtio
- name: disk1
disk:
bus: virtio
interfaces:
- name: default
masquerade: {}
- name: sriovnet100
sriov: {}
macAddress: 02:00:00:00:00:01
- name: sriovnet200
sriov: {}
macAddress: 02:00:00:00:00:02
rng: {}
networks:
- name: default
pod: {}
- name: sriovnet100
multus:
networkName: sriov-net-vlan100
- name: sriovnet200
multus:
networkName: sriov-net-vlan200
volumes:
- name: disk0
containerDisk:
image: quay.io/kubevirt/fedora-with-test-tooling-container-disk:v0.50.0-rc.0
imagePullPolicy: IfNotPresent
- name: disk1
cloudInitNoCloud:
networkData: |
version: 2
ethernets:
sriov1:
addresses:
- 192.168.100.100/24
match:
macaddress: 02:00:00:00:00:01
set-name: sriov100
sriov2:
addresses:
- 192.168.200.100/24
match:
macaddress: 02:00:00:00:00:02
set-name: sriov200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment