Browse Source

k8s: Clear cni configuration

In fedora atomic 29, podman is present and configures
its own cni. We need to clear the cni configuration
otherwise we will get  that cni0 is already used.

story: 2006171
task: 35682

Change-Id: Ic70938184bdb98eaaf4f384ce553818cf2624a2a
Signed-off-by: Spyros Trigazis <spyridon.trigazis@cern.ch>
(cherry picked from commit afd2403adc2a423455d5521a157886d5a15ad9aa)
(cherry picked from commit fcc0213a582acb14aa71a1938076c6aed9b696be)
tags/7.2.0
Spyros Trigazis 7 months ago
parent
commit
dbe2abd258
2 changed files with 28 additions and 5 deletions
  1. +21
    -1
      magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh
  2. +7
    -4
      magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh

+ 21
- 1
magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh View File

@@ -18,8 +18,28 @@ fi

_prefix=${CONTAINER_INFRA_PREFIX:-docker.io/openstackmagnum/}

rm -rf /etc/cni/net.d/*
rm -rf /var/lib/cni/*
rm -rf /opt/cni/*
mkdir -p /opt/cni
_addtl_mounts=',{"type":"bind","source":"/opt/cni","destination":"/opt/cni","options":["bind","rw","slave","mode=777"]}'
mkdir -p /etc/cni/net.d/
_addtl_mounts=',{"type":"bind","source":"/opt/cni","destination":"/opt/cni","options":["bind","rw","slave","mode=777"]},{"type":"bind","source":"/var/lib/docker","destination":"/var/lib/docker","options":["bind","rw","slave","mode=755"]}'

if [ "$NETWORK_DRIVER" = "calico" ]; then
if [ "`systemctl status NetworkManager.service | grep -o "Active: active"`" = "Active: active" ]; then
CALICO_NM=/etc/NetworkManager/conf.d/calico.conf
[ -f ${CALICO_NM} ] || {
echo "Writing File: $CALICO_NM"
mkdir -p $(dirname ${CALICO_NM})
cat << EOF > ${CALICO_NM}
[keyfile]
unmanaged-devices=interface-name:cali*;interface-name:tunl*
EOF
}
systemctl restart NetworkManager
fi
fi

atomic install --storage ostree --system --set=ADDTL_MOUNTS=${_addtl_mounts} --system-package=no --name=kubelet ${_prefix}kubernetes-kubelet:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-apiserver ${_prefix}kubernetes-apiserver:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-controller-manager ${_prefix}kubernetes-controller-manager:${KUBE_TAG}

+ 7
- 4
magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh View File

@@ -18,11 +18,14 @@ fi

_prefix=${CONTAINER_INFRA_PREFIX:-docker.io/openstackmagnum/}

_addtl_mounts=''
if [ "$NETWORK_DRIVER" = "calico" ]; then
mkdir -p /opt/cni
_addtl_mounts=',{"type":"bind","source":"/opt/cni","destination":"/opt/cni","options":["bind","rw","slave","mode=777"]}'
rm -rf /etc/cni/net.d/*
rm -rf /var/lib/cni/*
rm -rf /opt/cni/*
mkdir -p /opt/cni
mkdir -p /etc/cni/net.d/
_addtl_mounts=',{"type":"bind","source":"/opt/cni","destination":"/opt/cni","options":["bind","rw","slave","mode=777"]},{"type":"bind","source":"/var/lib/docker","destination":"/var/lib/docker","options":["bind","rw","slave","mode=755"]}'

if [ "$NETWORK_DRIVER" = "calico" ]; then
if [ "`systemctl status NetworkManager.service | grep -o "Active: active"`" = "Active: active" ]; then
CALICO_NM=/etc/NetworkManager/conf.d/calico.conf
[ -f ${CALICO_NM} ] || {

Loading…
Cancel
Save