Merge "Update 10-kuryr.conf to 10-kuryr.conflist, and generate the 10-kuryr.conflist file from the template file kuryr.conflist.template"

This commit is contained in:
Zuul 2020-09-03 09:34:26 +00:00 committed by Gerrit Code Review
commit 10db70d998
7 changed files with 41 additions and 18 deletions

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

View File

@ -721,8 +721,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 {

View File

@ -219,19 +219,23 @@ 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",
"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
are used to plug interfaces and would be run with raised privileges. ``os-vif``

View File

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

View File

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

View File

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

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"