diff --git a/Makefile b/Makefile index 06974d4a2..476e8fc97 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,5 @@ pull-all-images: pull-images: @./tools/pull-images.sh $(filter-out $@,$(MAKECMDGOALS)) -dev-deploy: - @./tools/gate/devel/start.sh $(filter-out $@,$(MAKECMDGOALS)) - %: @: diff --git a/tools/deployment/common/005-deploy-k8s.sh b/tools/deployment/common/005-deploy-k8s.sh deleted file mode 120000 index 003bfbb8e..000000000 --- a/tools/deployment/common/005-deploy-k8s.sh +++ /dev/null @@ -1 +0,0 @@ -../../gate/deploy-k8s.sh \ No newline at end of file diff --git a/tools/deployment/common/validate-minikube-aio.sh b/tools/deployment/common/validate-minikube-aio.sh deleted file mode 100644 index 8aa05deb6..000000000 --- a/tools/deployment/common/validate-minikube-aio.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -ex -cd /tmp -DIFF=$(diff loaded_images images_after_installation) -if [ ! -z ${DIFF} ]; then - echo -e "Looks like minikube-aio does not contain all images required for minikube installation:\n${DIFF}" - exit 1 -fi diff --git a/tools/gate/deploy-k8s-kubeadm.sh b/tools/gate/deploy-k8s-kubeadm.sh deleted file mode 100755 index 507f0a9fc..000000000 --- a/tools/gate/deploy-k8s-kubeadm.sh +++ /dev/null @@ -1,228 +0,0 @@ -#!/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 -ex - -: "${HELM_VERSION:="v3.6.3"}" -: "${KUBE_VERSION:="1.21.5-00"}" -: "${CALICO_VERSION:="v3.20"}" -: "${YQ_VERSION:="v4.6.0"}" - -export DEBCONF_NONINTERACTIVE_SEEN=true -export DEBIAN_FRONTEND=noninteractive - -sudo swapoff -a - -echo "DefaultLimitMEMLOCK=16384" | sudo tee -a /etc/systemd/system.conf -sudo systemctl daemon-reexec - -function configure_resolvconf { - # here with systemd-resolved disabled, we'll have 2 separate resolv.conf - # 1 - /etc/resolv.conf - to be used for resolution on host - - kube_dns_ip="10.96.0.10" - # keep all nameservers from both resolv.conf excluding local addresses - old_ns=$(grep -P --no-filename "^nameserver\s+(?!127\.0\.0\.|${kube_dns_ip})" \ - /etc/resolv.conf /run/systemd/resolve/resolv.conf | sort | uniq) - - # Add kube-dns ip to /etc/resolv.conf for local usage - sudo bash -c "echo 'nameserver ${kube_dns_ip}' > /etc/resolv.conf" - if [ -z "${HTTP_PROXY}" ]; then - sudo bash -c "printf 'nameserver 8.8.8.8\nnameserver 8.8.4.4\n' > /run/systemd/resolve/resolv.conf" - sudo bash -c "printf 'nameserver 8.8.8.8\nnameserver 8.8.4.4\n' >> /etc/resolv.conf" - else - sudo bash -c "echo \"${old_ns}\" > /run/systemd/resolve/resolv.conf" - sudo bash -c "echo \"${old_ns}\" >> /etc/resolv.conf" - fi - - for file in /etc/resolv.conf /run/systemd/resolve/resolv.conf; do - sudo bash -c "echo 'search svc.cluster.local cluster.local' >> ${file}" - sudo bash -c "echo 'options ndots:5 timeout:1 attempts:1' >> ${file}" - done -} - -# NOTE: Clean Up hosts file -sudo sed -i '/^127.0.0.1/c\127.0.0.1 localhost localhost.localdomain localhost4localhost4.localdomain4' /etc/hosts -sudo sed -i '/^::1/c\::1 localhost6 localhost6.localdomain6' /etc/hosts - -configure_resolvconf - -# shellcheck disable=SC1091 -. /etc/os-release - -# NOTE: Add docker repo -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo apt-key fingerprint 0EBFCD88 -sudo add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" - -# NOTE: Configure docker -docker_resolv="/run/systemd/resolve/resolv.conf" -docker_dns_list="$(awk '/^nameserver/ { printf "%s%s",sep,"\"" $NF "\""; sep=", "} END{print ""}' "${docker_resolv}")" - -sudo -E mkdir -p /etc/docker -sudo -E tee /etc/docker/daemon.json <& /dev/null; then - echo k8s DNS Failure. Are you sure you disabled systemd-resolved before running this script? - exit 1 -fi - -# Remove stable repo, if present, to improve build time -helm repo remove stable || true - -# Add labels to the core namespaces & nodes -kubectl label --overwrite namespace default name=default -kubectl label --overwrite namespace kube-system name=kube-system -kubectl label --overwrite namespace kube-public name=kube-public -kubectl label --overwrite nodes --all openstack-control-plane=enabled -kubectl label --overwrite nodes --all openstack-compute-node=enabled -kubectl label --overwrite nodes --all openvswitch=enabled -kubectl label --overwrite nodes --all linuxbridge=enabled -kubectl label --overwrite nodes --all ceph-mon=enabled -kubectl label --overwrite nodes --all ceph-osd=enabled -kubectl label --overwrite nodes --all ceph-mds=enabled -kubectl label --overwrite nodes --all ceph-rgw=enabled -kubectl label --overwrite nodes --all ceph-mgr=enabled - -for NAMESPACE in ceph openstack osh-infra; do -tee /tmp/${NAMESPACE}-ns.yaml << EOF -apiVersion: v1 -kind: Namespace -metadata: - labels: - kubernetes.io/metadata.name: ${NAMESPACE} - name: ${NAMESPACE} - name: ${NAMESPACE} -EOF - -kubectl apply -f /tmp/${NAMESPACE}-ns.yaml -done - -# Update CoreDNS and enable recursive queries -PATCH=$(mktemp) -kubectl get configmap coredns -n kube-system -o json | jq -r "{data: .data}" | sed 's/ready\\n/header \{\\n response set ra\\n \}\\n ready\\n/g' > "${PATCH}" -kubectl patch configmap coredns -n kube-system --patch-file "${PATCH}" -kubectl set image deployment coredns -n kube-system "coredns=registry.k8s.io/coredns/coredns:${CORE_DNS_VERSION}" -rm -f "${PATCH}" -kubectl rollout restart -n kube-system deployment/coredns - -make all diff --git a/tools/gate/devel/local-inventory.yaml b/tools/gate/devel/local-inventory.yaml deleted file mode 100644 index adb6e5c23..000000000 --- a/tools/gate/devel/local-inventory.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - ---- -all: - children: - primary: - hosts: - local: - ansible_connection: local -... diff --git a/tools/gate/devel/local-vars.yaml b/tools/gate/devel/local-vars.yaml deleted file mode 100644 index bedb8f3a2..000000000 --- a/tools/gate/devel/local-vars.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - ---- -kubernetes_network_default_device: docker0 -gate_fqdn_test: true -... diff --git a/tools/gate/devel/multinode-inventory.yaml b/tools/gate/devel/multinode-inventory.yaml deleted file mode 100644 index d954177c2..000000000 --- a/tools/gate/devel/multinode-inventory.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - ---- -all: - children: - primary: - hosts: - jules: - ansible_port: 22 - ansible_host: 10.10.10.13 - ansible_user: ubuntu - ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem - ansible_ssh_extra_args: -o StrictHostKeyChecking=no - nodes: - hosts: - verne: - ansible_port: 22 - ansible_host: 10.10.10.6 - ansible_user: ubuntu - ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem - ansible_ssh_extra_args: -o StrictHostKeyChecking=no -... diff --git a/tools/gate/devel/multinode-vars.yaml b/tools/gate/devel/multinode-vars.yaml deleted file mode 100644 index 4d9a92490..000000000 --- a/tools/gate/devel/multinode-vars.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# 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. diff --git a/tools/gate/devel/start.sh b/tools/gate/devel/start.sh deleted file mode 100755 index b0a7661dc..000000000 --- a/tools/gate/devel/start.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env 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 -ex -: ${WORK_DIR:="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../.."} -export DEPLOY=${1:-"full"} -export MODE=${2:-"local"} -export INVENTORY=${3:-${WORK_DIR}/tools/gate/devel/${MODE}-inventory.yaml} -export VARS=${4:-${WORK_DIR}/tools/gate/devel/${MODE}-vars.yaml} - -function ansible_install { - cd /tmp - . /etc/os-release - HOST_OS=${HOST_OS:="${ID}"} - if [ "x$ID" == "xubuntu" ]; then - sudo apt-get update -y - sudo apt-get install -y --no-install-recommends \ - python3-pip \ - libssl-dev \ - python3-dev \ - build-essential \ - jq \ - curl - elif [ "x$ID" == "xcentos" ]; then - sudo yum install -y \ - epel-release - sudo yum install -y \ - python3-pip \ - python-devel \ - redhat-rpm-config \ - gcc \ - curl - sudo curl -L -o /usr/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - sudo chmod +x /usr/bin/jq - elif [ "x$ID" == "xfedora" ]; then - sudo dnf install -y \ - python-devel \ - libselinux-python \ - redhat-rpm-config \ - gcc \ - jq - fi - - sudo -H -E pip3 install --ignore-installed --upgrade pip - sudo -H -E pip3 install --ignore-installed --upgrade setuptools - sudo -H -E pip3 install --ignore-installed --upgrade cmd2 - sudo -H -E pip3 install --ignore-installed --upgrade pyopenssl - sudo -H -E pip3 install --ignore-installed --upgrade ansible - sudo -H -E pip3 install --ignore-installed --upgrade \ - ara==0.16.5 \ - yq -} - -if [ "x${DEPLOY}" == "xsetup-host" ]; then - ansible_install - PLAYBOOKS="osh-infra-deploy-docker" -elif [ "x${DEPLOY}" == "xk8s" ]; then - ${WORK_DIR}/tools/deployment/common/000-install-packages.sh - ${WORK_DIR}/tools/gate/deploy-k8s.sh - exit 0 -elif [ "x${DEPLOY}" == "xlogs" ]; then - PLAYBOOKS="osh-infra-collect-logs" -else - echo "Unknown Deploy Option Selected" - exit 1 -fi - -cd ${WORK_DIR} -export ANSIBLE_CALLBACK_PLUGINS="$(python3 -m ara.setup.callback_plugins)" -rm -rf ${HOME}/.ara - -function dump_logs () { - # Setup the logging location: by default use the working dir as the root. - export LOGS_DIR=${LOGS_DIR:-"${WORK_DIR}/logs"} - set +e - rm -rf ${LOGS_DIR} || true - mkdir -p ${LOGS_DIR}/ara - ara generate html ${LOGS_DIR}/ara - exit $1 -} -trap 'dump_logs "$?"' ERR - -for PLAYBOOK in ${PLAYBOOKS}; do - ansible-playbook ${WORK_DIR}/playbooks/${PLAYBOOK}.yaml \ - -i ${INVENTORY} \ - --extra-vars=@${VARS} \ - --extra-vars "work_dir=${WORK_DIR}" -done