From ba7a39622aea472a06773b70df3fdfdef80ebd81 Mon Sep 17 00:00:00 2001 From: rohow Date: Mon, 24 Jun 2024 18:11:41 +0800 Subject: [PATCH] feat(images): submit images --- charts/tailscale-derp/Chart.yaml | 13 +++++++ charts/tailscale-derp/README.md | 38 +++++++++++++++++++ .../tailscale-derp/templates/deployment.yml | 31 +++++++++++++++ charts/tailscale-derp/templates/service.yml | 21 ++++++++++ charts/tailscale-derp/values.yaml | 12 ++++++ 5 files changed, 115 insertions(+) create mode 100644 charts/tailscale-derp/Chart.yaml create mode 100644 charts/tailscale-derp/README.md create mode 100644 charts/tailscale-derp/templates/deployment.yml create mode 100644 charts/tailscale-derp/templates/service.yml create mode 100644 charts/tailscale-derp/values.yaml diff --git a/charts/tailscale-derp/Chart.yaml b/charts/tailscale-derp/Chart.yaml new file mode 100644 index 0000000..24b19f8 --- /dev/null +++ b/charts/tailscale-derp/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: tailscale-derp +description: Tailscale DERP Relay Server Helm Chart +home: https://devcm-repo.github.io/helm-charts/ +sources: + - https://github.com/devcm-repo/helm-charts +maintainers: + - name: dev.cm + email: admin@dev.cm + url: https://github.com/devcm-repo +icon: https://tailscale.com/files/apple-touch-icon.png +version: 0.0.1 +appVersion: 1.44.0 diff --git a/charts/tailscale-derp/README.md b/charts/tailscale-derp/README.md new file mode 100644 index 0000000..80cc16f --- /dev/null +++ b/charts/tailscale-derp/README.md @@ -0,0 +1,38 @@ +# tailscale-derp Helm Chart + +This Helm Chart is a Tailscale container deployment for a tailnet relay server (DERP). + +## Installing the Helm Chart + +```shell +helm repo add tailscale https://spreitzer.ch/helm-tailscale +helm install tailscale-derp tailscale/tailscale-derp +``` + +## Helm Chart Configuration Examples + +A working configuration: + +```yaml +service: + annotations: + service.beta.kubernetes.io/azure-dns-label-name: my-derp-01 + +hostname: my-derp-01.switzerlandnorth.cloudapp.azure.com + +nodeSelector: + topology.kubernetes.io/region: switzerlandnorth + topology.kubernetes.io/zone: switzerlandnorth-1 +``` + +## Helm Chart Values + +| Key | Description | Default | +|---|---|---| +| `image.name` | Name of the container image to use. | `docker.io/sspreitzer/tailscale-derp` | +| `image.pullPolicy` | Kubernetes pullPolicy to use for starting the container image. | `IfNotPresent` | +| `service.type` | Kubernetes Service type. | `LoadBalancer` | +| `service.annotations` | A map/dict of Kubernetes Service annotations. | `{}` | +| `hostname` | DERP hostname to use. Must be the same as of the derpMap in the tailnet ACL. | `derp.example.com` | +| `nodeSelector` | A map/dict of Kubernetes Pod nodeSelector node labels. | `{}` | +| `affinity` | A map/dict of Kubernetes Pod affinity rules. | `{}` | diff --git a/charts/tailscale-derp/templates/deployment.yml b/charts/tailscale-derp/templates/deployment.yml new file mode 100644 index 0000000..ef9ebc2 --- /dev/null +++ b/charts/tailscale-derp/templates/deployment.yml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{ .Release.Name }}-{{ .Chart.Name }}" +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: "{{ .Release.Name }}-{{ .Chart.Name }}" + template: + metadata: + labels: + app: "{{ .Release.Name }}-{{ .Chart.Name }}" + spec: + {{- if not (empty .Values.nodeSelector) }} + nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }} + {{- end }} + {{- if not (empty .Values.affinity) }} + affinity: {{- toYaml .Values.affinity | nindent 8 }} + {{- end }} + containers: + - name: "{{ .Release.Name }}-{{ .Chart.Name }}" + image: "{{ .Values.image.name }}:v{{ .Chart.AppVersion }}" + ports: + - containerPort: 80 + - containerPort: 443 + - containerPort: 3478 + args: + - "--hostname={{ .Values.hostname }}" diff --git a/charts/tailscale-derp/templates/service.yml b/charts/tailscale-derp/templates/service.yml new file mode 100644 index 0000000..2149444 --- /dev/null +++ b/charts/tailscale-derp/templates/service.yml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: "{{ .Release.Name }}-{{ .Chart.Name }}" + {{- if not (empty .Values.service.annotations) }} + annotations: {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: "{{ .Values.service.type }}" + selector: + app: "{{ .Release.Name }}-{{ .Chart.Name }}" + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + - name: stun + port: 3478 + targetPort: 3478 diff --git a/charts/tailscale-derp/values.yaml b/charts/tailscale-derp/values.yaml new file mode 100644 index 0000000..26bd982 --- /dev/null +++ b/charts/tailscale-derp/values.yaml @@ -0,0 +1,12 @@ +image: + name: docker.io/sspreitzer/tailscale-derp + pullPolicy: IfNotPresent + +service: + type: LoadBalancer + annotations: {} + +hostname: 'derp.example.com' + +nodeSelector: {} +affinity: {}