Skip to content

Commit 12fa370

Browse files
authored
Merge pull request #17 from HomeDevopsLab/secret-volumes
feat: mounting secrets as volumes
2 parents 0b19edc + 35e4e9a commit 12fa370

11 files changed

Lines changed: 85 additions & 249 deletions

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## [3.0.0] - 2025-12-30
4+
5+
### Added
6+
7+
- Ability to mount secrets as volumes. I'ts handy when you need to mount encrypted config file
8+
- Ability to mount configmap as volume just as the other type of volume.
9+
10+
11+
### Changed
12+
13+
- [BREAKING] volumes structure. Flag `enabled` was removed, along with `type` structure. Now volumes structure is flattened.
14+
- [BREAKING] kubernetes service name is no longer combined with application name (.Release.Name). HelmRelese configuration will be more straightforward.
15+
- [BREAKING] mountPath and subPath options are now child-nodes for volumes.nfs, volumes.configmap and volumes.secret
16+
- Ingress name is now the same as application name.
17+
18+
### Removed
19+
20+
- [BREAKING] database.enabled flag
21+
- Obsolete dbsecrets pre-install hook which was designed to generate databae credentials for application
22+
- Faulty initwebsitedir pre-install hook, which was designed to create application directory on persistent storage
23+
- Obsolete mattermos-notify post-hook. This hook was designed to send chat notification after application deployment
24+
- Obsolete MySQLDBHelper pre-install hook which was designed to create mysql database for an application
25+
326
## [2.7.0] - 2025-12-14
427

528
### Added

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 2.7.0
18+
version: 3.0.0
1919
# This is the version number of the application being deployed. This version number should be
2020
# incremented each time you make changes to the application. Versions are not expected to
2121
# follow Semantic Versioning. They should reflect the version the application is using.

chart/templates/dbsecrets.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

chart/templates/deployment.yaml

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ spec:
1515
labels:
1616
{{- include "basic.selectorLabels" . | nindent 8 }}
1717
spec:
18+
enableServiceLinks: false
1819
containers:
1920
- name: {{ .Release.Name }}
2021
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -36,27 +37,31 @@ spec:
3637
{{- toYaml . | nindent 12 }}
3738
{{- end }}
3839
{{- end }}
39-
{{- if .Values.volumes.enabled }}
4040
volumeMounts:
41-
{{- if .Values.configMap }}
42-
- name: {{ .Values.configMap.name }}
43-
mountPath: {{ .Values.configMap.mountPath }}
44-
{{- end }}
45-
{{- range .Values.volumes.mountPath }}
46-
{{- $dirmap := regexSplit ":" . -1 }}
47-
{{- $sub_path := slice $dirmap 0 1 | first }}
48-
{{- $mount := slice $dirmap 1 | last }}
49-
{{- if $.Values.volumes.type.pvc }}
50-
{{- $path := $mount }}
51-
- mountPath: {{ $mount | default "/var/www" }}
52-
name: {{ $.Release.Name }}-volume
53-
{{- else }}
41+
{{- if .Values.volumes.nfs }}
42+
{{- range .Values.volumes.nfs.mountPath }}
43+
{{- $dirmap := regexSplit ":" . -1 }}
44+
{{- $sub_path := slice $dirmap 0 1 | first }}
45+
{{- $mount := slice $dirmap 1 | last }}
5446
- mountPath: {{ $mount | default "/var/www" }}
5547
name: {{ $.Release.Name }}-volume
5648
subPath: {{ $sub_path }}
49+
{{- end }}
5750
{{- end }}
51+
{{- if .Values.volumes.secret }}
52+
- name: {{ .Values.volumes.secret.secretName }}
53+
mountPath: {{ .Values.volumes.secret.mountPath }}
54+
{{- if .Values.volumes.secret.subPath }}
55+
subPath: {{ .Values.volumes.secret.subPath }}
56+
{{- end}}
57+
{{- end }}
58+
{{- if .Values.volumes.configmap }}
59+
- name: {{ .Values.volumes.configmap.configMap }}
60+
mountPath: {{ .Values.volumes.configmap.mountPath }}
61+
{{- if .Values.volumes.configmap.subPath }}
62+
subPath: {{ .Values.volumes.configmap.subPath }}
63+
{{- end}}
5864
{{- end }}
59-
{{- end}}
6065
env:
6166
{{- with .Values.env }}
6267
{{- toYaml . | nindent 12 }}
@@ -102,31 +107,30 @@ spec:
102107
{{- with .Values.nodeSelector }}
103108
{{- toYaml . | nindent 8 }}
104109
{{- end }}
105-
{{- if .Values.volumes.enabled }}
106-
{{- if .Values.volumes.type.pvc }}
107-
{{- $ownership := regexSplit ":" .Values.volumes.ownership -1 }}
108-
{{- $gid := slice $ownership 0 1 | first }}
109-
securityContext:
110-
fsGroup: {{ $gid | default 0 }}
111-
{{- end}}
112110
volumes:
113-
{{- if .Values.configMap }}
114-
- name: {{ .Values.configMap.name }}
111+
{{- if .Values.volumes.configMap }}
112+
- name: {{ .Values.volumes.configMap.name }}
115113
configMap:
116-
name: {{ .Values.configMap.name }}
117-
{{- end }}
114+
name: {{ .Values.volumes.configMap.name }}
115+
{{- end }}
116+
{{- if .Values.volumes.nfs }}
118117
- name: {{ .Release.Name }}-volume
119-
{{- if .Values.volumes.type.nfs }}
120118
nfs:
121-
server: {{ .Values.volumes.type.nfs.server }}
122-
{{- if .Values.volumes.rootDir }}
123-
path: {{ .Values.volumes.type.nfs.path }}/{{ .Values.volumes.rootDir }}
124-
{{- else }}
125-
path: {{ .Values.volumes.type.nfs.path }}/{{ .Release.Name }}
126-
{{- end }}
119+
server: {{ .Values.volumes.nfs.server }}
120+
{{- if .Values.volumes.rootDir }}
121+
path: {{ .Values.volumes.nfs.path }}/{{ .Values.volumes.rootDir }}
122+
{{- else }}
123+
path: {{ .Values.volumes.nfs.path }}/{{ .Release.Name }}
124+
{{- end }}
127125
readOnly: false
128-
{{- else }}
129-
persistentVolumeClaim:
130-
claimName: {{ .Release.Name }}-pvc
131-
{{- end }}
132-
{{- end }}
126+
{{- end }}
127+
{{- if .Values.volumes.secret }}
128+
- name: {{ .Values.volumes.secret.secretName }}
129+
secret:
130+
secretName: {{ .Values.volumes.secret.secretName }}
131+
{{- end }}
132+
{{- if .Values.volumes.configmap }}
133+
- name: {{ .Values.volumes.configmap.configMap }}
134+
configMap:
135+
name: {{ .Values.volumes.configmap.configMap }}
136+
{{- end }}

chart/templates/ingress.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- range .Values.ingress.hosts }}
3-
{{- $subdomain := .name | splitList "." | first -}}
4-
{{- $ReleaseName := printf "%s-%s" $.Release.Name $subdomain -}}
53
---
64
apiVersion: networking.k8s.io/v1
75
kind: Ingress
86
metadata:
9-
name: {{ $ReleaseName }}
7+
name: {{ $.Release.Name}}
108
namespace: {{ $.Release.Namespace }}
119
{{- if $.Values.ingress.ssl }}
1210
annotations:
@@ -23,12 +21,12 @@ spec:
2321
pathType: Prefix
2422
backend:
2523
service:
26-
name: {{ $ReleaseName }}
24+
name: {{ $.Release.Name }}
2725
port:
2826
number: {{ .servicePort }}
2927
{{- if $.Values.ingress.ssl }}
3028
tls:
31-
- secretName: {{ $ReleaseName }}-tls
29+
- secretName: {{ $.Release.Name }}-tls
3230
hosts:
3331
- {{ .name }}
3432
{{- end }}

chart/templates/initWebsiteDir.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

chart/templates/mattermost-notify.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

chart/templates/mysqlDBhelper.yaml

Lines changed: 0 additions & 57 deletions
This file was deleted.

chart/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
apiVersion: v1
66
kind: Service
77
metadata:
8-
name: "{{ $.Release.Name }}-{{ .name }}"
8+
name: "{{ .name }}"
99
namespace: {{ $.Release.Namespace }}
1010
spec:
1111
type: {{ .type }}

0 commit comments

Comments
 (0)