36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
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:
|
|
- run: apk add tailscale kubectl bash curl
|
|
name: Install dependencies
|
|
shell: bash
|
|
- name: Create kube directory
|
|
run: mkdir /opt/kube
|
|
shell: bash
|
|
- name: Bootstrap kubeconfig
|
|
run: echo "$PALTIVERSE_K8S" | base64 -d > /opt/kube/config
|
|
env:
|
|
PALTIVERSE_K8S: ${{ inputs.k8s-config }}
|
|
shell: bash
|
|
- name: Add tailscale proxy to kubeconfig
|
|
run: kubectl config set clusters.default.proxy-url http://localhost:1055
|
|
env:
|
|
KUBECONFIG: /opt/kube/config
|
|
shell: bash
|
|
- name: Configure tailscale
|
|
run: tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055 & tailscale up --authkey="${{ secrets.TAILSCALE_TOKEN }}" --advertise-tags=tag:gitea-runners
|
|
shell: bash
|