Skip to content

Commit b84b816

Browse files
author
Ian Campbell
committed
bridge: Support network configuration via metadata
Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent 4fca826 commit b84b816

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

yml/bridge.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@ onboot:
66
- "-c"
77
- |
88
set -e
9-
subnet='"10.1.0.0/16"'
10-
gateway='"10.1.0.1"'
11-
ns='"10.1.0.1"'
9+
field() {
10+
local f=$1
11+
local d=$2
12+
if [ -r "/run/config/cni.bridge/$f" ] ; then
13+
cat "/run/config/cni.bridge/$f"
14+
else
15+
echo -e "\"$d\"\\n"
16+
fi
17+
}
18+
subnet="$(field subnet '10.1.0.0/16')"
19+
gateway="$(field gateway '10.1.0.1')"
20+
ns="$(field ns '10.1.0.1')"
1221
cat <<EOF >/var/lib/cni/conf/10-default.conflist
1322
{
1423
"cniVersion": "0.3.1",

0 commit comments

Comments
 (0)