2024-01-17 11:08:04 +00:00
|
|
|
name: "Kubectl/Tailscale for Paltiverse"
|
|
|
|
description: "Connect to kube-api through a Tailscale tunnel and set up kubectl"
|
|
|
|
inputs:
|
|
|
|
tailscale-token:
|
|
|
|
description: "An authKey for connecting to Tailscale"
|
|
|
|
required: true
|
|
|
|
k8s-config:
|
|
|
|
description: "A kubeconfig file for authenticating with the kube-api"
|
|
|
|
required: true
|
|
|
|
outputs:
|
|
|
|
k8s-config-path:
|
|
|
|
description: "The location of the stored kubeconfig file. You can use this through the KUBECONFIG variable to kubectl calls."
|
|
|
|
value: /opt/kube/config
|
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
2024-04-02 14:00:09 +01:00
|
|
|
- run: apk add tailscale kubectl bash curl ca-certificates
|
2024-01-17 11:08:04 +00:00
|
|
|
name: Install dependencies
|
2024-01-17 11:15:05 +00:00
|
|
|
shell: sh
|
2024-01-17 11:08:04 +00:00
|
|
|
- name: Create kube directory
|
|
|
|
run: mkdir /opt/kube
|
2024-01-17 11:15:05 +00:00
|
|
|
shell: sh
|
2024-01-17 11:08:04 +00:00
|
|
|
- name: Bootstrap kubeconfig
|
|
|
|
run: echo "$PALTIVERSE_K8S" | base64 -d > /opt/kube/config
|
|
|
|
env:
|
|
|
|
PALTIVERSE_K8S: ${{ inputs.k8s-config }}
|
2024-01-17 11:15:05 +00:00
|
|
|
shell: sh
|
2024-01-17 11:08:04 +00:00
|
|
|
- name: Add tailscale proxy to kubeconfig
|
|
|
|
run: kubectl config set clusters.default.proxy-url http://localhost:1055
|
|
|
|
env:
|
|
|
|
KUBECONFIG: /opt/kube/config
|
2024-01-17 11:15:05 +00:00
|
|
|
shell: sh
|
2024-01-17 11:08:04 +00:00
|
|
|
- name: Configure tailscale
|
2024-01-17 11:41:56 +00:00
|
|
|
run: tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055 & tailscale up --authkey="${{ inputs.tailscale-token }}" --advertise-tags=tag:gitea-runners
|
2024-01-17 11:15:05 +00:00
|
|
|
shell: sh
|
2024-04-02 14:00:09 +01:00
|
|
|
- name: Configure DNS
|
2024-04-02 14:05:10 +01:00
|
|
|
run: |
|
|
|
|
echo -e "nameserver 100.100.100.100\nnameserver 1.1.1.1\nnameserver 1.0.0.1" | cat - /etc/resolv.conf > /tmp/resolv.conf
|
|
|
|
mv /tmp/resolv.conf /etc/resolv.conf
|
2024-04-02 14:00:09 +01:00
|
|
|
shell: sh
|