Skip to content

Commit 14f12ff

Browse files
authored
Merge pull request #802 from Haferbeck-IT/main
feat(helm): Added features/fixes to helm chart
2 parents 414c71e + 78ce448 commit 14f12ff

19 files changed

Lines changed: 261 additions & 64 deletions

helm/CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Changelog
2+
3+
## 0.2.0
4+
5+
### Breaking Changes
6+
7+
- **`readOnlyRootFilesystem` now enabled** for server, frontend, and garmin containers. Writable paths (`/tmp`, nginx cache/run dirs) are mounted as `emptyDir`. If you mount custom writable paths, add corresponding `emptyDir` volumes.
8+
- **Image tags default to `appVersion`** instead of `latest`. Set `server.image.tag` / `frontend.image.tag` / `garmin.image.tag` explicitly to override. @davmacario
9+
- **Server uses `Recreate` strategy** instead of `RollingUpdate` — required because the server PVCs are `ReadWriteOnce`.
10+
11+
### Features
12+
13+
- **Configurable health probes**`livenessProbe` and `readinessProbe` for all four components (server, frontend, garmin, postgresql) are now defined in `values.yaml` and fully overridable.
14+
- **`extraEnv` / `extraEnvFrom`** added to all deployments (server, frontend, garmin) for injecting custom environment variables or referencing external ConfigMaps/Secrets.
15+
- **Configurable mount paths**`server.persistence.backup.mountPath`, `uploads.mountPath`, and `tempUploads.mountPath` are now exposed in values.
16+
- **Per-PVC `storageClass`**`server.persistence.backup.storageClass` and `uploads.storageClass` can override `global.storageClass`.
17+
- **`nameOverride` / `fullnameOverride`** support added.
18+
- **PostgreSQL `podSecurityContext` / `containerSecurityContext`** moved from hardcoded template to `values.yaml` (consistent with all other components).
19+
- **Configurable ESO API version**`externalSecrets.apiVersion` (default `v1`) allows using `v1beta1` for ESO < 0.10.0.
20+
21+
### Bug Fixes
22+
23+
- **OIDC/SMTP secrets validated**`required` function ensures `clientId`/`clientSecret` (OIDC) and `username`/`password` (SMTP) are set when the chart creates these secrets, preventing empty secret data.
24+
- **OIDC configmap validated**`providerSlug`, `providerName`, and `issuerUrl` are now `required` when `config.oidc.enabled=true`.
25+
- **Frontend `readOnlyRootFilesystem`** — nginx writable directories (`/var/cache/nginx`, `/var/run`, `/etc/nginx/conf.d`, `/tmp`) mounted as `emptyDir`.
26+
- **Garmin `readOnlyRootFilesystem`**`/tmp` mounted as `emptyDir`.
27+
- **Server `/tmp`** mounted as `emptyDir` for `readOnlyRootFilesystem` support.
28+
- **Database secret helper deduplicated**`sparkyfitness.databaseSecretName` and `sparkyfitness.createDatabaseSecret` refactored to remove redundant branching between bundled/external PostgreSQL.
29+
30+
### Chores
31+
32+
- Chart `appVersion` pinned to `v0.16.4.7` (was `latest`).
33+
34+
## 0.1.0
35+
36+
- Initial release.

helm/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Sparkyfitness Helm Chart
22

3-
4-
> [!WARNING]
3+
> [!NOTE]
54
> **Community Contribution:** This Helm chart and Kubernetes support are community-provided. The Sparkyfitness maintainers do not currently use Kubernetes and cannot provide full review or official support for this installation method.
65
76
A Helm chart for deploying [Sparkyfitness](https://github.com/CodeWithCJ/SparkyFitness) on Kubernetes.

helm/chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: sparkyfitness
33
description: Sparkyfitness fitness tracking application
44
type: application
5-
version: 0.1.0
6-
appVersion: "latest"
5+
version: 0.2.0
6+
appVersion: "v0.16.4.7"

helm/chart/templates/_helpers.tpl

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
4040

4141
{{/*
4242
Build a container image string with optional global.imageRegistry prefix.
43-
Usage: {{ include "sparkyfitness.image" (dict "image" .Values.server.image "global" .Values.global) }}
43+
Usage: {{ include "sparkyfitness.image" (dict "image" .Values.server.image "global" .Values.global "appVersion" .Chart.AppVersion) }}
4444
*/}}
4545
{{- define "sparkyfitness.image" -}}
4646
{{- $registry := .global.imageRegistry | default "" -}}
4747
{{- $repo := .image.repository -}}
48-
{{- $tag := .image.tag | default "latest" -}}
48+
{{- $tag := .image.tag | default .appVersion -}}
4949
{{- if $registry -}}
5050
{{- printf "%s/%s:%s" $registry $repo $tag -}}
5151
{{- else -}}
@@ -143,20 +143,17 @@ App database secret name (limited-privilege user): existingSecret > chart-manage
143143

144144
{{/*
145145
Database credentials secret name.
146+
Resolves: postgresql.auth or externalDatabase.auth → existingSecret > chart-managed.
146147
*/}}
147148
{{- define "sparkyfitness.databaseSecretName" -}}
149+
{{- $dbAuth := .Values.externalDatabase.auth -}}
148150
{{- if .Values.postgresql.enabled -}}
149-
{{- if .Values.postgresql.auth.existingSecret -}}
150-
{{- .Values.postgresql.auth.existingSecret -}}
151-
{{- else -}}
152-
{{- include "sparkyfitness.fullname" . }}-postgres
153-
{{- end -}}
151+
{{- $dbAuth = .Values.postgresql.auth -}}
152+
{{- end -}}
153+
{{- if $dbAuth.existingSecret -}}
154+
{{- $dbAuth.existingSecret -}}
154155
{{- else -}}
155-
{{- if .Values.externalDatabase.auth.existingSecret -}}
156-
{{- .Values.externalDatabase.auth.existingSecret -}}
157-
{{- else -}}
158-
{{- include "sparkyfitness.fullname" . }}-postgres
159-
{{- end -}}
156+
{{- include "sparkyfitness.fullname" . }}-postgres
160157
{{- end -}}
161158
{{- end }}
162159

@@ -208,18 +205,12 @@ true
208205
Whether the chart should create the database credentials secret.
209206
*/}}
210207
{{- define "sparkyfitness.createDatabaseSecret" -}}
208+
{{- $dbAuth := .Values.externalDatabase.auth -}}
211209
{{- if .Values.postgresql.enabled -}}
212-
{{- if not .Values.postgresql.auth.existingSecret -}}
213-
{{- if not (and .Values.externalSecrets.enabled .Values.externalSecrets.postgres.enabled) -}}
214-
true
215-
{{- end -}}
216-
{{- end -}}
217-
{{- else -}}
218-
{{- if not .Values.externalDatabase.auth.existingSecret -}}
219-
{{- if not (and .Values.externalSecrets.enabled .Values.externalSecrets.postgres.enabled) -}}
210+
{{- $dbAuth = .Values.postgresql.auth -}}
211+
{{- end -}}
212+
{{- if and (not $dbAuth.existingSecret) (not (and .Values.externalSecrets.enabled .Values.externalSecrets.postgres.enabled)) -}}
220213
true
221-
{{- end -}}
222-
{{- end -}}
223214
{{- end -}}
224215
{{- end }}
225216

@@ -244,6 +235,7 @@ http://{{ $host }}
244235
{{- else if .Values.config.frontendUrl -}}
245236
{{- .Values.config.frontendUrl -}}
246237
{{- else -}}
238+
{{- /* 3004 is the SparkyFitness server's default development port */ -}}
247239
http://localhost:3004
248240
{{- end -}}
249241
{{- end }}

helm/chart/templates/frontend/deployment.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,35 @@ spec:
2727
{{- end }}
2828
containers:
2929
- name: frontend
30-
image: {{ include "sparkyfitness.image" (dict "image" .Values.frontend.image "global" .Values.global) }}
30+
image: {{ include "sparkyfitness.image" (dict "image" .Values.frontend.image "global" .Values.global "appVersion" .Chart.AppVersion) }}
3131
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
3232
ports:
3333
- name: http
3434
containerPort: {{ .Values.frontend.port }}
3535
protocol: TCP
36+
{{- with .Values.frontend.livenessProbe }}
37+
livenessProbe:
38+
{{- toYaml . | nindent 12 }}
39+
{{- end }}
40+
{{- with .Values.frontend.readinessProbe }}
41+
readinessProbe:
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
44+
{{- with .Values.frontend.extraEnvFrom }}
45+
envFrom:
46+
{{- toYaml . | nindent 12 }}
47+
{{- end }}
3648
env:
3749
- name: SPARKY_FITNESS_FRONTEND_URL
3850
value: {{ include "sparkyfitness.frontendUrl" . | quote }}
3951
- name: SPARKY_FITNESS_SERVER_HOST
4052
value: {{ include "sparkyfitness.fullname" . }}-server
4153
- name: SPARKY_FITNESS_SERVER_PORT
4254
value: {{ .Values.server.port | quote }}
55+
{{- range $k, $v := .Values.frontend.extraEnv }}
56+
- name: {{ $k }}
57+
value: {{ $v | quote }}
58+
{{- end }}
4359
{{- with .Values.frontend.containerSecurityContext }}
4460
securityContext:
4561
{{- toYaml . | nindent 12 }}
@@ -48,3 +64,21 @@ spec:
4864
resources:
4965
{{- toYaml . | nindent 12 }}
5066
{{- end }}
67+
volumeMounts:
68+
- name: tmp
69+
mountPath: /tmp
70+
- name: nginx-cache
71+
mountPath: /var/cache/nginx
72+
- name: nginx-run
73+
mountPath: /var/run
74+
- name: nginx-conf
75+
mountPath: /etc/nginx/conf.d
76+
volumes:
77+
- name: tmp
78+
emptyDir: {}
79+
- name: nginx-cache
80+
emptyDir: {}
81+
- name: nginx-run
82+
emptyDir: {}
83+
- name: nginx-conf
84+
emptyDir: {}

helm/chart/templates/garmin/deployment.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,35 @@ spec:
2828
{{- end }}
2929
containers:
3030
- name: garmin
31-
image: {{ include "sparkyfitness.image" (dict "image" .Values.garmin.image "global" .Values.global) }}
31+
image: {{ include "sparkyfitness.image" (dict "image" .Values.garmin.image "global" .Values.global "appVersion" .Chart.AppVersion) }}
3232
imagePullPolicy: {{ .Values.garmin.image.pullPolicy }}
3333
ports:
3434
- name: http
3535
containerPort: {{ .Values.garmin.port }}
3636
protocol: TCP
37+
{{- with .Values.garmin.livenessProbe }}
38+
livenessProbe:
39+
{{- toYaml . | nindent 12 }}
40+
{{- end }}
41+
{{- with .Values.garmin.readinessProbe }}
42+
readinessProbe:
43+
{{- toYaml . | nindent 12 }}
44+
{{- end }}
45+
{{- with .Values.garmin.extraEnvFrom }}
46+
envFrom:
47+
{{- toYaml . | nindent 12 }}
48+
{{- end }}
3749
env:
3850
- name: GARMIN_MICROSERVICE_URL
3951
value: "http://{{ include "sparkyfitness.fullname" . }}-garmin:{{ .Values.garmin.port }}"
4052
- name: GARMIN_SERVICE_PORT
4153
value: {{ .Values.garmin.port | quote }}
4254
- name: GARMIN_SERVICE_IS_CN
4355
value: {{ .Values.config.garmin.isChinaRegion | quote }}
56+
{{- range $k, $v := .Values.garmin.extraEnv }}
57+
- name: {{ $k }}
58+
value: {{ $v | quote }}
59+
{{- end }}
4460
{{- with .Values.garmin.containerSecurityContext }}
4561
securityContext:
4662
{{- toYaml . | nindent 12 }}
@@ -49,4 +65,10 @@ spec:
4965
resources:
5066
{{- toYaml . | nindent 12 }}
5167
{{- end }}
68+
volumeMounts:
69+
- name: tmp
70+
mountPath: /tmp
71+
volumes:
72+
- name: tmp
73+
emptyDir: {}
5274
{{- end }}

helm/chart/templates/secrets/externalsecret-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.app.enabled }}
2-
apiVersion: external-secrets.io/v1
2+
apiVersion: external-secrets.io/{{ .Values.externalSecrets.apiVersion }}
33
kind: ExternalSecret
44
metadata:
55
name: {{ include "sparkyfitness.fullname" . }}-app

helm/chart/templates/secrets/externalsecret-appdb.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.appdb.enabled }}
2-
apiVersion: external-secrets.io/v1
2+
apiVersion: external-secrets.io/{{ .Values.externalSecrets.apiVersion }}
33
kind: ExternalSecret
44
metadata:
55
name: {{ include "sparkyfitness.fullname" . }}-appdb

helm/chart/templates/secrets/externalsecret-oidc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.oidc.enabled }}
2-
apiVersion: external-secrets.io/v1
2+
apiVersion: external-secrets.io/{{ .Values.externalSecrets.apiVersion }}
33
kind: ExternalSecret
44
metadata:
55
name: {{ include "sparkyfitness.fullname" . }}-oidc

helm/chart/templates/secrets/externalsecret-postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.postgres.enabled }}
2-
apiVersion: external-secrets.io/v1
2+
apiVersion: external-secrets.io/{{ .Values.externalSecrets.apiVersion }}
33
kind: ExternalSecret
44
metadata:
55
name: {{ include "sparkyfitness.fullname" . }}-postgres

0 commit comments

Comments
 (0)