-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (76 loc) · 2.14 KB
/
deploy-gh.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Multi node cluster with managed runners, Ubuntu, Kubespray
on:
push:
# branches: [ main ]
workflow_dispatch:
env:
num_nodes: 4
tunnel_ip: 77.47.73.136
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: |
set -vx
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 .
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo cat /var/log/auth.log
- name: Upload control node data
uses: actions/upload-artifact@v4
with:
name: control-node
path: |
control-node-ip.txt
id_rsa.pub
- run: |
set -vx
#ssh -o StrictHostKeyChecking=no $(hostname -i) echo hello
ip addr
ps -ef
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
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -S
echo ${{ matrix.id }}
ip=$(cat control-node-ip.txt)
mkdir .ssh
chmod 700 .ssh
chmod 600 id_rsa.pub
mv id_rsa.pub .ssh/
ip addr
ssh -o StrictHostKeyChecking=no $ip echo hello