Added tailscale chart

Change-Id: Ife270e925cdffa92033de584ce20afbe1fe1cf2c
This commit is contained in:
Mohammed Naser 2020-08-11 09:31:24 -04:00
parent cd1357cf6a
commit 3e37f6e847
4 changed files with 98 additions and 0 deletions

11
charts/tailscale/Chart.yaml Executable file
View File

@ -0,0 +1,11 @@
---
apiVersion: v1
name: tailscale
version: 0.0.0
description: Tailscale for Kubernetes
home: https://opendev.org/vexxhost/helm-charts
maintainers:
- name: Mohammed Naser
email: mnaser@vexxhost.com
url: https://github.com/mnaser
appVersion: 1.0.4

View File

@ -0,0 +1,40 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "tailscale.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tailscale.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Generate basic labels
*/}}
{{- define "tailscale.labels" -}}
app.kubernetes.io/name: {{ include "tailscale.fullname" . }}
app.kubernetes.io/instance: {{ include "tailscale.chart" . }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "tailscale.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "tailscale.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "tailscale.labels" . | indent 4 }}
spec:
selector:
matchLabels:
{{ include "tailscale.labels" . | indent 6 }}
template:
metadata:
labels:
{{ include "tailscale.labels" . | indent 8 }}
spec:
automountServiceAccountToken: false
hostNetwork: true
containers:
- name: tailscale
image: vexxhost/tailscale:latest
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "while [ ! -S /var/run/tailscale/tailscaled.sock ]; do sleep 1; done; tailscale up -authkey {{ .Values.authKey }}"]
volumeMounts:
- name: tailscale-state
mountPath: /var/lib/tailscale
- name: dev-tun
mountPath: /dev/net/tun
securityContext:
capabilities:
add: ["NET_ADMIN"]
volumes:
- name: tailscale-state
hostPath:
path: /var/lib/tailscale
type: DirectoryOrCreate
- name: dev-tun
hostPath:
type: CharDevice
path: /dev/net/tun

1
charts/tailscale/values.yaml Executable file
View File

@ -0,0 +1 @@
---