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 #!/bin/bash -ex
function cleanup() { 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" rm -f "/opt/cni/bin/kuryr-cni"
} }
@ -9,7 +9,11 @@ function deploy() {
# Copy the binary into the designated location # Copy the binary into the designated location
cp /kuryr-cni "/opt/cni/bin/kuryr-cni" cp /kuryr-cni "/opt/cni/bin/kuryr-cni"
chmod +x /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 cleanup

View File

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

View File

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

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 ( const (
// FIXME(dulek): We don't really have a good way to fetch current URL:port binding here. // 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 // 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/" urlBase = "http://localhost:5036/"
addPath = "addNetwork" addPath = "addNetwork"
delPath = "delNetwork" delPath = "delNetwork"