Skip to content

Commit 7eff160

Browse files
committed
[WIP] [Spike] gvforwarder as a systemd service
1 parent 78f9b5c commit 7eff160

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

createdisk.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,34 @@ if podman manifest inspect quay.io/crcont/routes-controller:${OPENSHIFT_VERSION}
9797
image_tag=${OPENSHIFT_VERSION}
9898
fi
9999

100+
# create the tap device interface with specified mac address
101+
# this mac address is used to allocate a specific IP to the VM
102+
# when tap device is in use.
103+
${SSH} core@${VM_IP} 'sudo bash -x -s' <<EOF
104+
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
105+
EOF
106+
107+
100108
# Add gvisor-tap-vsock service
101109
${SSH} core@${VM_IP} 'sudo bash -x -s' <<EOF
102-
podman create --name=gvisor-tap-vsock --privileged --net=host -v /etc/resolv.conf:/etc/resolv.conf -it quay.io/crcont/gvisor-tap-vsock:latest
103-
podman generate systemd --restart-policy=no gvisor-tap-vsock > /etc/systemd/system/gvisor-tap-vsock.service
110+
podman create --name=gvisor-tap-vsock quay.io/crcont/gvisor-tap-vsock:latest
111+
podman cp gvisor-tap-vsock:/vm /usr/local/bin/
112+
podman rm gvisor-tap-vsock
113+
tee /etc/systemd/system/gvisor-tap-vsock.service <<ETE
114+
[Unit]
115+
Description=gvisor-tap-vsock traffic forwarder
116+
Wants=network-online.target
117+
After=network-online.target
118+
119+
[Service]
120+
Restart=on-failure
121+
TimeoutStopSec=70
122+
ExecStart=/usr/local/bin/vm -preexisting -debug
123+
124+
[Install]
125+
WantedBy=default.target
126+
ETE
127+
104128
systemctl daemon-reload
105129
systemctl enable gvisor-tap-vsock.service
106130
EOF

0 commit comments

Comments
 (0)