-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gvforwarder as a systemd service #1003
base: release-4.17
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,12 +97,38 @@ 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 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we run this after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way I see this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
This makes sure the interface exists before the
From this, it is not clear when a However, ordering the unit after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes and looking at the CI failure I think it hit the network failure so let's stick to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this and we should keep the |
||
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 | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
||
TEE | ||
systemctl daemon-reload | ||
systemctl enable gvisor-tap-vsock.service | ||
systemctl enable [email protected] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... I like how this can be targeted with For this increment, this would work. But most likely would change with the self-sufficient bundle. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
EOF | ||
|
||
# Add dummy crio-wipe service to instance | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this equivalent to
${SSH} core@${VM_IP} 'sudo 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'
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In short; you are questioning why this needs to be wrapped in a
sudo bash -x -s
.Would otherwise an error occur? I do not see characters that would be wrongly interpreted by the host shell (like zsh could do).
@anjannath How was this solved for the self-sufficient bundle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not being changed for the self-sufficient bundle, its been tested with the existing situation which is that there is a container image which runs the
gvforwarder
and that container also has a dhcp client script which configures the interface using the dhcp service from gvisor-tap-vsockThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can also scp the
NetworkManger
config file to/etc/NetworkManager/system-connections
instead of runningnmcli
commands, there's a config file in: https://github.com/containers/gvisor-tap-vsock/blob/main/contrib/networkmanager/vsock0.nmconnection