460cab6a99
Make the CNI config and binary locations parametrized so it is suitable for more kinds of deployment. Implements: blueprint kubeadminstallable Change-Id: I01c7540641fe120faec902008ebd842339b50384 Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com> Co-Authored-By: Michał Dulko <mdulko@redhat.com>
39 lines
1004 B
Bash
Executable File
39 lines
1004 B
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_conf_path}/99-loopback.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"
|
|
|
|
sleep infinity
|