2023-12-01 18:55:27 +00:00
|
|
|
{{- $fullName := include "wg-access-server.fullname" . -}}
|
2023-12-04 15:40:08 +00:00
|
|
|
{{ $secretName := $fullName }}
|
|
|
|
{{- if .Values.config.existingSecret -}}
|
|
|
|
{{ $secretName = .Values.config.existingSecret }}
|
|
|
|
{{ end -}}
|
2023-12-01 18:55:27 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: {{ include "wg-access-server.fullname" . }}
|
|
|
|
labels:
|
|
|
|
{{- include "wg-access-server.labels" . | nindent 4 }}
|
|
|
|
spec:
|
|
|
|
replicas: {{ .Values.replicas }}
|
|
|
|
strategy:
|
|
|
|
{{- if .Values.persistence.enabled }}
|
|
|
|
type: {{ .Values.strategy.type | default "Recreate" | quote }}
|
|
|
|
{{- else }}
|
|
|
|
type: {{ .Values.strategy.type | default "RollingUpdate" | quote }}
|
|
|
|
{{- end }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
{{- include "wg-access-server.selectorLabels" . | nindent 6 }}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
annotations:
|
|
|
|
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
|
|
labels:
|
|
|
|
{{- include "wg-access-server.selectorLabels" . | nindent 8 }}
|
|
|
|
spec:
|
|
|
|
{{- with .Values.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
containers:
|
|
|
|
- name: {{ .Chart.Name }}
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add: ['NET_ADMIN']
|
|
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
containerPort: 8000
|
|
|
|
protocol: TCP
|
|
|
|
- name: wireguard
|
|
|
|
containerPort: 51820
|
|
|
|
protocol: UDP
|
|
|
|
env:
|
|
|
|
{{- if .Values.wireguard.config.privateKey }}
|
|
|
|
- name: WG_WIREGUARD_PRIVATE_KEY
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2023-12-04 15:40:08 +00:00
|
|
|
name: "{{ $secretName }}"
|
2023-12-01 18:55:27 +00:00
|
|
|
key: privateKey
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.web.config.adminUsername }}
|
|
|
|
- name: WG_ADMIN_USERNAME
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2023-12-04 15:40:08 +00:00
|
|
|
name: "{{ $secretName }}"
|
2023-12-01 18:55:27 +00:00
|
|
|
key: adminUsername
|
|
|
|
{{- end}}
|
|
|
|
{{- if .Values.web.config.adminPassword }}
|
|
|
|
- name: WG_ADMIN_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2023-12-04 15:40:08 +00:00
|
|
|
name: "{{ $secretName }}"
|
2023-12-01 18:55:27 +00:00
|
|
|
key: adminPassword
|
|
|
|
{{- end}}
|
2023-12-04 17:05:31 +00:00
|
|
|
{{- if .Values.config.csiSecretsStore }}
|
|
|
|
- name: WG_CONFIG
|
2023-12-04 17:14:18 +00:00
|
|
|
value: /secrets/config.yaml
|
2023-12-04 17:05:31 +00:00
|
|
|
{{- end}}
|
2023-12-01 18:55:27 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: tun
|
|
|
|
mountPath: /dev/net/tun
|
|
|
|
- name: data
|
|
|
|
mountPath: /data
|
2023-12-04 15:40:08 +00:00
|
|
|
{{- if .Values.config.csiSecretsStore }}
|
|
|
|
- name: config
|
2023-12-04 17:05:31 +00:00
|
|
|
mountPath: /secrets
|
2023-12-04 15:40:08 +00:00
|
|
|
{{- else }}
|
2023-12-01 18:55:27 +00:00
|
|
|
- name: config
|
|
|
|
mountPath: /config.yaml
|
|
|
|
subPath: config.yaml
|
2023-12-04 15:40:08 +00:00
|
|
|
{{- end}}
|
2023-12-01 18:55:27 +00:00
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
2023-12-04 17:26:33 +00:00
|
|
|
path: /health
|
2023-12-01 18:55:27 +00:00
|
|
|
port: http
|
|
|
|
resources:
|
|
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
|
|
volumes:
|
|
|
|
- name: tun
|
|
|
|
hostPath:
|
|
|
|
type: 'CharDevice'
|
|
|
|
path: /dev/net/tun
|
|
|
|
- name: data
|
|
|
|
{{- if .Values.persistence.enabled }}
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ $fullName }}{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if not .Values.persistence.enabled }}
|
|
|
|
emptyDir: {}
|
|
|
|
{{- end }}
|
2023-12-04 15:40:08 +00:00
|
|
|
{{- if .Values.config.csiSecretsStore }}
|
|
|
|
- name: config
|
|
|
|
csi:
|
|
|
|
driver: secrets-store.csi.k8s.io
|
|
|
|
readOnly: true
|
|
|
|
volumeAttributes:
|
|
|
|
secretProviderClass: app-secrets
|
|
|
|
{{- else }}
|
2023-12-01 18:55:27 +00:00
|
|
|
- name: config
|
|
|
|
configMap:
|
|
|
|
name: "{{ $fullName }}"
|
2023-12-04 15:40:08 +00:00
|
|
|
{{- end }}
|
2023-12-01 18:55:27 +00:00
|
|
|
{{- with .Values.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.tolerations }}
|
|
|
|
tolerations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|