Skip to content

Commit 3250917

Browse files
committed
feature: EA-47 assign the second node as an ingress and tie it to the staging dns
1 parent 0aff8a9 commit 3250917

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

.github/workflows/terraform.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
run: echo "MASTER_IP=$(bash ./scripts/get_master_ip.sh)" >> $GITHUB_ENV
4747
working-directory: .
4848

49+
- name: Get Ingress Public IP
50+
id: master_ip
51+
run: echo "INGRESS_IP=$(bash ./scripts/get_ingress_ip.sh)" >> $GITHUB_ENV
52+
working-directory: .
53+
4954

5055
- name: Update All Dynu DNS Records
5156
run: |
@@ -95,6 +100,21 @@ jobs:
95100
"ipv4Address": "'$MASTER_IP'"
96101
}'
97102
103+
104+
# Update staging subdomain
105+
curl -X POST "https://api.dynu.com/v2/dns/12956376/record/16541286" \
106+
-H "accept: application/json" \
107+
-H "API-Key: ${{ secrets.DYNU_API_KEY }}" \
108+
-H "Content-Type: application/json" \
109+
-d '{
110+
"nodeName": "staging",
111+
"recordType": "A",
112+
"ttl": 120,
113+
"state": true,
114+
"group": "",
115+
"ipv4Address": "'$INGRESS_IP'"
116+
}'
117+
98118
- name: Send Slack alert
99119
run: |
100120
curl -X POST -H 'Content-type: application/json' --data '{"text":"Terraform infrastructure has been provisioned, dynu ddns has been configured in https://teleport.exploravis.mywire.org/"}' ${{ secrets.SLACK_WEBHOOK }}

scripts/get_ingress_ip.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python3
2+
import json
3+
import sys
4+
5+
6+
tf_output = json.load(sys.stdin)
7+
clusters = tf_output["clusters_creds"]["value"]
8+
9+
for _, cluster in clusters.items():
10+
master_ip = cluster["worker_ips"][0]["public_ip"]
11+
print(master_ip)

scripts/get_ingress_ip.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(pwd)"
5+
TF_DIR="$ROOT_DIR/terraform"
6+
PY_SCRIPT="$ROOT_DIR/scripts/get_ingress_ip.py"
7+
8+
terraform -chdir="$TF_DIR" output -json | python3 "$PY_SCRIPT"

0 commit comments

Comments
 (0)