Use move instead of remove, then we can recover if it doesn't work
Change-Id: Ibb3c2bc2382f91e36809903b7ce4a65a84634bb4
diff --git a/mcord/cni-config/04-sriov-device-plugin-configmap.yaml b/mcord/cni-config/04-sriov-device-plugin-configmap.yaml
index 3069f96..591d971 100644
--- a/mcord/cni-config/04-sriov-device-plugin-configmap.yaml
+++ b/mcord/cni-config/04-sriov-device-plugin-configmap.yaml
@@ -50,9 +50,13 @@
current-context: multus-context
EOF
install-multus-conf.sh: |
- # copied from https://github.com/intel/multus-cni/blob/master/images/entrypoint.sh
- rm -f /host/etc/cni/net.d/00-multus.conf
- MASTER_PLUGIN="$(ls /host/etc/cni/net.d | grep -E '\.conf(list)?$' | head -1)"
+ # To keep the original config installed by default (e.g. multus-daemonset)
+ if [ ! -f /host/etc/cni/net.d/00-multus.conf.original ]; then
+ mv /host/etc/cni/net.d/00-multus.conf /host/etc/cni/net.d/00-multus.conf.original;
+ fi
+
+ # Select the mainly CNI plugin's configuration and insert into multus's config
+ MASTER_PLUGIN="$(ls /host/etc/cni/net.d | grep -E '\.conf(list)?$' | grep -v 'multus' | head -1)"
MASTER_PLUGIN_JSON="$(cat /host/etc/cni/net.d/$MASTER_PLUGIN)"
cat > /host/etc/cni/net.d/00-multus.conf <<EOF
{