Skip to content

Commit 4358284

Browse files
authored
Convert proxy StatefulSet (#138)
1 parent 02ea328 commit 4358284

28 files changed

Lines changed: 525 additions & 218 deletions

.github/workflows/ami.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
echo "Proxy version: $PROXY_VERSION"
2626
echo "Gateway version: $GATEWAY_VERSION"
2727
- name: Checkout repository
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v6
2929

3030
- name: Setup `packer`
3131
uses: hashicorp/setup-packer@main

.github/workflows/build-ova.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ jobs:
4747
fi
4848
4949
- name: Setup Packer
50-
uses: hashicorp/setup-packer@v3.1.0
50+
uses: hashicorp/setup-packer@v3
5151
with:
5252
version: "1.11.2"
5353

5454
- name: Download ISO
5555
run: |
56-
curl -fL -o ubuntu-24.04.4-live-server-amd64.iso \
57-
https://releases.ubuntu.com/24.04.4/ubuntu-24.04.4-live-server-amd64.iso
56+
curl -fLO https://releases.ubuntu.com/24.04.4/ubuntu-24.04.4-live-server-amd64.iso
5857
5958
- name: Packer init
6059
run: packer init defguard.pkr.hcl

.github/workflows/lint_charts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
with:
2020
fetch-depth: 0
2121

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717

@@ -21,7 +21,7 @@ jobs:
2121
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2222
2323
- name: Install Helm
24-
uses: azure/setup-helm@v4
24+
uses: azure/setup-helm@v5
2525

2626
# https://github.com/helm/chart-releaser-action/issues/74
2727
- name: Add repositories
@@ -31,7 +31,7 @@ jobs:
3131
done
3232
3333
- name: Run chart-releaser
34-
uses: helm/chart-releaser-action@v1.6.0
34+
uses: helm/chart-releaser-action@v1.7.0
3535
env:
3636
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3737
with:

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: [self-hosted, Linux, X64]
1515
steps:
1616
- name: Login to GitHub container registry
17-
uses: docker/login-action@v2
17+
uses: docker/login-action@v4
1818
with:
1919
registry: ghcr.io
2020
username: ${{ github.actor }}

charts/defguard-gateway/Chart.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
apiVersion: v2
22
name: defguard-gateway
33
description: Defguard Gateway is a public-facing VPN endpoint.
4+
icon: https://defguard.net/favicon/favicon-512x512.png
45

56
type: application
6-
version: 0.5.4
7-
appVersion: 1.6.4
7+
version: 2.0.0-beta.1
8+
appVersion: 2.0.0-beta1

charts/defguard-gateway/templates/config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
labels:
66
{{- include "defguard-gateway.labels" . | nindent 4 }}
77
data:
8-
DEFGUARD_USERSPACE: {{ .Values.userspace | quote }}
9-
DEFGUARD_GRPC_URL: {{ .Values.grpcUrl | quote }}
10-
DEFGUARD_STATS_PERIOD: {{ .Values.statsPeriod | quote }}
8+
DEFGUARD_GRPC_PORT: {{ .Values.service.grpc.port | quote }}
119
DEFGUARD_LOG_LEVEL: {{ .Values.logLevel | quote }}
10+
DEFGUARD_STATS_PERIOD: {{ .Values.statsPeriod | quote }}
11+
DEFGUARD_USERSPACE: {{ .Values.userspace | quote }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
{{- include "defguard-gateway.labels" . | nindent 4 }}
6+
name: {{ include "defguard-gateway.fullname" . }}-grpc-headless
7+
spec:
8+
clusterIP: None
9+
ports:
10+
- name: grpc
11+
port: {{ .Values.service.grpc.port }}
12+
protocol: TCP
13+
targetPort: grpc
14+
selector:
15+
{{- include "defguard-gateway.selectorLabels" . | nindent 4 }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
{{- with .Values.service.grpc.annotations }}
6+
{{- toYaml . | nindent 4 }}
7+
{{- end }}
8+
name: {{ include "defguard-gateway.fullname" . }}-grpc
9+
labels:
10+
{{- include "defguard-gateway.labels" . | nindent 4 }}
11+
{{- with .Values.service.grpc.labels }}
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
type: {{ .Values.service.grpc.type }}
16+
ports:
17+
- port: {{ .Values.service.grpc.port }}
18+
targetPort: grpc
19+
protocol: TCP
20+
name: grpc
21+
selector:
22+
{{- include "defguard-gateway.selectorLabels" . | nindent 4 }}

charts/defguard-gateway/templates/deployment.yaml renamed to charts/defguard-gateway/templates/statefulset.yaml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
apiVersion: apps/v1
2-
kind: Deployment
2+
kind: StatefulSet
33
metadata:
44
name: {{ include "defguard-gateway.fullname" . }}
55
labels:
66
{{- include "defguard-gateway.labels" . | nindent 4 }}
77
spec:
8+
podManagementPolicy: Parallel
89
replicas: {{ .Values.replicaCount }}
910
selector:
1011
matchLabels:
1112
{{- include "defguard-gateway.selectorLabels" . | nindent 6 }}
13+
serviceName: {{ include "defguard-gateway.fullname" . }}-grpc-headless
1214
template:
1315
metadata:
1416
{{- with .Values.podAnnotations }}
@@ -27,18 +29,24 @@ spec:
2729
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2830
containers:
2931
- name: {{ .Chart.Name }}
32+
{{- if .Values.healthCheck.enabled }}
33+
env:
34+
- name: HEALTH_PORT
35+
value: {{ .Values.healthCheck.port }}
36+
{{- end }}
3037
envFrom:
3138
- configMapRef:
3239
name: {{ include "defguard-gateway.fullname" . }}-config
3340
{{- if .Values.additionalEnvFromConfigMap }}
3441
- configMapRef:
3542
name: {{ .Values.additionalEnvFromConfigMap }}
3643
{{- end }}
37-
securityContext:
38-
{{- toYaml .Values.securityContext | nindent 12 }}
3944
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4045
imagePullPolicy: {{ .Values.image.pullPolicy }}
4146
ports:
47+
- name: grpc
48+
containerPort: {{ .Values.service.grpc.port }}
49+
protocol: TCP
4250
- name: wireguard
4351
containerPort: {{ .Values.service.wireguard.port }}
4452
protocol: UDP
@@ -62,23 +70,11 @@ spec:
6270
timeoutSeconds: {{ .Values.healthCheck.readinessProbe.timeoutSeconds }}
6371
failureThreshold: {{ .Values.healthCheck.readinessProbe.failureThreshold }}
6472
{{- end }}
65-
{{- if .Values.token }}
66-
env:
67-
- name: DEFGUARD_TOKEN
68-
value: {{ .Values.token }}
69-
{{- else if .Values.existingTokenSecret }}
70-
env:
71-
- name: DEFGUARD_TOKEN
72-
valueFrom:
73-
secretKeyRef:
74-
name: {{ .Values.existingTokenSecret }}
75-
key: {{ .Values.existingTokenSecretKey }}
76-
{{- end }}
77-
{{- if .Values.healthCheck.enabled }}
78-
env:
79-
- name: HEALTH_PORT
80-
value: {{ .Values.healthCheck.port }}
81-
{{- end }}
73+
securityContext:
74+
{{- toYaml .Values.securityContext | nindent 12 }}
75+
volumeMounts:
76+
- name: data
77+
mountPath: /etc/defguard
8278
{{- with .Values.nodeSelector }}
8379
nodeSelector:
8480
{{- toYaml . | nindent 8 }}
@@ -91,3 +87,15 @@ spec:
9187
tolerations:
9288
{{- toYaml . | nindent 8 }}
9389
{{- end }}
90+
volumeClaimTemplates:
91+
- metadata:
92+
name: data
93+
spec:
94+
accessModes:
95+
- ReadWriteOnce
96+
{{- with .Values.persistence.storageClassName }}
97+
storageClassName: {{ . }}
98+
{{- end }}
99+
resources:
100+
requests:
101+
storage: {{ .Values.persistence.size }}

0 commit comments

Comments
 (0)