diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-12-03 22:26:29 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-27 20:58:03 +0100 |
commit | 1fac43654cf2ec950a2b3221e27425dbcd3bbf4d (patch) | |
tree | 7c1408499317b96b145f1ff16b57a6ba5cbd42b8 /contrib/rootless-cni-infra | |
parent | c717b3cacad00ec8ea5415a2246994ac3adf7ae0 (diff) | |
download | podman-1fac43654cf2ec950a2b3221e27425dbcd3bbf4d.tar.gz podman-1fac43654cf2ec950a2b3221e27425dbcd3bbf4d.tar.bz2 podman-1fac43654cf2ec950a2b3221e27425dbcd3bbf4d.zip |
Add support for rootless network-aliases
Make sure we pass the network aliases as capability args to the
cnitool in the rootless-cni-infra container. Also update the
dnsname plugin in the cni-infra container.
Fixes #8567
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'contrib/rootless-cni-infra')
-rw-r--r-- | contrib/rootless-cni-infra/Containerfile | 4 | ||||
-rwxr-xr-x | contrib/rootless-cni-infra/rootless-cni-infra | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/contrib/rootless-cni-infra/Containerfile b/contrib/rootless-cni-infra/Containerfile index 579d192b9..4324f39d2 100644 --- a/contrib/rootless-cni-infra/Containerfile +++ b/contrib/rootless-cni-infra/Containerfile @@ -2,7 +2,7 @@ ARG GOLANG_VERSION=1.15 ARG ALPINE_VERSION=3.12 ARG CNI_VERSION=v0.8.0 ARG CNI_PLUGINS_VERSION=v0.8.7 -ARG DNSNAME_VERSION=v1.0.0 +ARG DNSNAME_VERSION=v1.1.1 FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS golang-base RUN apk add --no-cache git @@ -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=4 +ENV ROOTLESS_CNI_INFRA_VERSION=5 diff --git a/contrib/rootless-cni-infra/rootless-cni-infra b/contrib/rootless-cni-infra/rootless-cni-infra index bafa18144..cceb8d817 100755 --- a/contrib/rootless-cni-infra/rootless-cni-infra +++ b/contrib/rootless-cni-infra/rootless-cni-infra @@ -21,10 +21,10 @@ wait_unshare_net() { done } -# CLI subcommand: "alloc $CONTAINER_ID $NETWORK_NAME $POD_NAME $IP $MAC" +# CLI subcommand: "alloc $CONTAINER_ID $NETWORK_NAME $POD_NAME $IP $MAC $CAP_ARGS" cmd_entrypoint_alloc() { - if [ "$#" -ne 5 ]; then - echo >&2 "Usage: $ARG0 alloc CONTAINER_ID NETWORK_NAME POD_NAME IP MAC" + if [ "$#" -ne 6 ]; then + echo >&2 "Usage: $ARG0 alloc CONTAINER_ID NETWORK_NAME POD_NAME IP MAC CAP_ARGS" exit 1 fi @@ -33,6 +33,7 @@ cmd_entrypoint_alloc() { K8S_POD_NAME="$3" IP="$4" MAC="$5" + CAP_ARGS="$6" dir="${BASE}/${ID}" mkdir -p "${dir}/attached" "${dir}/attached-args" @@ -54,9 +55,12 @@ cmd_entrypoint_alloc() { if [ "$MAC" ]; then CNI_ARGS="$CNI_ARGS;MAC=${MAC}" fi + if [ "$CAP_ARGS" ]; then + CAP_ARGS="$CAP_ARGS" + fi nwcount=$(find "${dir}/attached" -type f | wc -l) CNI_IFNAME="eth${nwcount}" - export CNI_ARGS CNI_IFNAME + export CNI_ARGS CNI_IFNAME CAP_ARGS cnitool add "${NET}" "/proc/${pid}/ns/net" >"${dir}/attached/${NET}" echo "${CNI_ARGS}" >"${dir}/attached-args/${NET}" |