Own and promote the coturn Helm chart
Publish and promote Helm chart / chart (push) Failing after 18s

This commit is contained in:
feedc0de committed 2026-10-18 17:33:22 +02:00
1 parent 705327ac24
commit ef4175a8d2
6 files changed
+223

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
name: Publish and promote Helm chart
on:
push:
pull_request:
jobs:
chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: azure/setup-helm@v4
- name: Lint and render
run: |
helm lint chart --set externalIP=192.0.2.1
helm template coturn chart --set externalIP=192.0.2.1 >/dev/null
- name: Publish
if: gitea.ref == 'refs/heads/main'
run: |
version=$(./scripts/chart-version.sh)
echo "CHART_VERSION=${version}" >> "${GITHUB_ENV}"
mkdir -p dist
helm package chart --destination dist --version "${version}"
curl --fail-with-body --user "${{ secrets.PACKAGE_USERNAME }}:${{ secrets.PACKAGE_TOKEN }}" \
--upload-file "dist/coturn-${version}.tgz" \
https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
- name: Check out GitOps
if: gitea.ref == 'refs/heads/main'
uses: actions/checkout@v4
with:
repository: feedc0de/homelab-gitops
ref: main
token: ${{ secrets.GITOPS_TOKEN }}
path: homelab-gitops
- name: Promote
if: gitea.ref == 'refs/heads/main'
working-directory: homelab-gitops
run: |
./scripts/update-chart-version.sh coturn "${CHART_VERSION}"
git config user.name feedc0de
git config user.email feedc0de@users.noreply.code.brunner.ninja
git add bootstrap/coturn.yaml
if git diff --cached --quiet; then exit 0; fi
git commit -m "Deploy coturn chart ${CHART_VERSION}"
git push origin HEAD:main
+6
View File
@@ -0,0 +1,6 @@
apiVersion: v2
name: coturn
description: TURN/STUN relay with TCP, UDP, TLS, and configurable relay ports
type: application
version: 0.1.0
appVersion: 4.10.0-r1
+48
View File
@@ -0,0 +1,48 @@
{{- range $protocol := list "tcp" "udp" }}
{{- $protocolAnnotations := ternary $.Values.service.tcpAnnotations $.Values.service.udpAnnotations (eq $protocol "tcp") }}
{{- $annotations := merge (dict) $.Values.service.commonAnnotations $protocolAnnotations }}
apiVersion: v1
kind: Service
metadata:
name: coturn-{{ $protocol }}
labels:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: LoadBalancer
{{- with $.Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
externalTrafficPolicy: Local
selector:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
ports:
- {name: "{{ $protocol }}", port: 3478, targetPort: "{{ $protocol }}", protocol: "{{ upper $protocol }}"}
- {name: "{{ $protocol }}-tls", port: 5349, targetPort: "{{ $protocol }}-tls", protocol: "{{ upper $protocol }}"}
---
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: coturn-relay
{{- $relayAnnotations := merge (dict) .Values.service.commonAnnotations .Values.service.relayAnnotations }}
{{- with $relayAnnotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: LoadBalancer
{{- with .Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
externalTrafficPolicy: Local
selector:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
ports:
{{- range $port := untilStep (int .Values.relay.minPort) (int (add1 .Values.relay.maxPort)) 1 }}
- {name: "relay-{{ $port }}", port: {{ $port }}, targetPort: {{ $port }}, protocol: UDP}
{{- end }}
+92
View File
@@ -0,0 +1,92 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: coturn
labels: &labels
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
automountServiceAccountToken: false
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coturn
labels:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
spec:
replicas: 1
strategy: {type: Recreate}
selector:
matchLabels:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
template:
metadata:
labels:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
spec:
serviceAccountName: coturn
automountServiceAccountToken: false
containers:
- name: coturn
image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --listening-port=3478
- --tls-listening-port=5349
- --fingerprint
- --cert=/etc/ssl/certs/cert.pem
- --pkey=/etc/ssl/private/privkey.pem
- --realm={{ .Values.realm }}
- --log-file=stdout
- --no-software-attribute
- --no-cli
- --use-auth-secret
- --static-auth-secret=$(TURN_SHARED_SECRET)
- --external-ip={{ required "externalIP is required" .Values.externalIP }}
- --min-port={{ .Values.relay.minPort }}
- --max-port={{ .Values.relay.maxPort }}
- --no-multicast-peers
env:
- name: TURN_SHARED_SECRET
valueFrom:
secretKeyRef: {name: "{{ .Values.sharedSecret.name }}", key: "{{ .Values.sharedSecret.key }}"}
ports:
- {name: tcp, containerPort: 3478, protocol: TCP}
- {name: udp, containerPort: 3478, protocol: UDP}
- {name: tcp-tls, containerPort: 5349, protocol: TCP}
- {name: udp-tls, containerPort: 5349, protocol: UDP}
readinessProbe: {tcpSocket: {port: tcp}}
livenessProbe: {tcpSocket: {port: tcp}, initialDelaySeconds: 30}
resources: {{- toYaml .Values.resources | nindent 10 }}
securityContext:
allowPrivilegeEscalation: false
capabilities: {add: [NET_BIND_SERVICE], drop: [ALL]}
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
volumeMounts:
- {name: certs, mountPath: /etc/ssl/certs, readOnly: true}
- {name: private, mountPath: /etc/ssl/private, readOnly: true}
volumes:
- name: certs
secret:
secretName: {{ .Values.certificate.secretName }}
items: [{key: tls.crt, path: cert.pem}]
- name: private
secret:
secretName: {{ .Values.certificate.secretName }}
items: [{key: tls.key, path: privkey.pem}]
{{- if .Values.certificate.enabled }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata: {name: coturn}
spec:
secretName: {{ .Values.certificate.secretName }}
dnsNames: [{{ .Values.certificate.dnsName | quote }}]
issuerRef: {group: cert-manager.io, kind: ClusterIssuer, name: "{{ .Values.certificate.issuerName }}"}
usages: [digital signature, key encipherment]
{{- end }}
+26
View File
@@ -0,0 +1,26 @@
image:
repository: coturn/coturn
tag: ""
pullPolicy: IfNotPresent
realm: example.com
externalIP: ""
relay:
minPort: 49160
maxPort: 49200
sharedSecret:
name: turn-shared-secret
key: shared-secret
service:
loadBalancerIP: ""
commonAnnotations: {}
tcpAnnotations: {}
udpAnnotations: {}
relayAnnotations: {}
certificate:
enabled: false
secretName: coturn
dnsName: turn.example.com
issuerName: letsencrypt
resources:
requests: {cpu: 100m, memory: 50Mi}
limits: {cpu: 100m, memory: 50Mi}
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
description=$(git describe --tags --long --match 'v[0-9]*' --dirty)
case "$description" in *-dirty) echo "refusing dirty tree" >&2; exit 1;; esac
version=${description#v}
case "$version" in *-0-g*) version=${version%%-0-g*};; esac
printf '%s\n' "$version"