![Michael Beaver](/assets/img/avatar_default.png)
This change aims to add the airship-in-a-pod test to the gates. This is accomplished by creating new scripts to run which install a minimal k8s environment, and then apply the airship-in-a-pod.yaml. Brief description of scripts 01_dns_settings: Running k8s pods in zuul has a lot of issues with DNS resolution which this resolves. 10_install_minikube: grabs latest minikube and other dependencies. 11_build_images: builds the images under tools/airship-in-a-pod and then adds patches to the kustomize configuration to use and configure them. 12_start_minikube: starts minikube and makes sure kubectl will work 13_apply_dns.sh: This takes some of the effort from 01_dns_settings and incorporates it into the minikube cluster by modifying coredns 20_apply_aiap: Applies the airship-in-a-pod.yaml to the cluster. Has a few loops to check that the cluster is fully running before applying, and to check on the pod to see if it is ready before finishing. Closes: #478 Change-Id: I4c02d04b0eda9395642032bf56b56a0f823c1969
50 lines
1.7 KiB
Bash
Executable File
50 lines
1.7 KiB
Bash
Executable File
#!/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
|
|
|
|
# Running K8s pods in zuul can cause a lot of issues with resolving domains
|
|
# inside of the running pods and catching coredns in a loop. This aims to
|
|
# tackle a few issues that have been hit to resolve this.
|
|
|
|
|
|
NAMESERVER="1.0.0.1"
|
|
|
|
# Grab the real nameservers instead of the local one listed in the original
|
|
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
|
|
|
# Add the known good DNS server
|
|
sudo sed -i "1i\nameserver $NAMESERVER\n" /etc/resolv.conf
|
|
# Remove DNS servers pointing to localhost so coredns doesn't get caught in a loop
|
|
sudo sed -i '/127\.0/d' /etc/resolv.conf
|
|
# Spit out the nameservers for the logs
|
|
cat /etc/resolv.conf
|
|
|
|
# Running unbound server can cause issues with coredns, disabling
|
|
if [[ -f "/etc/unbound/unbound.pid" ]]; then
|
|
sudo kill "$(cat /etc/unbound/unbound.pid)"
|
|
fi
|
|
|
|
# flush iptables so coredns doesn't get caught up
|
|
# be sure to stop docker if it is installed
|
|
dpkg -l | grep -i docker | head -1 | if [[ "$(cut -d ' ' -f 1)" == "ii" ]]; then
|
|
sudo systemctl stop docker
|
|
fi
|
|
sudo iptables --flush
|
|
sudo iptables -tnat --flush
|
|
|
|
dpkg -l | grep -i docker | head -1 | if [[ "$(cut -d ' ' -f 1)" == "ii" ]]; then
|
|
sudo systemctl start docker
|
|
fi
|