Skip to content

Commit b131d94

Browse files
authored
fix(helm): URL-encode MongoDB passwords, support existingSecret/fullnameOverride (#49)
- Split auth URI into two paths: urlquery at template time when rootPassword is set (safe for @, :, /, %), $(VAR) expansion from secretKeyRef when auto-generated - Respect mongodb.fullnameOverride for service name resolution - Respect mongodb.auth.existingSecret for secret name resolution - Move helmfile example from secrets: to values: (removes helm-secrets plugin dependency) - Add renovate comment for auto-bumping chart version in examples - Bump chart to 0.3.4
1 parent ebc661d commit b131d94

7 files changed

Lines changed: 39 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Helm Chart [0.3.4] - 2026-03-31
6+
7+
### Fixed
8+
- **Fix: URL-encode MongoDB passwords with special characters** — when `rootPassword` is set in values, the password is now percent-encoded at template time via `urlquery`, so characters like `@`, `:`, `/`, `%` no longer break the connection URI. Auto-generated passwords (empty `rootPassword`) continue to use runtime `$(VAR)` expansion (Bitnami generates alphanumeric passwords)
9+
- **Fix: Respect `mongodb.fullnameOverride` and `mongodb.auth.existingSecret`** — the chart now resolves the correct MongoDB service name and secret name when users override the subchart's default naming
10+
- **Fix: Remove undeclared `helm-secrets` plugin dependency from examples** — `genieacs-secrets.yaml` moved from Helmfile `secrets:` to `values:` so examples work without plugins
11+
512
## Helm Chart [0.3.3] - 2026-03-31
613

714
### Fixed

‎charts/genieacs/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: genieacs
33
description: A Helm chart for GenieACS - an open-source implementation of TR-069 ACS
44
type: application
5-
version: 0.3.3
5+
version: 0.3.4
66
appVersion: "1.2.16.0"
77
keywords:
88
- genieacs

‎charts/genieacs/templates/_helpers.tpl‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,27 @@ app.kubernetes.io/instance: {{ .Release.Name }}
5252

5353
{{/*
5454
Create the MongoDB subchart service name.
55+
Respects mongodb.fullnameOverride when set.
5556
*/}}
5657
{{- define "genieacs.mongodb.fullname" -}}
58+
{{- if .Values.mongodb.fullnameOverride -}}
59+
{{- .Values.mongodb.fullnameOverride | trunc 63 | trimSuffix "-" -}}
60+
{{- else -}}
5761
{{- printf "%s-%s" .Release.Name "mongodb" | trunc 63 | trimSuffix "-" -}}
5862
{{- end -}}
63+
{{- end -}}
64+
65+
{{/*
66+
Resolve the MongoDB secret name.
67+
Uses mongodb.auth.existingSecret when set, otherwise the subchart's auto-generated secret.
68+
*/}}
69+
{{- define "genieacs.mongodb.secretName" -}}
70+
{{- if .Values.mongodb.auth.existingSecret -}}
71+
{{- .Values.mongodb.auth.existingSecret -}}
72+
{{- else -}}
73+
{{- include "genieacs.mongodb.fullname" . -}}
74+
{{- end -}}
75+
{{- end -}}
5976

6077
{{/*
6178
Create the name of the service account to use

‎charts/genieacs/templates/deployment.yaml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,18 @@ spec:
3737
value: "{{ $value }}"
3838
{{- end }}
3939
{{- if and .Values.mongodb.enabled .Values.mongodb.auth.enabled }}
40+
{{- if .Values.mongodb.auth.rootPassword }}
41+
- name: GENIEACS_MONGODB_CONNECTION_URL
42+
value: "mongodb://root:{{ .Values.mongodb.auth.rootPassword | urlquery }}@{{ include "genieacs.mongodb.fullname" . }}:27017/genieacs?authSource=admin"
43+
{{- else }}
4044
- name: MONGODB_ROOT_PASSWORD
4145
valueFrom:
4246
secretKeyRef:
43-
name: {{ include "genieacs.mongodb.fullname" . }}
47+
name: {{ include "genieacs.mongodb.secretName" . }}
4448
key: mongodb-root-password
4549
- name: GENIEACS_MONGODB_CONNECTION_URL
4650
value: "mongodb://root:$(MONGODB_ROOT_PASSWORD)@{{ include "genieacs.mongodb.fullname" . }}:27017/genieacs?authSource=admin"
51+
{{- end }}
4752
{{- else if .Values.mongodb.enabled }}
4853
- name: GENIEACS_MONGODB_CONNECTION_URL
4954
value: "mongodb://{{ include "genieacs.mongodb.fullname" . }}:27017/genieacs"

‎charts/genieacs/values.yaml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ mongodb:
6363
enabled: true
6464
auth:
6565
enabled: false
66-
# When auth.enabled is true, the chart auto-constructs an authenticated
67-
# MongoDB URI using the root password from the Bitnami subchart secret.
68-
# Set rootPassword here or let the subchart auto-generate one:
66+
# When auth.enabled is true, the chart auto-constructs an authenticated URI.
67+
# If rootPassword is set here, the password is URL-encoded at template time
68+
# (safe for special characters like @, :, /, %). If left empty, the subchart
69+
# auto-generates an alphanumeric password resolved at runtime via secretKeyRef.
6970
# rootPassword: ""
71+
# existingSecret: "" # Use a pre-existing secret instead of the subchart's
7072
persistence:
7173
enabled: true
7274
size: 8Gi

‎examples/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ The `helmfile.yaml` demonstrates how to deploy GenieACS on Kubernetes using [Hel
1818
|------|-------------|
1919
| `helmfile.yaml` | Main Helmfile configuration (chart repo + release) |
2020
| `genieacs.yaml` | GenieACS chart values (MongoDB auth enabled) |
21-
| `genieacs-secrets.yaml` | Secrets (MongoDB root password) — do NOT commit real values |
21+
| `genieacs-secrets.yaml` | MongoDB root password — do NOT commit real values (use [helm-secrets](https://github.com/jkroepke/helm-secrets) for encryption in production) |
2222

2323
### Usage
2424

2525
1. Review and customize the configuration files.
2626

27-
2. Set your MongoDB root password in `genieacs-secrets.yaml` (or use [helm-secrets](https://github.com/jkroepke/helm-secrets) for encryption).
27+
2. Set your MongoDB root password in `genieacs-secrets.yaml`.
2828

2929
3. Deploy:
3030

‎examples/helmfile.yaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ releases:
77
namespace: genieacs
88
chart: genieacs/genieacs
99
# renovate: registryUrl=https://geiserx.github.io/genieacs-docker
10-
version: 0.3.3
10+
version: 0.3.4
1111
labels:
1212
app: genieacs
1313
values:
1414
- genieacs.yaml
15-
secrets:
1615
- genieacs-secrets.yaml

0 commit comments

Comments
 (0)