internal-headscale: Add Chart

This commit is contained in:
PapaTutuWawa 2025-10-13 20:09:02 +02:00
parent 9cf72e7de2
commit 19efca2c1f
5 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,6 @@
dependencies:
- name: common
repository: file://../common/
version: 0.1.0
digest: sha256:32af153d0dda4cde05d135c6a839d2c49c8a2e65b8ecf7b819f24e5c3fbf6721
generated: "2025-10-12T22:46:29.173735278+02:00"

View File

@ -0,0 +1,10 @@
apiVersion: v2
name: internal-headscale
description: An internal entry-point for Tailscale to access internal services
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
- name: common
version: 0.1.0
repository: file://../common/

View File

@ -0,0 +1,83 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels: {{- include "common.app.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels: {{- include "common.app.labels" . | nindent 6 }}
template:
metadata:
labels: {{- include "common.app.labels" . | nindent 8 }}
spec:
containers:
{{- range $forward := .Values.socat.config.forwards }}
- name: {{ $forward.name }}
image: "{{ $.Values.socat.image }}:{{ $.Values.socat.imageVersion }}"
command:
- socat
- TCP-LISTEN:{{ $forward.port }},fork,reuseaddr
- TCP:{{ $forward.target }}:{{ $forward.targetPort }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- if or (eq (int $forward.port) 80) (eq (int $forward.port) 443) }}
add:
{{/*Allow binding to :80 and :443 in the container*/}}
- NET_BIND_SERVICE
{{- end }}
runAsUser: 10001
runAsGroup: 10001
readOnlyRootFilesystem: true
{{- end }}
- name: tailscale
image: "{{ .Values.tailscale.image }}:{{ .Values.tailscale.imageVersion }}"
env:
- name: TS_USERSPACE
value: "true"
- name: TS_STATE_DIR
value: /var/lib/tailscale
- name: TS_AUTH_KEY
valueFrom:
secretKeyRef:
key: token
name: {{ .Values.tailscale.config.secret.secretName }}
- name: TS_NO_LOGS_NO_SUPPORT
value: "true"
{{/*Don't try to reauth all the time*/}}
- name: TS_AUTH_ONCE
value: "true"
{{/*Prevent tailscale from connecting to the cluster*/}}
- name: KUBERNETES_SERVICE_HOST
value: ""
- name: TS_EXTRA_ARGS
value: "--advertise-tags={{ .Values.tailscale.config.tag }} --login-server {{ .Values.tailscale.config.loginServer }} --hostname {{ .Values.tailscale.config.hostname }}"
- name: TS_HEALTHCHECK_ADDR_PORT
value: "0.0.0.0:9999"
readinessProbe:
httpGet:
port: 9999
path: /healthz
scheme: HTTP
initialDelaySeconds: 5
failureThreshold: 5
livenessProbe:
httpGet:
port: 9999
path: /healthz
scheme: HTTP
failureThreshold: 5
volumeMounts:
- mountPath: /var/lib/tailscale
name: state
securityContext:
capabilities:
drop:
- ALL
volumes:
- name: state
{{- .Values.tailscale.mounts.state | toYaml | nindent 10 }}

View File

@ -0,0 +1,21 @@
namespace: default
socat:
image: git.polynom.me/papatutuwawa/socat
imageVersion: 3.21-20250917
config:
forwards:
- name: test
port: 6443
target: cluster
targetPort: 1234
tailscale:
image: docker.io/tailscale/tailscale@sha256
imageVersion: d26fc9bb035b0559900cc6f23506f6b1ddab61a690ffab4f5d84feceb3de811e
mounts:
config:
loginServer: "https://example.org"
hostname: example-host
secret:
# Secret containing the login token
secretName: internal-headscale
tag: "tag:k8s"