feat(headscale): init
This commit is contained in:
parent
be6f1b5231
commit
c18074b916
16 changed files with 787 additions and 0 deletions
23
headscale/.helmignore
Normal file
23
headscale/.helmignore
Normal 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/
|
12
headscale/Chart.yaml
Normal file
12
headscale/Chart.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v2
|
||||
name: headscale
|
||||
description: An open source, self-hosted implementation of the Tailscale control server.
|
||||
icon: https://raw.githubusercontent.com/juanfont/headscale/56a7b1e34952c3e0306a134b2be9b4277f5d8d6e/docs/logo/headscale3-dots.svg
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "0.22.3"
|
||||
keywords:
|
||||
- headscale
|
||||
- tailscale
|
||||
- wireguard
|
||||
- vpn
|
22
headscale/templates/NOTES.txt
Normal file
22
headscale/templates/NOTES.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "headscale.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "headscale.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "headscale.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "headscale.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
62
headscale/templates/_helpers.tpl
Normal file
62
headscale/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,62 @@
|
|||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "headscale.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 "headscale.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 }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "headscale.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "headscale.labels" -}}
|
||||
helm.sh/chart: {{ include "headscale.chart" . }}
|
||||
{{ include "headscale.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "headscale.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "headscale.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "headscale.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "headscale.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
12
headscale/templates/certificate.yaml
Normal file
12
headscale/templates/certificate.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- if and .Values.headscale.certmanager.enabled (.Capabilities.APIVersions.Has "cert-manager.io/v1/Certificate") }}
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
spec:
|
||||
secretName: {{ include "headscale.fullname" . }}-cert
|
||||
dnsNames:
|
||||
{{- toYaml .Values.headscale.certmanager.dnsNames | nindent 4 }}
|
||||
issuerRef:
|
||||
{{- toYaml .Values.headscale.certmanager.issuerRef | nindent 4 }}
|
||||
{{- end }}
|
119
headscale/templates/deployment.yaml
Normal file
119
headscale/templates/deployment.yaml
Normal file
|
@ -0,0 +1,119 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "headscale.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
config-hash: {{ toYaml .Values.headscale.config | sha256sum | trunc 32 }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "headscale.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "headscale.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
args:
|
||||
- "headscale"
|
||||
- "serve"
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port.http }}
|
||||
protocol: TCP
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.service.port.metrics }}
|
||||
protocol: TCP
|
||||
- name: grpc
|
||||
containerPort: {{ .Values.service.port.grpc }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
scheme: HTTPS
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
scheme: HTTPS
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/etc/headscale"
|
||||
readOnly: true
|
||||
- name: keys
|
||||
mountPath: "/etc/headscale/secrets"
|
||||
readOnly: true
|
||||
{{- if .Values.headscale.certmanager.enabled }}
|
||||
- name: certs
|
||||
mountPath: "/etc/headscale/certs"
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
- name: "data"
|
||||
mountPath: "/var/lib/headscale"
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
secret:
|
||||
secretName: {{ include "headscale.fullname" . }}
|
||||
items:
|
||||
- key: "config.yaml"
|
||||
path: "config.yaml"
|
||||
- name: keys
|
||||
secret:
|
||||
secretName: {{ default (print ( include "headscale.fullname" . ) "-keys") $.Values.headscale.keys.existingSecret | quote }}
|
||||
items:
|
||||
- key: "wireguard.key"
|
||||
path: "wireguard.key"
|
||||
- key: "noise.key"
|
||||
path: "noise.key"
|
||||
{{- if .Values.headscale.certmanager.enabled }}
|
||||
- name: certs
|
||||
secret:
|
||||
secretName: {{ include "headscale.fullname" . }}-cert
|
||||
items:
|
||||
- key: "tls.crt"
|
||||
path: "tls.crt"
|
||||
- key: "tls.key"
|
||||
path: "tls.key"
|
||||
{{- end }}
|
||||
- name: "data"
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ default .Values.persistence.existingClaim (include "headscale.fullname" .) }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
32
headscale/templates/hpa.yaml
Normal file
32
headscale/templates/hpa.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
66
headscale/templates/ingress.yaml
Normal file
66
headscale/templates/ingress.yaml
Normal file
|
@ -0,0 +1,66 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "headscale.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port.http -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- else if .Values.headscale.certmanager.enabled }}
|
||||
tls:
|
||||
- secretName: {{ include "headscale.fullname" . }}-cert
|
||||
hosts:
|
||||
{{- toYaml .Values.headscale.certmanager.dnsNames | nindent 8 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
name: http
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
122
headscale/templates/jobs.yaml
Normal file
122
headscale/templates/jobs.yaml
Normal file
|
@ -0,0 +1,122 @@
|
|||
{{ if and .Values.headscale.keys.create (not .Values.headscale.keys.existingSecret ) }}
|
||||
{{ $name := (print ( include "headscale.fullname" . ) "-keys") }}
|
||||
{{ $secretName := (print ( include "headscale.fullname" . ) "-keys") }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
name: {{ $name }}
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
app.kubernetes.io/component: keys-job
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
app.kubernetes.io/component: keys-job
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- {{ $secretName }}
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- patch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
app.kubernetes.io/component: keys-job
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ $name }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ $name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: "Never"
|
||||
serviceAccount: {{ $name }}
|
||||
containers:
|
||||
- name: upload-key
|
||||
image: bitnami/kubectl
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
# check if key already exists
|
||||
key=$(kubectl get secret {{ $secretName }} -o jsonpath="{.data['wireguard.key']}" 2> /dev/null)
|
||||
[ $? -ne 0 ] && echo "Failed to get existing secret" && exit 1
|
||||
[ -n "$key" ] && echo "Key already created, exiting." && exit 0
|
||||
# wait for wireguard key
|
||||
while [ ! -f /etc/headscale/secrets/wireguard.key ]; do
|
||||
echo "Waiting for wireguard key.."
|
||||
sleep 5;
|
||||
done
|
||||
# update secret
|
||||
kubectl patch secret {{ $secretName }} -p "{\"data\":{\"wireguard.key\":\"$(base64 /etc/headscale/secrets/wireguard.key | tr -d '\n')\"}}"
|
||||
kubectl patch secret {{ $secretName }} -p "{\"data\":{\"noise.key\":\"$(base64 /etc/headscale/secrets/noise.key | tr -d '\n')\"}}"
|
||||
[ $? -ne 0 ] && echo "Failed to update secret." && exit 1
|
||||
echo "Signing key successfully created."
|
||||
volumeMounts:
|
||||
- mountPath: /etc/headscale/secrets
|
||||
name: secrets
|
||||
readOnly: true
|
||||
- name: generate-key
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
/bin/headscale generate private-key | tail -1 | sed 's/privkey://' > /etc/headscale/secrets/wireguard.key
|
||||
chown 1001:1001 /etc/headscale/secrets/wireguard.key
|
||||
/bin/headscale generate private-key | tail -1 | sed 's/privkey://' > /etc/headscale/secrets/noise.key
|
||||
chown 1001:1001 /etc/headscale/secrets/noise.key
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/etc/headscale"
|
||||
readOnly: true
|
||||
- mountPath: "/etc/headscale/secrets"
|
||||
name: secrets
|
||||
volumes:
|
||||
- name: config
|
||||
secret:
|
||||
secretName: {{ include "headscale.fullname" . }}
|
||||
items:
|
||||
- key: "config.yaml"
|
||||
path: "config.yaml"
|
||||
- name: secrets
|
||||
emptyDir: {}
|
||||
parallelism: 1
|
||||
completions: 1
|
||||
backoffLimit: 1
|
||||
{{ end }}
|
50
headscale/templates/pvc.yaml
Normal file
50
headscale/templates/pvc.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- if and .Values.persistence.enabled ( not .Values.persistence.existingClaim) -}}
|
||||
---
|
||||
{{- if .Values.persistence.hostPath }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ template "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- if .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.persistence.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
storageClassName: manual
|
||||
capacity:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
hostPath:
|
||||
path: "{{ .Values.persistence.hostPath }}"
|
||||
---
|
||||
{{- end }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- if .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.persistence.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.hostPath }}
|
||||
volumeName: {{ template "headscale.fullname" . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
11
headscale/templates/secret.yaml
Normal file
11
headscale/templates/secret.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
annotations:
|
||||
config-hash: {{ toYaml .Values.headscale.config | sha256sum | trunc 32 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
config.yaml: |
|
||||
{{- toYaml .Values.headscale.config | nindent 4 }}
|
27
headscale/templates/service.yaml
Normal file
27
headscale/templates/service.yaml
Normal file
|
@ -0,0 +1,27 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port.http }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
- port: {{ .Values.service.port.metrics }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
- port: {{ .Values.service.port.grpc }}
|
||||
targetPort: grpc
|
||||
protocol: TCP
|
||||
name: grpc
|
||||
selector:
|
||||
{{- include "headscale.selectorLabels" . | nindent 4 }}
|
12
headscale/templates/serviceaccount.yaml
Normal file
12
headscale/templates/serviceaccount.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "headscale.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
21
headscale/templates/servicemonitor.yaml
Normal file
21
headscale/templates/servicemonitor.yaml
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{- if and .Values.prometheus.servicemonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "headscale.fullname" . }}
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
{{- with .Values.prometheus.servicemonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
{{- if .Values.headscale.certmanager.enabled }}
|
||||
scheme: https
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "headscale.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
15
headscale/templates/tests/test-connection.yaml
Normal file
15
headscale/templates/tests/test-connection.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "headscale.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "headscale.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "headscale.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
181
headscale/values.yaml
Normal file
181
headscale/values.yaml
Normal file
|
@ -0,0 +1,181 @@
|
|||
# Default values for headscale.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: headscale/headscale
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
headscale:
|
||||
keys:
|
||||
# -- Create a new private key, if not exists
|
||||
create: true
|
||||
# -- Use an existing secret
|
||||
existingSecret: ""
|
||||
|
||||
certmanager:
|
||||
enabled: true
|
||||
dnsNames:
|
||||
- example.com
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
kind: ClusterIssuer
|
||||
name: letsencrypt-prod
|
||||
config:
|
||||
listen_addr: ":8080"
|
||||
metrics_listen_addr: ":9090"
|
||||
grpc_listen_addr: ":50443"
|
||||
|
||||
server_url: http://127.0.0.1:8080
|
||||
|
||||
# SQLite config
|
||||
db_type: sqlite3
|
||||
|
||||
# For production:
|
||||
db_path: /var/lib/headscale/db.sqlite
|
||||
|
||||
# # Postgres config
|
||||
# If using a Unix socket to connect to Postgres, set the socket path in the 'host' field and leave 'port' blank.
|
||||
# db_type: postgres
|
||||
# db_host: localhost
|
||||
# db_port: 5432
|
||||
# db_name: headscale
|
||||
# db_user: foo
|
||||
# db_pass: bar
|
||||
private_key_path: "/etc/headscale/secrets/wireguard.key"
|
||||
noise:
|
||||
private_key_path: "/etc/headscale/secrets/noise.key"
|
||||
# # certs
|
||||
# use certmanager instatt of internal acme:
|
||||
## Use already defined certificates:
|
||||
tls_cert_path: "/etc/headscale/certs/tls.crt"
|
||||
tls_key_path: "/etc/headscale/certs/tls.key"
|
||||
|
||||
prometheus:
|
||||
servicemonitor:
|
||||
enabled: false
|
||||
labels: {}
|
||||
rules:
|
||||
enabled: false
|
||||
labels: {}
|
||||
# current no default alertrules are provided
|
||||
additionalRules: []
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
# Upload (/var/lib/headscale)
|
||||
enabled: false
|
||||
annotations: {}
|
||||
## mobilizon data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass: "-"
|
||||
|
||||
## A manually managed Persistent Volume and Claim
|
||||
## Requires persistence.enabled: true
|
||||
## If defined, PVC must be created manually before volume will be bound
|
||||
# existingClaim:
|
||||
|
||||
## Create a PV on Node with given hostPath
|
||||
## storageClass has to be manual
|
||||
# hostPath:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 1Gi
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: true
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
annotations:
|
||||
# for usage with certmanager (pod certs) and traefik
|
||||
# traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
# traefik.ingress.kubernetes.io/service.serverstransport: <namespace>-insecure@kubernetescrd
|
||||
# CRD:
|
||||
# apiVersion: traefik.io/v1alpha1
|
||||
# kind: ServersTransport
|
||||
# metadata:
|
||||
# name: insecure
|
||||
# spec:
|
||||
# insecureSkipVerify: true
|
||||
port:
|
||||
http: 8080
|
||||
metrics: 9090
|
||||
grpc: 50443
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
# for usage with certmanager (pod certs) and nginx
|
||||
# nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
|
||||
#
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
Loading…
Add table
Reference in a new issue