Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@ name: CI for chi-in-a-box script
on:
push:
branches:
- master
- stable/*
pull_request:
branches:
- master
- stable/*

jobs:
test:
name: test cc-ansible
runs-on: [self-hosted, kvm, ciab, ubuntu-18.04]
test_edge:
name: Run tests for edge
runs-on: [ubuntu-22.04]
env:
CC_ANSIBLE_SITE: /opt/site-config
defaults:
run:
shell: bash
steps:
- name: Checkout code base
uses: actions/checkout@v2
- name: init site-config
run: "./cc-ansible init"
continue-on-error: true
- run: "./cc-ansible bootstrap-servers"
- run: "./cc-ansible prechecks"
- run: "./cc-ansible pull"
- run: "./cc-ansible genconfig"
- name: Checkout code
uses: actions/checkout@v4
- name: run test script
run: tests/run.sh edge
17 changes: 0 additions & 17 deletions .github/workflows/reviewdog.yml

This file was deleted.

8 changes: 3 additions & 5 deletions cc-ansible
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ install_deps() {

# Update/install yq, adding it to the venv bin path
YQ_VERSION=4.9.6
if [[ "$(type -t yq)" != "file" ]]; then
YQ_BINARY="yq_linux_amd64"
wget https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - \
| tar xz && mv ${YQ_BINARY} "$VIRTUALENV/bin/yq"
fi
YQ_BINARY="yq_linux_amd64"
wget https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - \
| tar xz && mv ${YQ_BINARY} "$VIRTUALENV/bin/yq"

# install kolla-ansible galaxy deps. We use a subshell to drop back out of the venv afterwards
(source "${VIRTUALENV}/bin/activate" && kolla-ansible install-deps)
Expand Down
2 changes: 1 addition & 1 deletion src/kolla-ansible
96 changes: 96 additions & 0 deletions tests/edge/defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
#################
# CHI@Edge config
#################

# CHI@Edge does not enable volumes
enable_cinder: false
# We use docker registries instead of glance
enable_glance: false
# We don't use heat
enable_heat: false
# No ironic, as there are no baremetal nodes
enable_ironic_ipxe: false
enable_ironic: false
# No nova, as we dont use baremetal or VMs here
enable_nova_serialconsole_proxy: false
enable_nova: false

# enable doni for edge device management
enable_doni: true
# enable blazar, reserve devices
enable_blazar: true
blazar_enable_device_plugin_k8s: true
# enable tunelo, tunnels to edge devices
enable_tunelo: true
enable_neutron_wireguard: true

# enable zun, but use compute_k8s backend
enable_zun: true
enable_zun_compute: false
enable_zun_compute_k8s: true

# deploy a k3s server on control nodes
enable_k3s: true

doni_balena_fleet_mapping:
- 'raspberrypi3-64:chi-edge-workers'
- 'raspberrypi4-64:chi-edge-workers'
- 'raspberrypi5-64:chi-edge-workers'
- 'jetson-nano:chi-edge-workers'
- 'jetson-xavier-nx-emmc:chi-edge-workers'


k3s_port: 6443
k3s_server_ip: "{{ api_interface_address }}"
kubeconfig_path: /opt/site-config/node_custom_config
k8s_worker_taint:
key: "worker-node"
value: "true"
effect: "NoSchedule"
zun_tolerate_worker_taint: False
doni_enable_worker_taint: False

######################
# Site specific config
######################

#k3s_server_ip: "129.114.34.130"
#
openstack_region_name: CHI@Edge
chameleon_site_name: edge
keystone_idp_client_id: keystone-edge-prod

kolla_internal_vip_address: "10.20.111.11"
kolla_external_vip_address: "129.114.34.129"
kolla_external_fqdn: chi.edge.chameleoncloud.org
keepalived_virtual_router_id: "72"


# Letsencrypt
# kolla_enable_tls_external: "yes"
# kolla_externally_managed_cert: "yes"
# enable_letsencrypt: yes
letsencrypt_email: [email protected]
letsencrypt_domains:
- "{{ kolla_external_fqdn }}"

# Neutron
neutron_type_drivers: flat,vlan,vxlan,local
neutron_tenant_network_types: local
neutron_networks:
- name: public
bridge_name: br-ex
external_interface: neutron1
# This should be your public IP block assigned to your deployment.
cidr: 129.114.34.128/25
gateway_ip: 129.114.34.254

# k3s_cluster_cidr: 192.168.64.0/18
k3s_cluster_cidr: 100.64.64.0/18

# overrides for CI

enable_central_logging: false
enable_prometheus: false
enable_letsencrypt: false
7 changes: 7 additions & 0 deletions tests/edge/host_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Initial assumption is that this is also the deployment node,
# therefore any provisioning can be done locally.
ansible_connection: local

network_interface: internal1
kolla_external_vip_interface: external1
25 changes: 25 additions & 0 deletions tests/edge/setup_ifaces.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -euo pipefail

# Function to create veth pair if it doesn't exist
ensure_veth_up() {
local dev1=$1
local dev2=$2

if ! ip link show "$dev1" &> /dev/null; then
sudo ip link add dev "$dev1" type veth peer "$dev2"
fi

sudo ip link set "$dev1" up
sudo ip link set "$dev2" up
}


ensure_veth_up external1 external2
sudo ip addr replace 129.114.34.128/25 dev external1

ensure_veth_up internal1 internal2
sudo ip addr replace 10.20.111.128/25 dev internal1

ensure_veth_up neutron1 neutron2
56 changes: 56 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -euo pipefail

# Function to run a stage with GitHub Actions grouping
run_stage() {
local stage_name="$1"
shift

if [ -n "${GITHUB_ACTIONS:-}" ]; then
echo "::group::$stage_name"
else
echo "=== $stage_name ==="
fi

# Run the command and capture exit code
"$@"
local exit_code=$?

if [ -n "${GITHUB_ACTIONS:-}" ]; then
echo "::endgroup::"
if [ $exit_code -ne 0 ]; then
echo "::error::$stage_name failed"
fi
fi

return $exit_code
}

copy_configs() {
cp "./tests/${configdir}/defaults.yml" /opt/site-config/defaults.yml \
&& cp "./tests/${configdir}/host_vars.yml" "/opt/site-config/inventory/host_vars/$HOSTNAME"
}

configdir="${1}"

# set hostname to keep rabbit happy
sudo hostnamectl set-hostname "ciablocal"

run_stage "Install dependencies" ./cc-ansible install_deps

run_stage "Initialize site-config" ./cc-ansible init --site-config /opt/site-config || true

run_stage "Setup network interfaces" "./tests/${configdir}/setup_ifaces.sh"

run_stage "Copy configuration files" copy_configs

run_stage "Bootstrap servers" ./cc-ansible bootstrap-servers

run_stage "Deploy services" ./cc-ansible deploy

# run_stage "Post-deploy" ./cc-ansible post-deploy

# run_stage "Run tests" ./cc-ansible run-tests

echo "All stages completed successfully!"
Loading