Skip to content
Merged
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
88 changes: 88 additions & 0 deletions .github/workflows/container-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Build Kolla container images
on:
workflow_dispatch:
inputs:
regexes:
description: Space-separated list of regular expressions matching images to build
type: string
required: false
default: ""

env:
ANSIBLE_FORCE_COLOR: True
jobs:
build:
name: Build Kolla container images
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
steps:
- uses: actions/checkout@v3
with:
path: src/kayobe-config

- name: Clone StackHPC Kayobe repository
uses: actions/checkout@v3
with:
repository: stackhpc/kayobe
ref: refs/heads/stackhpc/wallaby
path: src/kayobe

# FIXME: Failed in kolla-ansible : Ensure the latest version of pip is installed
- name: Install dependencies
run: |
sudo dnf -y install python3-virtualenv

- name: Setup networking
run: |
if ! ip l show breth1 >/dev/null 2>&1; then
sudo ip l add breth1 type bridge
fi
sudo ip l set breth1 up
if ! ip a show breth1 | grep 192.168.33.3/24; then
sudo ip a add 192.168.33.3/24 dev breth1
fi
if ! ip l show dummy1 >/dev/null 2>&1; then
sudo ip l add dummy1 type dummy
fi
sudo ip l set dummy1 up
sudo ip l set dummy1 master breth1

- name: Install Kayobe
run: |
mkdir -p venvs &&
pushd venvs &&
python3 -m venv kayobe &&
source kayobe/bin/activate &&
pip install -U pip &&
pip install ../src/kayobe

- name: Bootstrap the control host
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe control host bootstrap

- name: Configure the seed host
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host configure
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}

- name: Build and push kolla overcloud images
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud container image build ${{ github.events.input.regexes }} --push
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}

- name: Get the container image tag
run: |
echo "::set-output name=kolla_tag::$(cat ~/kolla_tag)"
id: kolla_tag

- name: Display the container image tag
run: |
echo "${{ steps.kolla_tag.outputs.kolla_tag }}"
106 changes: 106 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,112 @@ with the push repository using the pulp CLI:
Started background task /pulp/api/v3/tasks/1f0a474a-b7c0-44b4-9ef4-ed633077f4d8/
.Done.

Environments
============

The following Kayobe environments are provided with this configuration:

* ``ci-builder``: builds container images

ci-builder
----------

The ``ci-builder`` Kayobe environment is used to build Kolla container images.
Images are built using package repositories in the StackHPC development Pulp
service, and pushed there once built.

Prerequisites
^^^^^^^^^^^^^

* a CentOS Stream 8 host
* access to the local Pulp server

Setup
^^^^^

Access the host via SSH.

Clone the Kayobe and Kayobe configuration repositories (this one):

.. code-block:: console

cd
mkdir -p src
pushd src
git clone https://github.com/stackhpc/kayobe.git -b stackhpc/wallaby
git clone https://github.com/stackhpc/stackhpc-kayobe-config -b stackhpc/wallaby
popd

Create a virtual environment and install Kayobe:

.. code-block:: console

cd
mkdir -p venvs
pushd venvs
virtualenv kayobe
source kayobe/bin/activate
pip install -U pip
pip install ../src/kayobe
popd

Add initial network configuration:

.. code-block:: console

sudo ip l add breth1 type bridge
sudo ip l set breth1 up
sudo ip a add 192.168.33.3/24 dev breth1
sudo ip l add dummy1 type dummy
sudo ip l set dummy1 up
sudo ip l set dummy1 master breth1

Installation
^^^^^^^^^^^^

Acquire the Ansible Vault password for this repository, and store a copy at
``~/vault-pw``.

The following commands install Kayobe and its dependencies, and prepare the
Ansible control host.

.. code-block:: console

export KAYOBE_VAULT_PASSWORD=$(cat ~/vault-pw)
pushd ~/venvs/kayobe
source bin/activate
popd
pushd ~/src/kayobe-config
source kayobe-env --environment ci-builder
kayobe control host bootstrap

Deployment
^^^^^^^^^^

Next, configure the host OS & services.

.. code-block:: console

kayobe seed host configure

Building images
^^^^^^^^^^^^^^^

At this point you are ready to build and push some container images.

.. code-block:: console

kayobe seed container image build --push
kayobe overcloud container image build --push

The container images are tagged as ``wallaby-<datetime>``. This Kayobe
configuration includes a hook that writes the tag to ``~/kolla_tag``, since
it is not always simple to determine which tag was last applied to built
images.

To use the new images, edit
``~/src/kayobe-config/etc/kayobe/kolla.yml`` to set the above
tag as the value of the ``kolla_openstack_release`` variable.

Resources
=========
Expand Down
1 change: 1 addition & 0 deletions etc/kayobe/ansible/filter_plugins
1 change: 1 addition & 0 deletions etc/kayobe/ansible/group_vars
1 change: 1 addition & 0 deletions etc/kayobe/ansible/test_plugins
19 changes: 19 additions & 0 deletions etc/kayobe/ansible/write-kolla-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Write out value of kolla_tag
hosts: localhost
gather_facts: no
vars:
kolla_tag_dest: ~/kolla_tag
tasks:
- name: Query image tag
shell:
cmd: >-
grep '^tag' {{ kolla_build_config_path }}/kolla-build.conf |
sed 's/tag\s=\s\(.*\)/\1/'
become: true
register: tag

- name: Write out value of kolla_tag
copy:
content: "{{ tag.stdout }}"
dest: "{{ kolla_tag_dest }}"
15 changes: 15 additions & 0 deletions etc/kayobe/environments/ci-builder/globals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Kayobe global configuration.

###############################################################################
# OS distribution.

# OS distribution name. Valid options are "centos", "ubuntu". Default is
# "centos".
os_distribution: "{{ lookup('pipe', '. /etc/os-release && echo $ID') | trim }}"

###############################################################################
# SELinux.

# Avoid a reboot.
disable_selinux_do_reboot: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
###############################################################################
# Network interface definitions for the controller group.

# Controller interface on all-in-one network.
aio_interface: breth1
# Use dummy1 if it exists, otherwise the bridge will have no ports.
aio_bridge_ports: "{{ ['dummy1'] if 'ansible_dummy1' in hostvars[inventory_hostname] else [] }}"

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

14 changes: 14 additions & 0 deletions etc/kayobe/environments/ci-builder/inventory/groups
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[seed]

[container-image-builders:children]
seed

[network]

[docker:children]
# Hosts in this group will have Docker installed.
seed

[ntp:children]
# Kayobe will configure Chrony on members of this group.
seed
3 changes: 3 additions & 0 deletions etc/kayobe/environments/ci-builder/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# A 'seed' host used for building images.
[seed]
builder
14 changes: 14 additions & 0 deletions etc/kayobe/environments/ci-builder/kolla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Kayobe Kolla configuration.

###############################################################################
# Kolla configuration.

# Docker tag applied to built container images. Default is
# {{ kolla_openstack_release }}.
# Tag images with the timestamp at which facts were gathered.
kolla_tag: "{{ openstack_release }}-{{ ansible_facts.date_time.iso8601_basic_short }}"

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
Empty file.
4 changes: 4 additions & 0 deletions etc/kayobe/environments/ci-builder/network-allocation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
aio_ips:
builder: 192.168.33.3

Loading