Skip to content

Commit

Permalink
Merge branch 'main' into fix-deploy-metallb
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo authored Jun 17, 2022
2 parents 2decaa2 + 68c722a commit fc0dd2d
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 138 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-and-push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
with:
fetch-depth: 0

- name: Prepare env
run: |
sudo apt-get -y install podman
mkdir -p ~/.docker
- name: Housekeeping clean old podman resources
continue-on-error: true
id: housekeeping
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-and-push-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
sudo apt-get -y install podman
mkdir -p ~/.docker
- name: Housekeeping clean old podman resources
continue-on-error: true
id: housekeeping
run: |
DATE=$(date --date="21 days ago" + "%Y-%m-%d")
podman rm --force $(podman ps -a -q --filter until=$DATE)
podman rmi --force $(podman images -a -q --filter until=${DATE})
- name: Login to Quay
env:
QUAY_USER: ${{ secrets.QUAY_ROBOT_USER }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ on:
paths:
- 'ui/**'
types: [labeled,synchronize]
pull_request_review:
types: [submitted, edited]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
if: (!contains(github.event.label.name, 'skip-ci-ui') || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-ci-ui')
if: (!contains(github.event.label.name, 'skip-ci-ui') && !contains(github.event.pull_request.labels.*.name, 'skip-ci-ui')) || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-ci-ui')
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max-old-space-size=8192'
Expand Down
76 changes: 76 additions & 0 deletions hack/deploy-hub-local/lab-dns-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

function set_firewall(){
echo ">> Setting Firewall"
firewall-cmd --zone=libvirt --add-port=6443/tcp --permanent
firewall-cmd --zone=libvirt --add-service=dhcp --add-service=dhcpv6 --add-service=dns --add-service=mountd --add-service=nfs --add-service=rpc-bind --add-service=ssh --add-service=tftp --permanent
firewall-cmd --reload
}

function checks() {
echo
local fail=0
local success=0
echo ">> DNS Checks"
echo ">>>> Checking External resolution"
for interface in $(hostname -I)
do
if [[ "${interface}" =~ ^192.* ]]; then
echo -n "== Interface ${interface}: "
dig +short @${interface} quay.io | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi

fi


done

# Reset counter to 0 to check internal resolution
local fail=0

echo
echo ">>>> Checking Hub Routes Internal resolution"
for dns_name in "test.apps.test-ci.alklabs.local" "api.test-ci.alklabs.local" "api-int.test-ci.alklabs.local"
do
echo -n "${dns_name}: "
dig +short @192.168.150.1 ${dns_name} | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi
done

if [[ $fail -gt 0 ]];then
echo "ERROR: DNS Configuration has issues, check before continue"
exit 1
fi
}


function set_dnsmasq(){
output=${1}
echo ">> Configuring dnsmasq"
echo "domain=test-ci.alklabs.local,192.168.150.0/24,local
resolv-file=/etc/resolv.upstream.conf
# Hub Cluster
address=/.apps.test-ci.alklabs.local/192.168.150.252
address=/api.test-ci.alklabs.local/192.168.150.253
address=/api-int.test-ci.alklabs.local/192.168.150.253
# Edge-cluster Cluster
address=/.apps.edgecluster0-cluster.alklabs.local/192.168.150.200
address=/api.edgecluster0-cluster.alklabs.local/192.168.150.201
address=/api-int.edgecluster0-cluster.alklabs.local/192.168.150.201" > ${output}

touch /etc/resolv.upstream.conf
cat /etc/resolv.conf /etc/resolv.upstream.conf | grep nameserver |grep -v 127.0.0.1 |sort -u > /etc/resolv.upstream.conf
}

79 changes: 6 additions & 73 deletions hack/deploy-hub-local/lab-dns-external.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
#!/usr/bin/env bash

function set_hostname(){
echo ">> Setting Hostname"
local host=$(hostname -s)
if [[ -z ${host} ]];then
uuid=$(echo "$(uuidgen)" | cut -f1 -d\-)
host="flavio-${uuid}"
fi
hostnamectl set-hostname ${host}.alklabs.local
}
source lab-dns-common.sh


function set_firewall(){
echo ">> Setting Firewall"
firewall-cmd --zone=libvirt --add-port=6443/tcp --permanent
firewall-cmd --zone=libvirt --add-service=dhcp --add-service=dhcpv6 --add-service=dns --add-service=mountd --add-service=nfs --add-service=rpc-bind --add-service=ssh --add-service=tftp --permanent
firewall-cmd --reload
}

function disable_nm_dnsmasq(){
echo ">> Disabling NetworkManager's dnsmasq"
Expand Down Expand Up @@ -69,8 +56,8 @@ EOF
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
}

function set_dnsmasq(){
echo ">> Configuring dnsmasq"
function set_dnsmasqconf(){
echo ">> Configuring dnsmasq.conf"
echo "user=dnsmasq
group=dnsmasq
except-interface=ztpfw,bare-net,virbr0
Expand All @@ -79,22 +66,6 @@ strict-order
bogus-priv
dhcp-authoritative
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig" > /etc/dnsmasq.conf

echo "domain=test-ci.alklabs.local,192.168.150.0/24,local
resolv-file=/etc/resolv.upstream.conf
# Hub Cluster
address=/.apps.test-ci.alklabs.local/192.168.150.252
address=/api.test-ci.alklabs.local/192.168.150.253
address=/api-int.test-ci.alklabs.local/192.168.150.253
# Edge-cluster Cluster
address=/.apps.edgecluster0-cluster.alklabs.local/192.168.150.200
address=/api.edgecluster0-cluster.alklabs.local/192.168.150.201
address=/api-int.edgecluster0-cluster.alklabs.local/192.168.150.201" > /etc/dnsmasq.d/00-test-ci.conf

echo "nameserver 8.8.8.8
nameserver 8.8.4.4" > /etc/resolv.upstream.conf
}

function restart_services(){
Expand All @@ -105,47 +76,9 @@ function restart_services(){
systemctl restart sushy
}

function checks() {
echo
local fail=0
local success=0
echo ">> DNS Checks"
echo ">>>> Checking External resolution"
for interface in $(hostname -I)
do
echo -n "== Interface ${interface}: "
dig +short @${interface} quay.io | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi
done

echo
echo ">>>> Checking Hub Routes Internal resolution"
for dns_name in "test.apps.test-ci.alklabs.local" "api.test-ci.alklabs.local" "api-int.test-ci.alklabs.local"
do
echo -n "${dns_name}: "
dig +short @192.168.150.1 ${dns_name} | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi
done

if [[ $fail -gt 0 ]];then
echo "ERROR: DNS Configuration has issues, check before continue"
exit 1
fi
}

set_hostname
set_firewall
disable_nm_dnsmasq
set_dnsmasq
set_dnsmasqconf
set_dnsmasq /etc/dnsmasq.d/00-test-ci.conf
restart_services
checks
64 changes: 2 additions & 62 deletions hack/deploy-hub-local/lab-dns-internal.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env bash

function set_firewall(){
echo ">> Setting Firewall"
firewall-cmd --zone=libvirt --add-port=6443/tcp --permanent
firewall-cmd --zone=libvirt --add-service=dhcp --add-service=dhcpv6 --add-service=dns --add-service=mountd --add-service=nfs --add-service=rpc-bind --add-service=ssh --add-service=tftp --permanent
firewall-cmd --reload
}
source lab-dns-common.sh

function disable_nm_dnsmasq(){
echo ">> Disabling NetworkManager's dnsmasq"
Expand All @@ -32,22 +27,6 @@ dns=dnsmasq" > /etc/NetworkManager/conf.d/00-dnsmasq.conf
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
}

function set_nm_dnsmasq(){
echo ">> Configuring NetworkManager's dnsmasq"
echo "domain=test-ci.alklabs.local,192.168.150.0/24,local
resolv-file=/etc/resolv.upstream.conf
# Hub Cluster
address=/.apps.test-ci.alklabs.local/192.168.150.252
address=/api.test-ci.alklabs.local/192.168.150.253
address=/api-int.test-ci.alklabs.local/192.168.150.253
# Edge-cluster Cluster
address=/.apps.edgecluster0-cluster.alklabs.local/192.168.150.200
address=/api.edgecluster0-cluster.alklabs.local/192.168.150.201
address=/api-int.edgecluster0-cluster.alklabs.local/192.168.150.201" > /etc/NetworkManager/dnsmasq.d/00-test-ci.conf

cat /etc/resolv.conf | grep nameserver > /etc/resolv.upstream.conf
}

function restart_services(){
echo ">> Restarting Services"
Expand All @@ -56,49 +35,10 @@ function restart_services(){
systemctl restart libvirtd sushy
}

function checks() {
echo
local fail=0
local success=0
echo ">> DNS Checks"
echo ">>>> Checking External resolution"
for interface in $(hostname -I)
do
if [[ "${interface}" =~ ^192.* ]]; then
echo -n "== Interface ${interface}: "
dig +short @${interface} quay.io | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi
fi
done

echo
echo ">>>> Checking Hub Routes Internal resolution"
for dns_name in "test.apps.test-ci.alklabs.local" "api.test-ci.alklabs.local" "api-int.test-ci.alklabs.local"
do
echo -n "${dns_name}: "
dig +short @192.168.150.1 ${dns_name} | grep -v -e '^$'
if [[ $? == 0 ]];then
let success++
else
echo "Failed!"
let fail++
fi
done

if [[ $fail -gt 0 ]];then
echo "ERROR: DNS Configuration has issues, check before continue"
exit 1
fi
}

set_hostname
set_firewall
disable_nm_dnsmasq
set_nm_dnsmasq
set_dnsmasq /etc/NetworkManager/dnsmasq.d/00-test-ci.conf
restart_services
checks

0 comments on commit fc0dd2d

Please sign in to comment.