Skip to content

Commit

Permalink
Added-custom-mount-point (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolagospagopa authored Jul 14, 2024
1 parent ab07512 commit f3b7155
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,14 @@ All the files are created inside the path: `/mnt/file-config-external/<config-ma
configMaps:
- name: <config map name>
key: <config map key>
mountPath: <complete mount path with file name> #(Optional)
externalConfigMapFiles:
create: true
configMaps:
- name: external-configmap-files
key: game.properties
mountPath: "/config/game.properties"
- name: external-configmap-files
key: user-interface.xml
```
Expand Down
9 changes: 7 additions & 2 deletions charts/microservice-chart/templates/deployments.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.deployment.create -}}
{{- $root := . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -154,15 +155,19 @@ spec:
{{- if .Values.configMapFromFile }}
{{- range $key, $val := .Values.configMapFromFile }}
- name: file-config
mountPath: "/mnt/file-config/{{ $key }}"
mountPath: "{{ $root.Values.configMapFromFileCustomPath }}/{{ $key }}"
subPath: {{ $key }}
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.externalConfigMapFiles.create }}
{{- range $i, $v := .Values.externalConfigMapFiles.configMaps }}
- name: {{ $v.name }}-{{ $i }}
mountPath: "/mnt/file-config-external/{{ $v.name }}/{{ $v.key }}"
{{- if $v.mountPath }}
mountPath: "{{ $v.mountPath }}"
{{- else }}
mountPath: "{{ $root.Values.externalConfigMapFilesCustomPath}}/{{ $v.name }}/{{ $v.key }}"
{{- end }}
subPath: {{ $v.key }}
readOnly: true
{{- end }}
Expand Down
13 changes: 9 additions & 4 deletions charts/microservice-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ envConfig: {}
# -- Load secrets as environment variables from kv
envSecret: {}

# -- Configure files to mount as config maps
# -- Configure files to mount as config map. This files definition are inside the values*.yaml file
configMapFromFile: {}
# -- CustomPath to allow to choose where to put your files
configMapFromFileCustomPath: "/mnt/file-config"

# -- Environment config from k8s metadata
envFieldRef: {}
Expand All @@ -161,8 +163,11 @@ envFieldRef: {}
# @default -- {}
externalConfigMapFiles:
create: false
# -- (list) Config maps to mount as files: e.g. [{name: "configmap", key: "user.xml"}]
# -- (list) Config maps to mount as files: e.g. [{name: "configmap", key: "user.xml", mountPath: "/config/user.xml" }]
configMaps: []
# -- CustomPath to allow to choose where to put your files
externalConfigMapFilesCustomPath: "/mnt/file-config-external"


externalConfigMapValues:
# -- (list) Config maps to mount as files: e.g. [{name: "configmap", key: "mykey"}]
Expand All @@ -172,7 +177,7 @@ externalConfigMapValues:
# Volumes
#

# -- Configure mounted volumes with secrets needed to mount them
# -- Configure how secrets taken from SecretS storage Class are mounted inside the pod
# @default -- {}
providedVolumeMount:
create: false
Expand All @@ -187,7 +192,7 @@ tmpVolumeMount:
- name: tmp
mountPath: /tmp

# -- Configure optional volume that mount using a PVC
# -- Configure optional volume that will be mount (using a PVC)
persistentVolumeClaimsMounts:
create: false
# -- (list) Mounts with pvc volume: (e.g. [{name: "tmp", mountPath: "/tmp", pvcName: "xyz"}]])
Expand Down
6 changes: 3 additions & 3 deletions tests/v5-java-helm-complete-test-foo/helm/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: microservice-chart
repository: file://../../../charts/microservice-chart
version: 5.9.1
digest: sha256:16387a60e66fc6d5437dbd006ca32f917f50cbf9f8e16d8afd3a9790e7caddc4
generated: "2024-06-12T22:55:34.585351+02:00"
version: 5.10.0
digest: sha256:48165ac976c5c7969df1ed0101896cd9c84e8fe2cbd0614f3ce2a8ed8dc7647b
generated: "2024-07-13T22:56:31.538446+02:00"
2 changes: 1 addition & 1 deletion tests/v5-java-helm-complete-test-foo/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ version: 1.0.0
appVersion: 1.0.0
dependencies:
- name: microservice-chart
version: 5.9.1
version: 5.10.0
repository: file://../../../charts/microservice-chart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ microservice-chart:
configMaps:
- name: v5-complete-foo-configmap-files
key: game.properties
mountPath: "/config/game.properties"
- name: v5-complete-foo-configmap-files
key: user-interface.xml

Expand Down

0 comments on commit f3b7155

Please sign in to comment.