Fix to use 10-weave.conflist instead of 10-weave.conf as CNI config file.

Also adds support for portmap as additional plugin along with weave-net

Fixes #3016
This commit is contained in:
Murali Reddy committed 2018-08-31 16:11:24 +05:30
1 parent ad4e4238a5
commit 90907a7647
4 files changed
+28 -10

No files matched your search

+20 -4
View File
@@ -729,9 +729,20 @@ upgrade_cni_plugin() {
create_cni_config() {
cat >"$1" <<EOF
{
"cniVersion": "0.3.0",
"name": "weave",
"type": "weave-net",
"hairpinMode": $2
"plugins": [
{
"name": "weave",
"type": "weave-net",
"hairpinMode": $2
},
{
"type": "portmap",
"capabilities": {"portMappings": true},
"snat": true
}
]
}
EOF
}
@@ -742,8 +753,13 @@ setup_cni() {
if install_cni_plugin $CNI_PLUGIN_DIR ; then
upgrade_cni_plugin $CNI_PLUGIN_DIR
fi
if [ -d $HOST_ROOT/etc/cni/net.d -a ! -f $HOST_ROOT/etc/cni/net.d/10-weave.conf ] ; then
create_cni_config $HOST_ROOT/etc/cni/net.d/10-weave.conf $HAIRPIN_MODE
# Weave will use .conflist for versions > 2.4.0. So in case of upgrade of old
# clusters with Weave version <= 2.4.0 remove existing 10-weave.conf
rm -f $HOST_ROOT/etc/cni/net.d/10-weave.conf
if [ -d $HOST_ROOT/etc/cni/net.d -a ! -f $HOST_ROOT/etc/cni/net.d/10-weave.conflist ] ; then
create_cni_config $HOST_ROOT/etc/cni/net.d/10-weave.conflist $HAIRPIN_MODE
fi
}