Skip to content

Commit 37117c2

Browse files
committed
Create helm chart
1 parent 041a603 commit 37117c2

14 files changed

Lines changed: 621 additions & 0 deletions

helm-charts/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm-charts/Chart.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v2
2+
appVersion: "1.1.10-3"
3+
name: rustdesk-server
4+
description: A Rustdesk Helm chart for Kubernetes
5+
type: application
6+
icon: https://raw.githubusercontent.com/rustdesk/rustdesk-server/master/ui/icons/icon.png
7+
version: 0.1.0

helm-charts/templates/NOTES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The RustDesk has been deployed to your cluster.
2+
3+
See https://rustdesk.com/docs/en/ for more detail.

helm-charts/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "rustdesk-server.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "rustdesk-server.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "rustdesk-server.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "rustdesk-server.labels" -}}
37+
helm.sh/chart: {{ include "rustdesk-server.chart" . }}
38+
{{ include "rustdesk-server.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "rustdesk-server.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "rustdesk-server.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "rustdesk-server.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "rustdesk-server.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "rustdesk-server.fullname" . }}-hbbr
5+
labels:
6+
{{- include "rustdesk-server.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: hbbr
8+
{{- with .Values.hbbr.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
replicas: {{ .Values.replicaCount }}
14+
selector:
15+
matchLabels:
16+
{{- include "rustdesk-server.selectorLabels" . | nindent 6 }}
17+
app.kubernetes.io/component: hbbr
18+
template:
19+
metadata:
20+
{{- with .Values.podAnnotations }}
21+
annotations:
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
labels:
25+
{{- include "rustdesk-server.labels" . | nindent 8 }}
26+
app.kubernetes.io/component: hbbr
27+
{{- with .Values.podLabels }}
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
spec:
31+
{{- with .Values.imagePullSecrets }}
32+
imagePullSecrets:
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
35+
serviceAccountName: {{ include "rustdesk-server.serviceAccountName" . }}
36+
securityContext:
37+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
38+
containers:
39+
- name: {{ .Chart.Name }}-hbbr
40+
securityContext:
41+
{{- toYaml .Values.securityContext | nindent 12 }}
42+
image: "{{ .Values.hbbr.image.repository }}:{{ .Values.hbbr.image.tag | default .Chart.AppVersion }}"
43+
imagePullPolicy: {{ .Values.hbbr.image.pullPolicy }}
44+
command: [ "/usr/bin/hbbr" ]
45+
args:
46+
{{- with .Values.hbbr.extraArgs }}
47+
{{- toYaml . | nindent 12 }}
48+
{{- else}}
49+
- "-k"
50+
- "_"
51+
{{- end }}
52+
ports:
53+
- name: hbbr-port
54+
containerPort: 21117
55+
protocol: TCP
56+
- name: hbbr-websocket
57+
containerPort: 21119
58+
protocol: TCP
59+
resources:
60+
{{- toYaml .Values.resources | nindent 12 }}
61+
volumeMounts:
62+
- mountPath: /root
63+
readOnly: true
64+
name: hbbr-keys
65+
{{- if .Values.extraVolumeMounts }}
66+
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
67+
{{- end }}
68+
volumes:
69+
- name: hbbr-keys
70+
secret:
71+
{{- if .Values.hbbr.secret.existingSecret }}
72+
secretName: {{ .Values.hbbr.secret.existingSecret }}
73+
{{- else }}
74+
secretName: {{ include "rustdesk-server.fullname" . }}-hbbr
75+
{{- end }}
76+
{{- if .Values.extraVolumes }}
77+
{{ toYaml .Values.extraVolumes | nindent 8 }}
78+
{{- end }}
79+
{{- with .Values.nodeSelector }}
80+
nodeSelector:
81+
{{- toYaml . | nindent 8 }}
82+
{{- end }}
83+
{{- with .Values.affinity }}
84+
affinity:
85+
{{- toYaml . | nindent 8 }}
86+
{{- end }}
87+
{{- with .Values.tolerations }}
88+
tolerations:
89+
{{- toYaml . | nindent 8 }}
90+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if not .Values.hbbr.secret.existingSecret -}}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
labels:
6+
{{- include "rustdesk-server.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: hbbr
8+
{{- with .Values.hbbr.secret.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
name: {{ include "rustdesk-server.fullname" . }}-hbbr
12+
{{- with .Values.hbbr.secret.annotations }}
13+
annotations:
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
type: Opaque
17+
data:
18+
id_ed25519: {{ .Values.hbbr.secret.private | b64enc | quote }}
19+
id_ed25519.pub: {{ .Values.hbbr.secret.public | b64enc | quote }}
20+
{{- end -}}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "rustdesk-server.fullname" . }}-hbbr
5+
labels:
6+
{{- include "rustdesk-server.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: hbbr
8+
{{- with .Values.hbbr.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
type: {{ .Values.service.type }}
14+
{{- if .Values.service.clusterIP }}
15+
clusterIP: {{ .Values.service.clusterIP }}
16+
{{- end }}
17+
{{- if .Values.service.externalIPs }}
18+
externalIPs: {{ toYaml .Values.service.externalIPs | nindent 4 }}
19+
{{- end }}
20+
{{- if .Values.service.loadBalancerIP }}
21+
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
22+
{{- end }}
23+
{{- if .Values.service.loadBalancerSourceRanges }}
24+
loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
25+
{{- end }}
26+
{{- if .Values.service.loadBalancerClass }}
27+
loadBalancerClass: {{ .Values.service.loadBalancerClass }}
28+
{{- end }}
29+
{{- if hasKey .Values.service "allocateLoadBalancerNodePorts" }}
30+
allocateLoadBalancerNodePorts: {{ .Values.service.allocateLoadBalancerNodePorts }}
31+
{{- end }}
32+
{{- if .Values.service.externalTrafficPolicy }}
33+
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
34+
{{- end }}
35+
ports:
36+
- port: {{ .Values.service.hbbrPort }}
37+
targetPort: hbbr-port
38+
protocol: TCP
39+
name: hbbr-port
40+
- port: {{ .Values.service.hbbrWebsocket }}
41+
targetPort: hbbr-websocket
42+
protocol: TCP
43+
name: hbbr-websocket
44+
selector:
45+
{{- include "rustdesk-server.selectorLabels" . | nindent 4 }}
46+
app.kubernetes.io/component: hbbr
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if .Values.hbbs.relay -}}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
labels:
6+
{{- include "rustdesk-server.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: hbbr
8+
{{- with .Values.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
name: {{ include "rustdesk-server.fullname" . }}-hbbs
12+
{{- with .Values.annotations }}
13+
annotations:
14+
{{ toYaml . | indent 4 }}
15+
{{- end }}
16+
data:
17+
RELAY: {{ .Values.hbbs.relay }}
18+
{{- end -}}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "rustdesk-server.fullname" . }}-hbbs
5+
labels:
6+
{{- include "rustdesk-server.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: hbbs
8+
{{- with .Values.hbbs.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
replicas: 1
14+
selector:
15+
matchLabels:
16+
{{- include "rustdesk-server.selectorLabels" . | nindent 6 }}
17+
app.kubernetes.io/component: hbbs
18+
template:
19+
metadata:
20+
{{- with .Values.podAnnotations }}
21+
annotations:
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
labels:
25+
{{- include "rustdesk-server.labels" . | nindent 8 }}
26+
app.kubernetes.io/component: hbbs
27+
{{- with .Values.podLabels }}
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
spec:
31+
{{- with .Values.imagePullSecrets }}
32+
imagePullSecrets:
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
35+
serviceAccountName: {{ include "rustdesk-server.serviceAccountName" . }}
36+
securityContext:
37+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
38+
containers:
39+
- name: {{ .Chart.Name }}-hbbs
40+
securityContext:
41+
{{- toYaml .Values.securityContext | nindent 12 }}
42+
image: "{{ .Values.hbbs.image.repository }}:{{ .Values.hbbs.image.tag | default .Chart.AppVersion }}"
43+
imagePullPolicy: {{ .Values.hbbs.image.pullPolicy }}
44+
command: [ "/usr/bin/hbbs" ]
45+
args:
46+
{{- with .Values.hbbs.extraArgs }}
47+
{{- toYaml . | nindent 12 }}
48+
{{- else}}
49+
- "-r"
50+
- "$(RELAY)"
51+
- "-k"
52+
- "_"
53+
{{- end }}
54+
{{- if .Values.hbbs.relay }}
55+
env:
56+
- name: DB_URL
57+
value: "/db/db_v2.sqlite3"
58+
envFrom:
59+
- configMapRef:
60+
name: {{ include "rustdesk-server.fullname" . }}-hbbs
61+
{{- end }}
62+
ports:
63+
- name: hbbs-nat-test
64+
containerPort: 21115
65+
protocol: TCP
66+
- name: hbbs-port
67+
containerPort: 21116
68+
protocol: TCP
69+
- name: hbbs-port-udp
70+
containerPort: 21116
71+
protocol: UDP
72+
- name: hbbs-websocket
73+
containerPort: 21118
74+
protocol: TCP
75+
resources:
76+
{{- toYaml .Values.resources | nindent 12 }}
77+
volumeMounts:
78+
- mountPath: /root
79+
readOnly: true
80+
name: hbbr-keys
81+
- mountPath: /db
82+
name: hbbs-db
83+
{{- if .Values.extraVolumeMounts }}
84+
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
85+
{{- end }}
86+
volumes:
87+
- name: hbbr-keys
88+
secret:
89+
{{- if .Values.hbbr.secret.existingSecret }}
90+
secretName: {{ .Values.hbbr.secret.existingSecret }}
91+
{{- else }}
92+
secretName: {{ include "rustdesk-server.fullname" . }}-hbbr
93+
{{- end }}
94+
- name: hbbs-db
95+
persistentVolumeClaim:
96+
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "rustdesk-server.fullname" . }}-hbbs-pvc{{- end }}
97+
{{- if .Values.extraVolumes }}
98+
{{ toYaml .Values.extraVolumes | nindent 8 }}
99+
{{- end }}
100+
{{- with .Values.nodeSelector }}
101+
nodeSelector:
102+
{{- toYaml . | nindent 8 }}
103+
{{- end }}
104+
{{- with .Values.affinity }}
105+
affinity:
106+
{{- toYaml . | nindent 8 }}
107+
{{- end }}
108+
{{- with .Values.tolerations }}
109+
tolerations:
110+
{{- toYaml . | nindent 8 }}
111+
{{- end }}

0 commit comments

Comments
 (0)