Skip to content

Commit

Permalink
Converted libvirt to helm install from kustomize (#573)
Browse files Browse the repository at this point in the history
* Converted libvirt to helm install from kustomize

* Needed to remove workflow now that libvirt is in helm

* Updated workflows

Corrected workflow for libvirt and updated install script

* Update helm-libvirt.yaml

Wrong directory

* Files named wrong

* file named wrong

* more changes

learning
  • Loading branch information
aedan authored Nov 20, 2024
1 parent 8e6ec4c commit 53d3393
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 58 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/helm-libvirt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Helm GitHub Actions for Libvirt

on:
pull_request:
paths:
- base-helm-configs/libvirt/**
- .github/workflows/helm-libvirt.yaml
jobs:
helm:
strategy:
matrix:
overlays:
- base
name: Helm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: azure/setup-helm@v3
with:
version: latest
token: "${{ secrets.GITHUB_TOKEN }}"
id: helm
- name: Kubectl Install
working-directory: /usr/local/bin/
run: |
if [ ! -f /usr/local/bin/kubectl ]; then
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
fi
- name: Pull OSH submodules
run: |
git submodule update --init submodules/openstack-helm
git submodule update --init submodules/openstack-helm-infra
- name: Make OSH submodule
run: |
cd submodules/openstack-helm-infra
make libvirt
- name: Run Helm Template
run: |
cd submodules/openstack-helm-infra
${{ steps.helm.outputs.helm-path }} template libvirt ./libvirt \
--namespace=openstack \
--wait \
--timeout 120m \
-f ${{ github.workspace }}/base-helm-configs/libvirt/libvirt-helm-overrides.yaml > /tmp/rendered.yaml
- name: Return helm Build
uses: actions/upload-artifact@v4
with:
name: helm-libvirt-artifact-${{ matrix.overlays }}
path: /tmp/rendered.yaml
40 changes: 0 additions & 40 deletions .github/workflows/kustomize-libvirt.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ pod:
libvirt:
enabled: false
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
dns_policy: "ClusterFirstWithHostNet"
mounts:
libvirt:
Expand Down
9 changes: 0 additions & 9 deletions base-kustomize/libvirt/kustomization.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions bin/install-libvirt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Directory to check for YAML files
CONFIG_DIR="/etc/genestack/helm-configs/libvirt"

pushd /opt/genestack/submodules/openstack-helm-infra || exit

# Base helm upgrade command
HELM_CMD="helm upgrade --install libvirt ./libvirt \
--namespace=openstack \
--timeout 120m"

# Add the base overrides file
HELM_CMD+=" -f /opt/genestack/base-helm-configs/libvirt/libvirt-helm-overrides.yaml"

# Check if YAML files exist in the specified directory
if compgen -G "${CONFIG_DIR}/*.yaml" > /dev/null; then
# Append all YAML files from the directory to the helm command
for yaml_file in "${CONFIG_DIR}"/*.yaml; do
HELM_CMD+=" -f ${yaml_file}"
done
fi

# Run the helm command
eval "${HELM_CMD}"

popd || exit
10 changes: 7 additions & 3 deletions docs/infrastructure-libvirt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

The first part of the compute kit is Libvirt.

``` shell
kubectl kustomize --enable-helm /etc/genestack/kustomize/libvirt | kubectl apply --namespace openstack -f -
```
## Run the package deployment

!!! example "Run the libvirt deployment Script `bin/install-libvirt.sh`"

``` shell
--8<-- "bin/install-libvirt.sh"
```

Once deployed you can validate functionality on your compute hosts with `virsh`

Expand Down

0 comments on commit 53d3393

Please sign in to comment.