Browse Source

Update 10-kuryr.conf to 10-kuryr.conflist, and generate the

10-kuryr.conflist file from the template file kuryr.conflist.template

1. Currently kubelet's cni config file uses 10-kuryr.conf in kuryr. The
kubernetes can support the config file with two suffixes, ".conf" and
".conflist", the latter can be a list containing multiple cni plugins.
So I want to update the 10-kuryr.conf to 10-kuryr.conflist to satisfy
the need to use multiple plug-in support.

2. If I install the kuryr-cni by pod, the 10-kuryr.conf will only be
copied and overwrited from the kuryr/cni image container. What I
expected is we can customize the config file more freely. So I think we
can add an other file kuryr.conflist.template as the template, then we
generate the 10-kuryr.conflist fron it.

Change-Id: Ie3669db4e60a57b24012124cd24b524eb03f55cf
changes/48/748148/5
xujingsong 10 months ago
committed by Roman Dobosz
parent
commit
257b5a80ab
7 changed files with 41 additions and 18 deletions
  1. +6
    -2
      cni_ds_init
  2. +2
    -2
      devstack/plugin.sh
  3. +10
    -6
      doc/source/installation/manual.rst
  4. +0
    -7
      etc/cni/net.d/10-kuryr.conf
  5. +11
    -0
      etc/cni/net.d/10-kuryr.conflist
  6. +11
    -0
      etc/cni/net.d/kuryr.conflist.template
  7. +1
    -1
      kuryr_cni/main.go

+ 6
- 2
cni_ds_init View File

@ -1,7 +1,7 @@
#!/bin/bash -ex
function cleanup() {
rm -f "/etc/cni/net.d/10-kuryr.conf"
rm -f "/etc/cni/net.d/10-kuryr.conflist"
rm -f "/opt/cni/bin/kuryr-cni"
}
@ -9,7 +9,11 @@ function deploy() {
# Copy the binary into the designated location
cp /kuryr-cni "/opt/cni/bin/kuryr-cni"
chmod +x /opt/cni/bin/kuryr-cni
cp /etc/kuryr-cni/* /etc/cni/net.d
if [ -f /etc/cni/net.d/kuryr.conflist.template ]; then
cp /etc/cni/net.d/kuryr.conflist.template /etc/cni/net.d/10-kuryr.conflist
else
cp /etc/kuryr-cni/kuryr.conflist.template /etc/cni/net.d/10-kuryr.conflist
fi
}
cleanup


+ 2
- 2
devstack/plugin.sh View File

@ -719,8 +719,8 @@ function prepare_kubelet {
kubelet_plugin_dir="/etc/cni/net.d/"
sudo install -o "$STACK_USER" -m 0664 -D \
"${KURYR_HOME}${kubelet_plugin_dir}/10-kuryr.conf" \
"${CNI_CONF_DIR}/10-kuryr.conf"
"${KURYR_HOME}${kubelet_plugin_dir}/10-kuryr.conflist" \
"${CNI_CONF_DIR}/10-kuryr.conflist"
}
function run_k8s_kubelet {


+ 10
- 6
doc/source/installation/manual.rst View File

@ -219,18 +219,22 @@ Link the CNI binary to CNI directory, where kubelet would find it:
$ mkdir -p /opt/cni/bin
$ ln -s $(which kuryr-cni) /opt/cni/bin/
Create the CNI config file for kuryr-cni: ``/etc/cni/net.d/10-kuryr.conf``.
Create the CNI config file for kuryr-cni: ``/etc/cni/net.d/10-kuryr.conflist``.
Kubelet would only use the lexicographically first file in that directory, so
make sure that it is kuryr's config file:
.. code-block:: json
{
"cniVersion": "0.3.1",
"name": "kuryr",
"type": "kuryr-cni",
"kuryr_conf": "/etc/kuryr/kuryr.conf",
"debug": true
"name": "kuryr",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "kuryr-cni",
"kuryr_conf": "/etc/kuryr/kuryr.conf",
"debug": true
}
]
}
Install ``os-vif`` and ``oslo.privsep`` libraries globally. These modules


+ 0
- 7
etc/cni/net.d/10-kuryr.conf View File

@ -1,7 +0,0 @@
{
"cniVersion": "0.3.1",
"name": "kuryr",
"type": "kuryr-cni",
"kuryr_conf": "/etc/kuryr/kuryr.conf",
"debug": true
}

+ 11
- 0
etc/cni/net.d/10-kuryr.conflist View File

@ -0,0 +1,11 @@
{
"name": "kuryr",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "kuryr-cni",
"kuryr_conf": "/etc/kuryr/kuryr.conf",
"debug": true
}
]
}

+ 11
- 0
etc/cni/net.d/kuryr.conflist.template View File

@ -0,0 +1,11 @@
{
"name": "kuryr",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "kuryr-cni",
"kuryr_conf": "/etc/kuryr/kuryr.conf",
"debug": true
}
]
}

+ 1
- 1
kuryr_cni/main.go View File

@ -20,7 +20,7 @@ import (
const (
// FIXME(dulek): We don't really have a good way to fetch current URL:port binding here.
// I'm hardcoding it for now, but in the future we should probably put it in
// the JSON config in 10-kuryr.conf file that we will get passed on stdin.
// the JSON config in 10-kuryr.conflist file that we will get passed on stdin.
urlBase = "http://localhost:5036/"
addPath = "addNetwork"
delPath = "delNetwork"


Loading…
Cancel
Save