key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
curl $key_location | sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient IM"
- sudo apt-get update
- sudo apt-get install -y python3-pip
+ sudo apt-get -y update
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
sudo -H LC_ALL=C python3 -m pip install -U pip
sudo -H LC_ALL=C python3 -m pip install -U python-magic pyangbind verboselogs
- sudo apt-get install -y python3-osm-im python3-osmclient
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-im python3-osmclient
if [ -f /usr/lib/python3/dist-packages/osm_im/requirements.txt ]; then
python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt
fi
if [ -f /usr/lib/python3/dist-packages/osmclient/requirements.txt ]; then
- sudo apt-get install -y libcurl4-openssl-dev libssl-dev libmagic1
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libcurl4-openssl-dev libssl-dev libmagic1
python3 -m pip install -r /usr/lib/python3/dist-packages/osmclient/requirements.txt
fi
[ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'`
function install_docker_ce() {
# installs and configures Docker CE
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ echo "Removing previous installation of docker ..."
+ for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
echo "Installing Docker CE ..."
- sudo apt-get -qq update
- sudo apt-get install -y apt-transport-https ca-certificates software-properties-common
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
- sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get -qq update
+ sudo apt-get -y update
+ sudo apt-get install -y apt-transport-https ca-certificates software-properties-common gnupg
+ sudo install -m 0755 -d /etc/apt/keyrings
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+ sudo chmod a+r /etc/apt/keyrings/docker.gpg
+ echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
+ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+ sudo apt-get -y update
sudo apt-get install -y docker-ce
-# echo "Reconfiguring Docker to use systemd as cgroup driver"
-# if [ ! -f /etc/docker/daemon.json ]; then
-# sudo bash -c "cat <<EOF > /etc/docker/daemon.json
-#{
-# \"exec-opts\": [\"native.cgroupdriver=systemd\"],
-# \"log-driver\": \"json-file\",
-# \"log-opts\": {
-# \"max-size\": \"100m\"
-# },
-# \"storage-driver\": \"overlay2\"
-#}
-#EOF"
-# else
-# sudo sed -i "s|native.cgroupdriver=cgroupfs|native.cgroupdriver=systemd|" /etc/docker/daemon.json
-# fi
+
echo "Adding user to group 'docker'"
sudo groupadd -f docker
sudo usermod -aG docker $USER
- sleep 2
- #sudo systemctl enable docker
- #sudo systemctl daemon-reload
- #sudo systemctl restart docker
- sudo service docker restart
- echo "... restarted Docker service"
+
if [ -n "${DOCKER_PROXY_URL}" ]; then
echo "Configuring docker proxy ..."
if [ -f /etc/docker/daemon.json ]; then
EOF"
fi
if [ -n "${DOCKER_PROXY_URL}" ] || [ -n "${OSM_BEHIND_PROXY}" ] ; then
- #sudo systemctl enable docker
sudo systemctl daemon-reload
- #sudo systemctl restart docker
- sudo service docker restart
- echo "... restarted Docker service again"
+ sudo systemctl restart docker
+ echo "... restarted Docker service"
fi
+ echo "Configuring containerd to expose CRI, use systemd cgroup and use DOCKER_PROXY_URL as registry mirror"
+ sudo mv /etc/containerd/config.toml /etc/containerd/config.toml.orig 2>/dev/null
+ sudo bash -c "containerd config default > /etc/containerd/config.toml"
+ sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
if [ -n "${DOCKER_PROXY_URL}" ]; then
- echo "Configuring containerd"
- sudo mv /etc/containerd/config.toml /etc/containerd/config.toml.orig 2>/dev/null
- sudo bash -c "containerd config default > /etc/containerd/config.toml"
sudo sed -i "s#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]\n \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"\]\n endpoint = \[\"${DOCKER_PROXY_URL}\"\]\n \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"registry.hub.docker.com\"]\n endpoint = \[\"${DOCKER_PROXY_URL}\"]#" /etc/containerd/config.toml
- sudo diff /etc/containerd/config.toml.orig /etc/containerd/config.toml
- sudo service containerd restart
fi
+ sudo systemctl restart containerd
[ -z "${DEBUG_INSTALL}" ] || ! echo "File: /etc/docker/daemon.json" || cat /etc/docker/daemon.json
- sg docker -c "docker version" || FATAL "Docker installation failed"
+ echo "Testing Docker CE installation ..."
+ sg docker -c "docker version" || FATAL_TRACK docker_ce "Docker installation failed. Cannot run docker version"
+ sg docker -c "docker run --rm hello-world" || FATAL_TRACK docker_ce "Docker installation failed. Cannot run hello-world"
echo "... Docker CE installation done"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
return 0
set +eux
-K8S_VERSION=1.23.3-00
+K8S_VERSION=1.26.5-00
# installs kubernetes packages
function install_kube() {
# Kubernetes releases can be found here: https://kubernetes.io/releases/
# To check other available versions, run the following command
# curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}'
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo add-apt-repository -y "deb https://apt.kubernetes.io/ kubernetes-xenial main"
- sudo apt-get update
+ sudo apt-get -y update && sudo apt-get install -y apt-transport-https ca-certificates curl
+ sudo install -m 0755 -d /etc/apt/keyrings
+ curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
+ echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
+ sudo apt-get -y update
echo "Installing Kubernetes Packages ..."
sudo apt-get install -y kubelet=${K8S_VERSION} kubeadm=${K8S_VERSION} kubectl=${K8S_VERSION}
- cat << EOF | sudo tee -a /etc/default/kubelet
-KUBELET_EXTRA_ARGS="--cgroup-driver=cgroupfs"
-EOF
sudo apt-mark hold kubelet kubeadm kubectl
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
# test kubernetes installation
function check_and_track_init_k8s() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ echo "Reading existing namespaces"
kubectl get ns || FATAL_TRACK k8scluster "Failed getting namespaces"
track k8scluster init_k8s_ok
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
# taints K8s master node
function taint_master_node() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- K8S_MASTER=$(kubectl get nodes | awk '$3~/master/'| awk '{print $1}')
- kubectl taint node $K8S_MASTER node-role.kubernetes.io/master:NoSchedule-
+ K8S_MASTER=$(kubectl get nodes | awk '$3~/control-plane/'| awk '{print $1; exit}')
+ kubectl taint node $K8S_MASTER node-role.kubernetes.io/control-plane:NoSchedule-
sleep 5
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
function install_k8s_storageclass() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- echo "Installing open-iscsi"
- sudo apt-get update
- sudo apt-get install open-iscsi
- sudo systemctl enable --now iscsid
- OPENEBS_VERSION="3.1.0"
+ # Openebs versions can be found here: https://github.com/openebs/openebs/releases
+ OPENEBS_VERSION="3.7.0"
echo "Installing OpenEBS"
helm repo add openebs https://openebs.github.io/charts
helm repo update
function install_helm_metallb() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
echo "Installing MetalLB"
- METALLB_VERSION="0.11.0"
- METALLB_IP_RANGE="$DEFAULT_IP/32"
- echo "configInline:
- address-pools:
- - name: default
- protocol: layer2
- addresses:
- - $METALLB_IP_RANGE" | sudo tee -a ${OSM_CLUSTER_WORK_DIR}/metallb-config.yaml
+ METALLB_VERSION="0.13.10"
helm repo add metallb https://metallb.github.io/metallb
helm repo update
- helm install --create-namespace --namespace metallb-system metallb metallb/metallb --version ${METALLB_VERSION} -f ${OSM_CLUSTER_WORK_DIR}/metallb-config.yaml
+ helm install --create-namespace --namespace metallb-system metallb metallb/metallb --version ${METALLB_VERSION}
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+function configure_ipaddresspool_metallb() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ echo "Creating IP address pool manifest: ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml"
+ METALLB_IP_RANGE="$DEFAULT_IP/32"
+ echo "apiVersion: metallb.io/v1beta1
+kind: IPAddressPool
+metadata:
+ name: first-pool
+ namespace: metallb-system
+spec:
+ addresses:
+ - ${METALLB_IP_RANGE}" | sudo tee -a ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml
+ echo "Applying IP address pool manifest: kubectl apply -f ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml"
+ kubectl apply -f ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml || FATAL_TRACK k8scluster "Cannot create IP address Pool in MetalLB"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
# State of MetalLB
METALLB_STATE=$(kubectl get pod -n ${METALLB_NAMESPACE} --no-headers 2>&1)
- METALLB_READY=$(echo "${METALLB_STATE}" | awk '$2=="1/1" || $2=="2/2" {printf ("%s\t%s\t\n", $1, $2)}')
- METALLB_NOT_READY=$(echo "${METALLB_STATE}" | awk '$2!="1/1" && $2!="2/2" {printf ("%s\t%s\t\n", $1, $2)}')
+ METALLB_READY=$(echo "${METALLB_STATE}" | awk '$2=="1/1" || $2=="4/4" {printf ("%s\t%s\t\n", $1, $2)}')
+ METALLB_NOT_READY=$(echo "${METALLB_STATE}" | awk '$2!="1/1" && $2!="4/4" {printf ("%s\t%s\t\n", $1, $2)}')
COUNT_METALLB_READY=$(echo "${METALLB_READY}" | grep -v -e '^$' | wc -l)
COUNT_METALLB_NOT_READY=$(echo "${METALLB_NOT_READY}" | grep -v -e '^$' | wc -l)
#removes osm deployments and services
function remove_k8s_namespace() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- kubectl delete ns $1 2>&1 >/dev/null
+ echo "Deleting existing namespace $1: kubectl delete ns $1"
+ kubectl delete ns $1 2>/dev/null
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
track k8scluster uninstall_k8s_monitoring_ok
fi
-remove_k8s_namespace osm
deploy_cni_provider
taint_master_node
check_and_track_k8s_ready_before_helm
+remove_k8s_namespace osm
+
install_helm
track k8scluster install_helm_ok
track k8scluster k8s_certmanager_ok
check_for_readiness
track k8scluster k8s_ready_ok
-
+configure_ipaddresspool_metallb
def downstream_params_stage_3 = [
string(name: 'GERRIT_BRANCH', value: "${branch}"),
string(name: 'INSTALLER', value: "Default" ),
- string(name: 'OPENSTACK_BASE_IMAGE', value: "ubuntu20.04" ),
+ string(name: 'OPENSTACK_BASE_IMAGE', value: "ubuntu22.04" ),
string(name: 'UPSTREAM_JOB_NAME', value: "${JOB_NAME}" ),
string(name: 'UPSTREAM_JOB_NUMBER', value: "${BUILD_NUMBER}" ),
booleanParam(name: 'DO_STAGE_4', value: do_stage_4 )
string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
string(defaultValue: 'testing-daily', description: '', name: 'DOCKER_TAG'),
- string(defaultValue: 'ubuntu20.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
+ string(defaultValue: 'ubuntu22.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'),
booleanParam(defaultValue: true, description: '', name: 'SAVE_ARTIFACTS_ON_SMOKE_SUCCESS'),