Add Linux CP: create 'dataplane' network namespace, move to init-container.sh to do the plumbing
This commit is contained in:
@ -2,15 +2,21 @@ FROM debian:bookworm
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG VPP_INSTALL_SKIP_SYSCTL=true
|
||||
ARG REPO=release
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install curl procps tcpdump iproute2 iptables binutils \
|
||||
bridge-utils iputils-ping netcat-traditional net-tools nmap \
|
||||
python3 python3-dev python3-pip
|
||||
RUN apt-get update && apt-get -y install curl procps tcpdump iproute2 iptables \
|
||||
iputils-ping net-tools git python3 python3-pip && apt-get clean
|
||||
|
||||
# Install VPP
|
||||
RUN mkdir -p /var/log/vpp
|
||||
RUN curl -s https://packagecloud.io/install/repositories/fdio/${REPO}/script.deb.sh | bash
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install vpp vpp-plugin-core
|
||||
RUN apt-get -y clean
|
||||
COPY files/startup.conf /etc/vpp/startup.conf
|
||||
COPY files/*.vpp /etc/vpp/
|
||||
CMD ["/usr/bin/vpp","-c","/etc/vpp/startup.conf"]
|
||||
RUN apt-get update && apt-get -y install vpp vpp-plugin-core && apt-get clean
|
||||
|
||||
# Build vppcfg
|
||||
RUN pip install --break-system-packages build netaddr yamale argparse pyyaml ipaddress
|
||||
RUN git clone https://github.com/pimvanpelt/vppcfg.git && cd vppcfg && python3 -m build && \
|
||||
pip install --break-system-packages dist/vppcfg-*-py3-none-any.whl
|
||||
|
||||
# Config files
|
||||
COPY files/startup.conf files/*.vpp /etc/vpp/
|
||||
COPY files/init-container.sh /sbin/
|
||||
RUN chmod 755 /sbin/init-container.sh
|
||||
CMD ["/sbin/init-container.sh"]
|
||||
|
12
files/init-container.sh
Executable file
12
files/init-container.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG=${CONFIG:="/etc/vpp/startup.conf"}
|
||||
NETNS=${NETNS:="dataplane"}
|
||||
|
||||
echo "Creating dataplane namespace"
|
||||
/usr/bin/mkdir -p /etc/netns/$NETNS
|
||||
/usr/bin/touch /etc/netns/$NETNS/resolv.conf
|
||||
/usr/sbin/ip netns add $NETNS
|
||||
|
||||
echo "Starting VPP"
|
||||
exec /usr/bin/vpp -c $CONFIG
|
@ -37,3 +37,11 @@ plugins {
|
||||
plugin linux_nl_plugin.so { enable }
|
||||
plugin sflow_plugin.so { enable }
|
||||
}
|
||||
|
||||
linux-cp {
|
||||
default netns dataplane
|
||||
lcp-sync
|
||||
lcp-auto-subint
|
||||
del-static-on-link-down
|
||||
del-dynamic-on-link-down
|
||||
}
|
||||
|
Reference in New Issue
Block a user