From 1667677f72d74281671dc5a52aba65ef999635c3 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 4 May 2025 12:19:44 +0200 Subject: [PATCH] Move docker build stuff into a subdirectory. Update structure to retire manual-{pre,post} --- README.md | 18 +++++++++--------- .../Dockerfile.bookworm | 0 .../files}/etc/bird/bird-local.conf | 0 {files => docker/files}/etc/bird/bird.conf | 0 docker/files/etc/vpp/bootstrap.vpp | 2 ++ {files => docker/files}/etc/vpp/clab.vpp | 0 {files => docker/files}/etc/vpp/startup.conf | 3 +++ {files => docker/files}/init-container.sh | 7 +++++++ files/etc/vpp/bootstrap.vpp | 3 --- files/etc/vpp/manual-post.vpp | 1 - files/etc/vpp/manual-pre.vpp | 1 - 11 files changed, 21 insertions(+), 14 deletions(-) rename Dockerfile.bookworm => docker/Dockerfile.bookworm (100%) rename {files => docker/files}/etc/bird/bird-local.conf (100%) rename {files => docker/files}/etc/bird/bird.conf (100%) create mode 100644 docker/files/etc/vpp/bootstrap.vpp rename {files => docker/files}/etc/vpp/clab.vpp (100%) rename {files => docker/files}/etc/vpp/startup.conf (83%) rename {files => docker/files}/init-container.sh (87%) delete mode 100644 files/etc/vpp/bootstrap.vpp delete mode 100644 files/etc/vpp/manual-post.vpp delete mode 100644 files/etc/vpp/manual-pre.vpp diff --git a/README.md b/README.md index e84cbf8..087bd7f 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,24 @@ This docker container creates a VPP instance based on the latest VPP release. It starts up as per normal, using /etc/vpp/startup.conf (which Containerlab might replace when it starts its -containers). Once started, it'll execute /etc/vpp/bootstrap.vpp within the dataplane. There are -three relevant files: +containers). Once started, it'll execute `/etc/vpp/bootstrap.vpp` within the dataplane. There are +two relevant files: -1. `manual-pre.vpp` -- can be supplied by the user, to run any configuration statements before - containerlab takes control. - -1. `clab.vpp` -- generated by `files/container-init.sh`. Its purpose is to bind the `veth` +1. `clab.vpp` -- generated by `files/init-container.sh`. Its purpose is to bind the `veth` interfaces that containerlab has added to the container into the VPP dataplane (see below). +1. `vppcfg.vpp` -- generated by `files/init-container.sh`. Its purpose is to read the user + specified `vppcfg.yaml` file and convert it into VPP CLI commands. If no YAML file is + specified, or if it is not syntactically valid, an empty file is generated instead. -1. `manual-post.vpp` -- can be supplied by the user, to run any configuration statements after - containerlab is finished with its per-lab statements. +For Containerlab users who wish to have more control over their VPP bootstrap, it's possible to +bind-mount `/etc/vpp/bootstrap.vpp`. ## Building ```bash IMG=git.ipng.ch/ipng/vpp-containerlab TAG=latest -docker build --no-cache -f Dockerfile.bookworm -t $IMG . +docker build --no-cache -f docker/Dockerfile.bookworm -t $IMG docker/ docker image tag $IMG $IMG:$TAG docker push $IMG docker push $IMG:$TAG diff --git a/Dockerfile.bookworm b/docker/Dockerfile.bookworm similarity index 100% rename from Dockerfile.bookworm rename to docker/Dockerfile.bookworm diff --git a/files/etc/bird/bird-local.conf b/docker/files/etc/bird/bird-local.conf similarity index 100% rename from files/etc/bird/bird-local.conf rename to docker/files/etc/bird/bird-local.conf diff --git a/files/etc/bird/bird.conf b/docker/files/etc/bird/bird.conf similarity index 100% rename from files/etc/bird/bird.conf rename to docker/files/etc/bird/bird.conf diff --git a/docker/files/etc/vpp/bootstrap.vpp b/docker/files/etc/vpp/bootstrap.vpp new file mode 100644 index 0000000..a403470 --- /dev/null +++ b/docker/files/etc/vpp/bootstrap.vpp @@ -0,0 +1,2 @@ +exec /etc/vpp/clab.vpp +exec /etc/vpp/vppcfg.vpp diff --git a/files/etc/vpp/clab.vpp b/docker/files/etc/vpp/clab.vpp similarity index 100% rename from files/etc/vpp/clab.vpp rename to docker/files/etc/vpp/clab.vpp diff --git a/files/etc/vpp/startup.conf b/docker/files/etc/vpp/startup.conf similarity index 83% rename from files/etc/vpp/startup.conf rename to docker/files/etc/vpp/startup.conf index 735f0bd..18507df 100644 --- a/files/etc/vpp/startup.conf +++ b/docker/files/etc/vpp/startup.conf @@ -1,3 +1,6 @@ +# This is the vpp-containerlab default startup.conf, which is meant to be +# overridden by Containerlab's node/fdio_vpp/vpp_startup_config.go.tpl + unix { interactive log /var/log/vpp/vpp.log diff --git a/files/init-container.sh b/docker/files/init-container.sh similarity index 87% rename from files/init-container.sh rename to docker/files/init-container.sh index 662f976..9920c26 100755 --- a/files/init-container.sh +++ b/docker/files/init-container.sh @@ -2,6 +2,7 @@ STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"} CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp} +VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/etc/vpp/vppcfg.vpp} NETNS=${NETNS:="dataplane"} BIRD_ENABLED=${BIRD_ENABLED:="true"} @@ -40,5 +41,11 @@ set interface state $IFNAME up EOF done +echo "Generating $VPPCFG_VPP_FILE" +: > $VPPCFG_VPP_FILE +if [ -r /etc/vpp/vppcfg.yaml ]; then + vppcfg plan --novpp -c /etc/vpp/vppcfg.yaml -o $VPPCFG_VPP_FILE +fi + echo "Starting VPP" exec /usr/bin/vpp -c $STARTUP_CONFIG diff --git a/files/etc/vpp/bootstrap.vpp b/files/etc/vpp/bootstrap.vpp deleted file mode 100644 index 50fe9ea..0000000 --- a/files/etc/vpp/bootstrap.vpp +++ /dev/null @@ -1,3 +0,0 @@ -exec /etc/vpp/manual-pre.vpp -exec /etc/vpp/clab.vpp -exec /etc/vpp/manual-post.vpp diff --git a/files/etc/vpp/manual-post.vpp b/files/etc/vpp/manual-post.vpp deleted file mode 100644 index 801ccd1..0000000 --- a/files/etc/vpp/manual-post.vpp +++ /dev/null @@ -1 +0,0 @@ -comment { These commands are executed after Containerlab stuff } diff --git a/files/etc/vpp/manual-pre.vpp b/files/etc/vpp/manual-pre.vpp deleted file mode 100644 index 5b9e973..0000000 --- a/files/etc/vpp/manual-pre.vpp +++ /dev/null @@ -1 +0,0 @@ -comment { These commands are executed before Containerlab stuff }