This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Multi node cluster with managed runners, Ubuntu, Kubespray | |
on: | |
push: | |
# branches: [ main ] | |
workflow_dispatch: | |
env: | |
num_nodes: 4 | |
jobs: | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
nodes: ${{ steps.nodes.outputs.nodes }} | |
steps: | |
- id: nodes | |
run: | | |
nodes=$(python -c "print(list(range($num_nodes)))") | |
echo nodes="$nodes" >>$GITHUB_OUTPUT | |
control-node: | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
hostname -i >control-node-ip.txt | |
ssh-keygen -q -b 2048 -t rsa -N '' -C 'cluster key' -f ~/.ssh/id_rsa | |
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys | |
cp ~/.ssh/id_rsa.pub . | |
- name: Upload control node data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: control-node | |
path: | | |
control-node-ip.txt | |
id_rsa.pub | |
- run: | | |
sleep 200 | |
nodes: | |
needs: [define-matrix] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
id: ${{ fromJSON(needs.define-matrix.outputs.nodes) }} | |
steps: | |
- run: | | |
sleep 60 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: control-node | |
- run: | | |
set -vx | |
ls -l | |
echo ${{ matrix.id }} | |
ip=$(cat control-node-ip.txt) | |
mkdir .ssh | |
mv id_rsa.pub .ssh/ | |
ping $ip | |
ssh $ip echo hello | |