Skip to content

Commit

Permalink
Initial tailscale extension
Browse files Browse the repository at this point in the history
This downloads and compiles tailscale,
as a talos extension, running as a service.

Currently only aiming for host networking
  • Loading branch information
btrepp committed Apr 28, 2023
1 parent ac58e68 commit 9522433
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ TARGETS = \
nut-client \
nvidia-container-toolkit \
nvidia-fabricmanager \
nvidia-open-gpu-kernel-modules
nvidia-open-gpu-kernel-modules \
tailscale

# Temporarily disabled, as mellanox-ofed fails to build with Linux 6.1
# mellanox-ofed \
Expand Down
10 changes: 10 additions & 0 deletions network/tailscale/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1alpha1
metadata:
name: tailscale
version: "$VERSION"
author: Beau Trepp
description: |
Tailscale connects your team's devices and development environments for easy access to remote resources.
compatibility:
talos:
version: ">= v1.2.0"
38 changes: 38 additions & 0 deletions network/tailscale/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: tailscale
variant: scratch
shell: /toolchain/bin/bash
dependencies:
- stage: base
steps:
- env:
GOPATH: /go
- sources:
- url: https://github.com/tailscale/tailscale/archive/refs/tags/v{{ .TAILSCALE_VERSION }}.tar.gz
destination: tailscale.tar.gz
sha256: 6964176889943e0e0b25d8d69e14226cfb1c1a9944a257b24cb2dd212f797141
sha512: a64cad7685ba1dd438e16c8fa6ed1c29e5d840ffe17b2417342e43a2da5c1679826eb3a29b33e40ac075171a59605cdc857e1e09e60cf5140b22d363bb31ff30
prepare:
- |
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
- |
tar -xzvf tailscale.tar.gz --strip-components=1
build:
- |
export PATH=${PATH}:${TOOLCHAIN}/go/bin
mkdir dist
go build -o dist -ldflags "-X tailscale.com/version.shortStamp={{ .TAILSCALE_VERSION }}" tailscale.com/cmd/{tailscale,tailscaled,containerboot}
install:
- |
mkdir -p /rootfs/usr/local/etc/containers
mkdir -p /rootfs/usr/local/lib/containers/tailscale
mkdir -p /rootfs/usr/local/bin
cp -pr dist/tailscale /rootfs/usr/local/bin
cp -pr dist/tailscaled /rootfs/usr/local/bin
cp -pr dist/containerboot /rootfs/usr/local/lib/containers/tailscale
finalize:
- from: /rootfs
to: /rootfs
- from: /pkg/manifest.yaml
to: /
- from: /pkg/tailscale.yaml
to: /rootfs/usr/local/etc/containers/
66 changes: 66 additions & 0 deletions network/tailscale/tailscale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: tailscale
depends:
- service: cri
- network:
- addresses
- connectivity
- etcfiles
container:
entrypoint: ./containerboot
args: []
environment:
- PATH=/usr/local/bin:/sbin
- TS_SOCKET=/var/run/tailscale/tailscaled.sock
- TS_STATE_DIR=/var/lib/tailscale
- TS_USERSPACE=false
security:
maskedPaths: []
readonlyPaths: []
writeableRootfs: true
writeableSysfs: true
mounts:
# libs
- source: /lib
destination: /lib
type: bind
options:
- bind
- ro
# more libs
- source: /usr/lib
destination: /usr/lib
type: bind
options:
- bind
- ro
- source: /sbin
destination: /sbin
type: bind
options:
- bind
- ro
- source: /usr/local/bin
destination: /usr/local/bin
type: bind
options:
- bind
- ro
- source: /dev/net/tun
destination: /dev/net/tun
type: bind
options:
- bind
- rw
- source: /var/lib/tailscale
destination: /var/lib/tailscale
type: bind
options:
- bind
- rw
- source: /var/run/tailscale
destination: /var/run/tailscale
type: bind
options:
- bind
- rw
restart: always
1 change: 1 addition & 0 deletions network/tailscale/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION: "{{ .TAILSCALE_VERSION }}-{{ .BUILD_ARG_TAG }}"
1 change: 1 addition & 0 deletions network/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TAILSCALE_VERSION: 1.40.0

0 comments on commit 9522433

Please sign in to comment.