Skip to content
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

add non root ovs-user-id to ovn container image to rebuild #2044

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/ovn/templates/bin/_ovn-controller-init.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,8 @@ do
then
ovs-vsctl --may-exist add-port $bridge $iface
migrate_ip_from_nic $iface $bridge
# update bridge socket file to non root owner 42424
chown 42424:42424 /var/run/openvswitch/*.mgmt
chown 42424:42424 /var/run/openvswitch/*.snoop
fi
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/charts/ovn/templates/bin/_ovn-controller-init.sh.tpl b/charts/ovn/templates/bin/_ovn-controller-init.sh.tpl
index b1960212..8da8416f 100644
--- a/ovn/templates/bin/_ovn-controller-init.sh.tpl
+++ b/ovn/templates/bin/_ovn-controller-init.sh.tpl
@@ -169,5 +169,8 @@ do
then
ovs-vsctl --may-exist add-port $bridge $iface
migrate_ip_from_nic $iface $bridge
+ # update bridge socket file to non root owner 42424
+ chown 42424:42424 /var/run/openvswitch/*.mgmt
+ chown 42424:42424 /var/run/openvswitch/*.snoop
fi
done
8 changes: 8 additions & 0 deletions images/ovn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ EOF
COPY --from=ovn-kubernetes --link /src/dist/images/ovndb-raft-functions.sh /root/ovndb-raft-functions.sh
COPY --from=ovn-kubernetes --link /src/dist/images/ovnkube.sh /root/ovnkube.sh
COPY --from=ovn-kubernetes --link /usr/bin/ovn-kube-util /usr/bin/ovn-kube-util

ARG PROJECT=ovn
ENV OVS_USER_ID=42424
RUN \
groupadd -g 42424 ${PROJECT} && \
useradd -u 42424 -g 42424 -M -d /var/lib/${PROJECT} -s /sbin/nologin -c "${PROJECT} User" ${PROJECT} && \
mkdir -p /etc/${PROJECT} /var/log/${PROJECT} /var/lib/${PROJECT} /var/run/${PROJECT} && \
chown -Rv ${PROJECT}:${PROJECT} /etc/${PROJECT} /var/log/${PROJECT} /var/lib/${PROJECT} /var/run/${PROJECT}