From 42ffa8df71a57f534fcc80b37d530599a98c7272 Mon Sep 17 00:00:00 2001 From: Saikrishna Date: Tue, 8 Jan 2019 19:53:27 +0000 Subject: [PATCH] Auto-generate multus conf. Do not exit sriov DS Instead of relying on configmap to be created/customized by the user to generate multus conf, we autogenerate it using the current default CNI conf file on the host. This way CNI's with host specific conf details will continue to work. ``` { "type": "calico", "nodename": "clr-01", ... } ``` Since SR-IOV device may not be present on all nodes, the daemonset should not exit as this will put the pod in restart loop. This would cause the kubelet and runtimes to repeatedly restart, as per initContainer logic. Signed-off-by: Saikrishna Edupuganti --- clr-k8s-examples/9-multi-network/README.md | 8 ++-- .../9-multi-network/multus-conf.yaml | 21 ---------- .../9-multi-network/multus-sriov-ds.yaml | 38 +++++++++++-------- 3 files changed, 26 insertions(+), 41 deletions(-) delete mode 100644 clr-k8s-examples/9-multi-network/multus-conf.yaml diff --git a/clr-k8s-examples/9-multi-network/README.md b/clr-k8s-examples/9-multi-network/README.md index 6402ac3..909e836 100644 --- a/clr-k8s-examples/9-multi-network/README.md +++ b/clr-k8s-examples/9-multi-network/README.md @@ -5,15 +5,13 @@ We launch a `Daemonset` with an `initContainer` which sets up the CNI directories on the host with the necessary binaries and configuration files. -### Customization +> NOTE: SR-IOV devices are not necessary to test multi-network capability -Replace `flannel` configuration in the delegates section with contents of your -default network's cni configuration in [multus-conf.yaml](clr-k8s-examples/9-multi-network/multus-conf.yaml). +### Customization The device plugin will register the SR-IOV enabled devices on the host, specified as `rootDevices` in [sriov-conf.yaml](clr-k8s-examples/9-multi-network/sriov-conf.yaml). - -> Helper [systemd](clr-k8s-examples/9-multi-network/systemd/sriov.service) example config +Helper [systemd](clr-k8s-examples/9-multi-network/systemd/sriov.service) example config is provided, which enables SR-IOV for the above `rootDevices` > NOTE: This assumes homogenous nodes in the cluster diff --git a/clr-k8s-examples/9-multi-network/multus-conf.yaml b/clr-k8s-examples/9-multi-network/multus-conf.yaml deleted file mode 100644 index f85ebc9..0000000 --- a/clr-k8s-examples/9-multi-network/multus-conf.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: multus-conf - namespace: kube-system -data: - 01-cni-conf.json: | - { - "name": "multus-cni-network", - "type": "multus", - "delegates": [ - { - "type": "flannel", - "delegate": { - "isDefaultGateway": true - } - } - ], - "kubeconfig": "/etc/cni/net.d/multus-kubeconfig" - } - diff --git a/clr-k8s-examples/9-multi-network/multus-sriov-ds.yaml b/clr-k8s-examples/9-multi-network/multus-sriov-ds.yaml index 75bb3d6..b4fdd93 100644 --- a/clr-k8s-examples/9-multi-network/multus-sriov-ds.yaml +++ b/clr-k8s-examples/9-multi-network/multus-sriov-ds.yaml @@ -55,7 +55,7 @@ rules: kind: ConfigMap apiVersion: v1 metadata: - name: multus-certs + name: multus-scripts namespace: kube-system data: install-certs.sh: | @@ -87,6 +87,21 @@ data: user: multus 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)" + MASTER_PLUGIN_JSON="$(cat /host/etc/cni/net.d/$MASTER_PLUGIN)" + cat > /host/etc/cni/net.d/00-multus.conf <