summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-11-24 14:56:35 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-01-28 11:33:29 +0100
commit2b97c1d733b1fc310ecc6b4babbd7c6725718d46 (patch)
tree4133e74ac922528048a60e2261be14e16f9eaf36 /contrib
parent4dbb58d63759ab1019b55bc50816e30361715d8b (diff)
downloadpodman-2b97c1d733b1fc310ecc6b4babbd7c6725718d46.tar.gz
podman-2b97c1d733b1fc310ecc6b4babbd7c6725718d46.tar.bz2
podman-2b97c1d733b1fc310ecc6b4babbd7c6725718d46.zip
Allow static ip and mac with rootless cni network
Make sure we pass the ip and mac address as CNI_ARGS to the cnitool which is executed in the rootless-cni-infra container. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/rootless-cni-infra/Containerfile2
-rwxr-xr-xcontrib/rootless-cni-infra/rootless-cni-infra14
2 files changed, 12 insertions, 4 deletions
diff --git a/contrib/rootless-cni-infra/Containerfile b/contrib/rootless-cni-infra/Containerfile
index 871e06a6c..579d192b9 100644
--- a/contrib/rootless-cni-infra/Containerfile
+++ b/contrib/rootless-cni-infra/Containerfile
@@ -33,4 +33,4 @@ COPY rootless-cni-infra /usr/local/bin
ENV CNI_PATH=/opt/cni/bin
CMD ["sleep", "infinity"]
-ENV ROOTLESS_CNI_INFRA_VERSION=3
+ENV ROOTLESS_CNI_INFRA_VERSION=4
diff --git a/contrib/rootless-cni-infra/rootless-cni-infra b/contrib/rootless-cni-infra/rootless-cni-infra
index 463254c7f..bafa18144 100755
--- a/contrib/rootless-cni-infra/rootless-cni-infra
+++ b/contrib/rootless-cni-infra/rootless-cni-infra
@@ -21,16 +21,18 @@ wait_unshare_net() {
done
}
-# CLI subcommand: "alloc $CONTAINER_ID $NETWORK_NAME $POD_NAME"
+# CLI subcommand: "alloc $CONTAINER_ID $NETWORK_NAME $POD_NAME $IP $MAC"
cmd_entrypoint_alloc() {
- if [ "$#" -ne 3 ]; then
- echo >&2 "Usage: $ARG0 alloc CONTAINER_ID NETWORK_NAME POD_NAME"
+ if [ "$#" -ne 5 ]; then
+ echo >&2 "Usage: $ARG0 alloc CONTAINER_ID NETWORK_NAME POD_NAME IP MAC"
exit 1
fi
ID="$1"
NET="$2"
K8S_POD_NAME="$3"
+ IP="$4"
+ MAC="$5"
dir="${BASE}/${ID}"
mkdir -p "${dir}/attached" "${dir}/attached-args"
@@ -46,6 +48,12 @@ cmd_entrypoint_alloc() {
nsenter -t "${pid}" -n ip link set lo up
fi
CNI_ARGS="IgnoreUnknown=1;K8S_POD_NAME=${K8S_POD_NAME}"
+ if [ "$IP" ]; then
+ CNI_ARGS="$CNI_ARGS;IP=${IP}"
+ fi
+ if [ "$MAC" ]; then
+ CNI_ARGS="$CNI_ARGS;MAC=${MAC}"
+ fi
nwcount=$(find "${dir}/attached" -type f | wc -l)
CNI_IFNAME="eth${nwcount}"
export CNI_ARGS CNI_IFNAME