From 3e37f6e847bf5019c261abf783c6bb43f4f7c657 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 11 Aug 2020 09:31:24 -0400 Subject: [PATCH] Added tailscale chart Change-Id: Ife270e925cdffa92033de584ce20afbe1fe1cf2c --- charts/tailscale/Chart.yaml | 11 ++++++ charts/tailscale/templates/_helpers.tpl | 40 ++++++++++++++++++++ charts/tailscale/templates/daemonset.yaml | 46 +++++++++++++++++++++++ charts/tailscale/values.yaml | 1 + 4 files changed, 98 insertions(+) create mode 100755 charts/tailscale/Chart.yaml create mode 100755 charts/tailscale/templates/_helpers.tpl create mode 100755 charts/tailscale/templates/daemonset.yaml create mode 100755 charts/tailscale/values.yaml diff --git a/charts/tailscale/Chart.yaml b/charts/tailscale/Chart.yaml new file mode 100755 index 0000000..11e8c1a --- /dev/null +++ b/charts/tailscale/Chart.yaml @@ -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 diff --git a/charts/tailscale/templates/_helpers.tpl b/charts/tailscale/templates/_helpers.tpl new file mode 100755 index 0000000..570dd14 --- /dev/null +++ b/charts/tailscale/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/tailscale/templates/daemonset.yaml b/charts/tailscale/templates/daemonset.yaml new file mode 100755 index 0000000..e01340f --- /dev/null +++ b/charts/tailscale/templates/daemonset.yaml @@ -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 + + + diff --git a/charts/tailscale/values.yaml b/charts/tailscale/values.yaml new file mode 100755 index 0000000..ed97d53 --- /dev/null +++ b/charts/tailscale/values.yaml @@ -0,0 +1 @@ +---