-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create a tap device using nmcli with a hardcoded mac address - Start gvforwarder systemd service which will use this device Signed-off-by: vyasgun <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,12 +97,40 @@ if podman manifest inspect quay.io/crcont/routes-controller:${OPENSHIFT_VERSION} | |
image_tag=${OPENSHIFT_VERSION} | ||
fi | ||
|
||
# create the tap device interface with specified mac address | ||
# this mac address is used to allocate a specific IP to the VM | ||
# when tap device is in use. | ||
${SSH} core@${VM_IP} 'sudo bash -x -s' <<EOF | ||
nmcli connection delete tap0 | ||
nmcli connection add type tun ifname tap0 con-name tap0 mode tap autoconnect yes 802-3-ethernet.cloned-mac-address 5A:94:EF:E4:0C:EE | ||
EOF | ||
|
||
|
||
# Add gvisor-tap-vsock service | ||
${SSH} core@${VM_IP} 'sudo bash -x -s' <<EOF | ||
podman create --name=gvisor-tap-vsock --privileged --net=host -v /etc/resolv.conf:/etc/resolv.conf -it quay.io/crcont/gvisor-tap-vsock:latest | ||
podman generate systemd --restart-policy=no gvisor-tap-vsock > /etc/systemd/system/gvisor-tap-vsock.service | ||
podman create --name=gvisor-tap-vsock quay.io/crcont/gvisor-tap-vsock:latest | ||
podman cp gvisor-tap-vsock:/vm /usr/local/bin/gvforwarder | ||
podman rm gvisor-tap-vsock | ||
tee /etc/systemd/system/[email protected] <<TEE | ||
[Unit] | ||
Description=gvisor-tap-vsock Network Traffic Forwarder | ||
After=NetworkManager.service | ||
BindsTo=sys-devices-virtual-net-%i.device | ||
After=sys-devices-virtual-net-%i.device | ||
[Service] | ||
Environment=GV_VSOCK_PORT="1024" | ||
EnvironmentFile=-/etc/sysconfig/gv-user-network | ||
ExecStart=/usr/local/bin/gvforwarder -preexisting -iface %i -url vsock://2:\\\${GV_VSOCK_PORT}/connect -debug | ||
[Install] | ||
WantedBy=multi-user.target | ||
TEE | ||
systemctl daemon-reload | ||
systemctl enable gvisor-tap-vsock.service | ||
systemctl enable [email protected] | ||
systemctl start [email protected] | ||
EOF | ||
|
||
# Add dummy crio-wipe service to instance | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=gvisor-tap-vsock Network Traffic Forwarder | ||
After=NetworkManager.service | ||
BindsTo=sys-devices-virtual-net-%i.device | ||
After=sys-devices-virtual-net-%i.device | ||
[Service] | ||
Environment=GV_VSOCK_PORT="1024" | ||
EnvironmentFile=-/etc/sysconfig/gv-user-network | ||
ExecStart=/usr/libexec/podman/gvforwarder -preexisting -iface %i -url vsock://2:${GV_VSOCK_PORT}/connect | ||
[Install] | ||
WantedBy=multi-user.target |