openstack-helm-infra/tools/deployment/common/005-deploy-k8s.sh
Andrii Ostapenko 13315e57a7 Fix openvswitch gate issue with systemd 237-3ubuntu10.43
New systemd 237-3ubuntu10.43 bumps memlock limit from 16 to 64 MB [1]
which seems to cause issues with eBPF related operations in containers
run with root [2] as a possible root cause.

Here we have an option to downgrade systemd to previous available
version or to set previous default memlock limit to systemd defaults or
docker unit. Setting systemd DefaultLimitMEMLOCK in this commit.

[1] https://launchpad.net/ubuntu/+source/systemd/237-3ubuntu10.43
[2] https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1837580/comments/9

Change-Id: I55d14ffa47a7a29d059f2f3b502bb38be0a5dd3d
Signed-off-by: Andrii Ostapenko <andrii.ostapenko@att.com>
2020-11-22 14:04:15 +00:00

72 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -xe
MINIKUBE_AIO_DEFAULT="docker.io/openstackhelm/minikube-aio:latest-ubuntu_bionic"
: ${MINIKUBE_AIO:=${MINIKUBE_AIO_DEFAULT}}
export DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND=noninteractive
echo "DefaultLimitMEMLOCK=16384" | sudo tee -a /etc/systemd/system.conf
sudo systemctl daemon-reexec
# Install required packages for K8s on host
wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
RELEASE_NAME=$(grep 'CODENAME' /etc/lsb-release | awk -F= '{print $2}')
sudo add-apt-repository "deb https://download.ceph.com/debian-nautilus/
${RELEASE_NAME} main"
sudo -E apt-get update
sudo -E apt-get install -y \
docker.io
# Starting to pull early in parallel
sudo -E docker pull -q ${MINIKUBE_AIO} &
sudo -E apt-get install -y \
socat \
jq \
util-linux \
ceph-common \
rbd-nbd \
nfs-common \
bridge-utils \
conntrack \
iptables
sudo -E tee /etc/modprobe.d/rbd.conf << EOF
install rbd /bin/true
EOF
set +x;
# give 2 minutes to pull the image (usually takes less than 30-60s) and proceed. If something bad
# happens we'll see it on 'docker create'
echo "Waiting for ${MINIKUBE_AIO} image is pulled"
i=0
while [ "$i" -le "60" ]; do
(( ++i ))
sudo docker inspect ${MINIKUBE_AIO} && break || sleep 2;
done &> /dev/null; set -x
TMP_DIR=$(mktemp -d)
sudo docker create --name minikube-aio ${MINIKUBE_AIO} bash
sudo docker export minikube-aio | tar x -C ${TMP_DIR}
sudo docker rm minikube-aio
sudo docker rmi ${MINIKUBE_AIO}
${TMP_DIR}/install.sh
rm ${TMP_DIR} -rf
make