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 DEBIAN_FRONTEND=noninteractive | ||||||
| ARG VPP_INSTALL_SKIP_SYSCTL=true | ARG VPP_INSTALL_SKIP_SYSCTL=true | ||||||
| ARG REPO=release | ARG REPO=release | ||||||
| RUN apt-get update | RUN apt-get update && apt-get -y install curl procps tcpdump iproute2 iptables \ | ||||||
| RUN apt-get -y install curl procps tcpdump iproute2 iptables binutils \ |   iputils-ping net-tools git python3 python3-pip && apt-get clean | ||||||
|   bridge-utils iputils-ping netcat-traditional net-tools nmap \ |  | ||||||
|   python3 python3-dev python3-pip | # Install VPP | ||||||
| RUN mkdir -p /var/log/vpp | RUN mkdir -p /var/log/vpp | ||||||
| RUN curl -s https://packagecloud.io/install/repositories/fdio/${REPO}/script.deb.sh |  bash | RUN curl -s https://packagecloud.io/install/repositories/fdio/${REPO}/script.deb.sh |  bash | ||||||
| RUN apt-get update | RUN apt-get update && apt-get -y install vpp vpp-plugin-core && apt-get clean | ||||||
| RUN apt-get -y install vpp vpp-plugin-core |  | ||||||
| RUN apt-get -y clean | # Build vppcfg | ||||||
| COPY files/startup.conf /etc/vpp/startup.conf | RUN pip install --break-system-packages build netaddr yamale argparse pyyaml ipaddress | ||||||
| COPY files/*.vpp /etc/vpp/ | RUN git clone https://github.com/pimvanpelt/vppcfg.git && cd vppcfg && python3 -m build && \ | ||||||
| CMD ["/usr/bin/vpp","-c","/etc/vpp/startup.conf"] |     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 linux_nl_plugin.so { enable } | ||||||
|   plugin sflow_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