Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
{{- $configMapName := printf "%s-config" (include "PolyNSI.fullname" .) }}
{{- $existingConfigMap := "" }}
{{- if .Values.config.checkExistence }}
{{- $existingConfigMap = lookup "v1" "ConfigMap" .Release.Namespace $configMapName }}
{{- end }}

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-config" (include "PolyNSI.fullname" .) }}
name: {{ $configMapName }}
# namespace: {{ .Release.Namespace }}
{{- if and .Values.config.checkExistence $existingConfigMap }}
# Preserve existing ConfigMap data
{{- if $existingConfigMap.data }}
data:
{{- range $key, $value := $existingConfigMap.data }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if $existingConfigMap.binaryData }}
binaryData:
{{- range $key, $value := $existingConfigMap.binaryData }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- else }}
# Create new ConfigMap data from values
{{- if .Values.config.filesGlob }}
binaryData:
{{- range $path, $_ := .Files.Glob .Values.config.filesGlob }}
{{ $path | base | indent 2 }}: |-
{{ $path | base }}: |-
{{ $.Files.Get $path | b64enc | indent 4 }}
{{ end }}
{{ else if .Values.config.inline }}
{{- end }}
{{- else if .Values.config.inline }}
data:
{{.Values.config.inline | indent 2}}
{{ end }}
{{ .Values.config.inline | indent 2 }}
{{- end }}
{{- end }}
28 changes: 22 additions & 6 deletions chart/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ spec:
mountPath: {{ .Values.persistence.mountPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
- name: config
mountPath: "/usr/local/etc/polynsi"
- name: combined-config
mountPath: /usr/local/etc/polynsi/
readOnly: true
{{- with .Values.nodeSelector }}
nodeSelector:
Expand All @@ -84,9 +84,25 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ printf "%s-config" (include "PolyNSI.fullname" .) }}
- name: combined-config
projected:
sources:
- configMap:
name: {{ printf "%s-config" (include "PolyNSI.fullname" .) }}
{{- if .Values.keystore.enabled }}
- secret:
name: {{ .Values.keystore.secretName }}
items:
- key: {{ .Values.keystore.key }}
path: polynsi-keystore.jks
{{- end }}
{{- if .Values.truststore.enabled }}
- secret:
name: {{ .Values.truststore.secretName }}
items:
- key: {{ .Values.truststore.key }}
path: polynsi-truststore.jks
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
Expand All @@ -105,4 +121,4 @@ spec:
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,18 @@ persistence:
- ReadWriteOnce
size: 1Gi

keystore:
enabled: false
secretName: polynsi-keystore
key: keystore.jks

truststore:
enabled: false
secretName: polynsi-truststore
key: truststore.jks

config:
checkExistence: false # Set to true to not overwrite existing configmap.
# either read config files from folder or use inline data, filesGlob takes precedence over inline.
#filesGlob: "config/*"
inline: |-
Expand Down