18db649943
This commit implements kuryr-daemon support when KURYR_K8S_CONTAINERIZED_DEPLOYMENT=True. It's done by: * CNI docker image installs Kuryr-Kubernetes pip package and adds exectution of kuryr-daemon into entrypoint script. * Hosts /proc and /var/run/openvswitch are mounted into the CNI container. * Code is changed to use /host_proc instead of /proc when in a container (it's impossible to mount host's /proc into container's /proc). Implements: blueprint cni-split-exec-daemon Change-Id: I9155a2cba28f578cee129a4c40066209f7ab543d
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
function cleanup() {
|
|
local cni_conf_path
|
|
local cni_bin_path
|
|
cni_conf_path="$1"
|
|
cni_bin_path="$2"
|
|
|
|
rm -f "${cni_conf_path}/10-kuryr.conf"
|
|
rm -f "${cni_bin_path}/kuryr-cni"
|
|
rm -f "${cni_bin_path}/kuryr-cni-bin"
|
|
rm -rf /etc/kuryr
|
|
}
|
|
|
|
function deploy() {
|
|
local cni_conf_path
|
|
local cni_bin_path
|
|
local serviceaccount_path
|
|
|
|
cni_conf_path="$1"
|
|
cni_bin_path="$2"
|
|
serviceaccount_path="/var/run/secrets/kubernetes.io/serviceaccount"
|
|
|
|
mkdir -p /etc/kuryr
|
|
cp "${serviceaccount_path}/token" /etc/kuryr/token
|
|
cp "${serviceaccount_path}/ca.crt" /etc/kuryr/ca.crt
|
|
|
|
cp /opt/kuryr-kubernetes/etc/cni/net.d/* "$cni_conf_path"
|
|
cp /kuryr-cni-bin "${cni_bin_path}/kuryr-cni-bin"
|
|
cp /kuryr-cni "${cni_bin_path}/kuryr-cni"
|
|
cat /tmp/kuryr/* > /etc/kuryr/kuryr.conf
|
|
}
|
|
|
|
cleanup "$CNI_CONFIG_DIR_PATH" "$CNI_BIN_DIR_PATH"
|
|
deploy "$CNI_CONFIG_DIR_PATH" "$CNI_BIN_DIR_PATH"
|
|
|
|
# Start CNI daemon if required
|
|
if [ "$CNI_DAEMON" == "True" ]; then
|
|
/usr/bin/kuryr-daemon --config-file /etc/kuryr/kuryr.conf
|
|
else
|
|
sleep infinity
|
|
fi
|