Skip to content

Commit

Permalink
Add additional ConfigMaps to Helm Charts (#635)
Browse files Browse the repository at this point in the history
* Add additional configmaps feature

* Fix tests

* Trailing lines

* Fix typo

* Fix grammar

---------

Co-authored-by: Yevhen Ivantsov <[email protected]>
  • Loading branch information
bianchi2 and Yevhen Ivantsov authored Aug 7, 2023
1 parent 47f4771 commit d0cb30f
Show file tree
Hide file tree
Showing 21 changed files with 377 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/charts/bamboo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Kubernetes: `>=1.21.x-0`

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalConfigMaps | list | `[]` | Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix for a ConfigMap name, fileName is used as subPath |
| additionalContainers | list | `[]` | Additional container definitions that will be added to all Bamboo pods |
| additionalFiles | list | `[]` | Additional existing ConfigMaps and Secrets not managed by Helm that should be mounted into service container. Configuration details below (camelCase is important!): 'name' - References existing ConfigMap or secret name. 'type' - 'configMap' or 'secret' 'key' - The file name. 'mountPath' - The destination directory in a container. VolumeMount and Volumes are added with this name and index position, for example; custom-config-0, keystore-2 |
| additionalInitContainers | list | `[]` | Additional initContainer definitions that will be added to all Bamboo pods |
Expand Down
16 changes: 16 additions & 0 deletions src/main/charts/bamboo/templates/configmap-additional-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $i, $key := .Values.additionalConfigMaps -}}
{{- with $ }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-{{ $key.name }}
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
data:
{{- range $key.keys }}
{{ .fileName -}}: |
{{ .content | trim | indent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions src/main/charts/bamboo/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ spec:
metadata:
annotations:
checksum/config-jvm: {{ include (print $.Template.BasePath "/config-jvm.yaml") . | sha256sum }}
{{- if .Values.additionalConfigMaps }}
checksum/config-additional: {{ include (print $.Template.BasePath "/configmap-additional-config.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.fluentd.enabled }}
checksum/config-fluentd: {{ include (print $.Template.BasePath "/configmap-fluentd.yaml") . | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -208,6 +211,13 @@ spec:
mountPath: {{ .mountPath }}/{{ .key }}
subPath: {{ .key }}
{{ end }}
{{- range $i, $n := .Values.additionalConfigMaps }}
{{- range .keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
mountPath: {{ .mountPath }}/{{ .fileName }}
subPath: {{ .fileName }}
{{ end }}
{{- end }}
lifecycle:
preStop:
exec:
Expand Down Expand Up @@ -245,6 +255,18 @@ spec:
- key: {{ .key }}
path: {{ .key }}
{{ end }}
{{- range $i, $key := .Values.additionalConfigMaps }}
{{- with $ }}
{{- range $key.keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
configMap:
name: {{ include "common.names.fullname" $ }}-{{ $key.name }}
items:
- key: {{ .fileName }}
path: {{ .fileName }}
{{- end }}
{{ end }}
{{- end }}
{{ include "bamboo.volumes" . | nindent 8 }}
{{ include "fluentd.config.volume" . | nindent 8 }}
{{ include "common.jmx.config.volume" . | nindent 8 }}
Expand Down
17 changes: 17 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1039,3 +1039,20 @@ additionalFiles: []
# type: secret
# key: keystore.jks
# mountPath: /var/ssl

# -- Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix
# for a ConfigMap name, fileName is used as subPath
#
additionalConfigMaps: []
# - name: extra-configmap
# keys:
# - fileName: hello.properties
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# foo=bar
# hello=world
# - fileName: hello.xml
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# <xml>
# </xml>
1 change: 1 addition & 0 deletions src/main/charts/bitbucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Kubernetes: `>=1.21.x-0`

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalConfigMaps | list | `[]` | Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix for a ConfigMap name, fileName is used as subPath |
| additionalContainers | list | `[]` | Additional container definitions that will be added to all Bitbucket pods |
| additionalFiles | list | `[]` | Additional existing ConfigMaps and Secrets not managed by Helm that should be mounted into service container. Configuration details below (camelCase is important!): 'name' - References existing ConfigMap or secret name. 'type' - 'configMap' or 'secret' 'key' - The file name. 'mountPath' - The destination directory in a container. VolumeMount and Volumes are added with this name and index position, for example; custom-config-0, keystore-2 |
| additionalHosts | list | `[]` | Additional host aliases for each pod, equivalent to adding them to the /etc/hosts file. https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $i, $key := .Values.additionalConfigMaps -}}
{{- with $ }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-{{ $key.name }}
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
data:
{{- range $key.keys }}
{{ .fileName -}}: |
{{ .content | trim | indent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions src/main/charts/bitbucket/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
metadata:
annotations:
checksum/config-jvm: {{ include (print $.Template.BasePath "/config-jvm.yaml") . | sha256sum }}
{{- if .Values.additionalConfigMaps }}
checksum/config-additional: {{ include (print $.Template.BasePath "/configmap-additional-config.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.fluentd.enabled }}
checksum/config-fluentd: {{ include (print $.Template.BasePath "/configmap-fluentd.yaml") . | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -134,6 +137,13 @@ spec:
mountPath: {{ .mountPath }}/{{ .key }}
subPath: {{ .key }}
{{ end }}
{{- range $i, $n := .Values.additionalConfigMaps }}
{{- range .keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
mountPath: {{ .mountPath }}/{{ .fileName }}
subPath: {{ .fileName }}
{{ end }}
{{- end }}
{{- with .Values.bitbucket.resources.container }}
resources:
{{- toYaml . | nindent 12 }}
Expand Down Expand Up @@ -253,6 +263,18 @@ spec:
- key: {{ .key }}
path: {{ .key }}
{{ end }}
{{- range $i, $key := .Values.additionalConfigMaps }}
{{- with $ }}
{{- range $key.keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
configMap:
name: {{ include "common.names.fullname" $ }}-{{ $key.name }}
items:
- key: {{ .fileName }}
path: {{ .fileName }}
{{- end }}
{{ end }}
{{- end }}
{{ include "bitbucket.volumes" . | nindent 8 }}
{{ include "fluentd.config.volume" . | nindent 8 }}
{{ include "common.jmx.config.volume" . | nindent 8 }}
Expand Down
17 changes: 17 additions & 0 deletions src/main/charts/bitbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1328,3 +1328,20 @@ additionalHosts: []
# hostnames:
# - "foo.local"
# - "bar.local"

# -- Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix
# for a ConfigMap name, fileName is used as subPath
#
additionalConfigMaps: []
# - name: extra-configmap
# keys:
# - fileName: hello.properties
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# foo=bar
# hello=world
# - fileName: hello.xml
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# <xml>
# </xml>
1 change: 1 addition & 0 deletions src/main/charts/confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Kubernetes: `>=1.21.x-0`

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalConfigMaps | list | `[]` | Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix for a ConfigMap name, fileName is used as subPath |
| additionalContainers | list | `[]` | Additional container definitions that will be added to all Confluence pods |
| additionalFiles | list | `[]` | Additional existing ConfigMaps and Secrets not managed by Helm that should be mounted into service container. Configuration details below (camelCase is important!): 'name' - References existing ConfigMap or secret name. 'type' - 'configMap' or 'secret' 'key' - The file name. 'mountPath' - The destination directory in a container. VolumeMount and Volumes are added with this name and index position, for example; custom-config-0, keystore-2 |
| additionalHosts | list | `[]` | Additional host aliases for each pod, equivalent to adding them to the /etc/hosts file. https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $i, $key := .Values.additionalConfigMaps -}}
{{- with $ }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-{{ $key.name }}
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
data:
{{- range $key.keys }}
{{ .fileName -}}: |
{{ .content | trim | indent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions src/main/charts/confluence/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ spec:
metadata:
annotations:
checksum/config-jvm: {{ include (print $.Template.BasePath "/config-jvm.yaml") . | sha256sum }}
{{- if .Values.additionalConfigMaps }}
checksum/config-additional: {{ include (print $.Template.BasePath "/configmap-additional-config.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.fluentd.enabled }}
checksum/config-fluentd: {{ include (print $.Template.BasePath "/configmap-fluentd.yaml") . | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -119,6 +122,13 @@ spec:
mountPath: {{ .mountPath }}/{{ .key }}
subPath: {{ .key }}
{{ end }}
{{- range $i, $n := .Values.additionalConfigMaps }}
{{- range .keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
mountPath: {{ .mountPath }}/{{ .fileName }}
subPath: {{ .fileName }}
{{ end }}
{{- end }}
env:
{{ if .Values.ingress.https }}
- name: ATL_TOMCAT_SCHEME
Expand Down Expand Up @@ -213,6 +223,18 @@ spec:
- key: {{ .key }}
path: {{ .key }}
{{ end }}
{{- range $i, $key := .Values.additionalConfigMaps }}
{{- with $ }}
{{- range $key.keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
configMap:
name: {{ include "common.names.fullname" $ }}-{{ $key.name }}
items:
- key: {{ .fileName }}
path: {{ .fileName }}
{{- end }}
{{ end }}
{{- end }}
{{ include "confluence.volumes" . | nindent 8 }}
{{ include "fluentd.config.volume" . | nindent 8 }}
{{ include "common.jmx.config.volume" . | nindent 8 }}
Expand Down
17 changes: 17 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1340,3 +1340,20 @@ additionalHosts: []
# hostnames:
# - "foo.local"
# - "bar.local"

# -- Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix
# for a ConfigMap name, fileName is used as subPath
#
additionalConfigMaps: []
# - name: extra-configmap
# keys:
# - fileName: hello.properties
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# foo=bar
# hello=world
# - fileName: hello.xml
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# <xml>
# </xml>
1 change: 1 addition & 0 deletions src/main/charts/crowd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Kubernetes: `>=1.21.x-0`

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalConfigMaps | list | `[]` | Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix for a ConfigMap name, fileName is used as subPath |
| additionalContainers | list | `[]` | Additional container definitions that will be added to all Crowd pods |
| additionalFiles | list | `[]` | Additional existing ConfigMaps and Secrets not managed by Helm that should be mounted into service container. Configuration details below (camelCase is important!): 'name' - References existing ConfigMap or secret name. 'type' - 'configMap' or 'secret' 'key' - The file name. 'mountPath' - The destination directory in a container. VolumeMount and Volumes are added with this name and index position, for example; custom-config-0, keystore-2 |
| additionalHosts | list | `[]` | Additional host aliases for each pod, equivalent to adding them to the /etc/hosts file. https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ |
Expand Down
16 changes: 16 additions & 0 deletions src/main/charts/crowd/templates/configmap-additional-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $i, $key := .Values.additionalConfigMaps -}}
{{- with $ }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-{{ $key.name }}
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
data:
{{- range $key.keys }}
{{ .fileName -}}: |
{{ .content | trim | indent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions src/main/charts/crowd/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ spec:
metadata:
annotations:
checksum/config-jvm: {{ include (print $.Template.BasePath "/config-jvm.yaml") . | sha256sum }}
{{- if .Values.additionalConfigMaps }}
checksum/config-additional: {{ include (print $.Template.BasePath "/configmap-additional-config.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.fluentd.enabled }}
checksum/config-fluentd: {{ include (print $.Template.BasePath "/configmap-fluentd.yaml") . | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -116,6 +119,13 @@ spec:
mountPath: {{ .mountPath }}/{{ .key }}
subPath: {{ .key }}
{{ end }}
{{- range $i, $n := .Values.additionalConfigMaps }}
{{- range .keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
mountPath: {{ .mountPath }}/{{ .fileName }}
subPath: {{ .fileName }}
{{ end }}
{{- end }}
env:
- name: KUBE_POD_NAME
valueFrom:
Expand Down Expand Up @@ -196,6 +206,18 @@ spec:
- key: {{ .key }}
path: {{ .key }}
{{ end }}
{{- range $i, $key := .Values.additionalConfigMaps }}
{{- with $ }}
{{- range $key.keys }}
- name: {{ .fileName | replace "_" "-" | replace "." "-" }}
configMap:
name: {{ include "common.names.fullname" $ }}-{{ $key.name }}
items:
- key: {{ .fileName }}
path: {{ .fileName }}
{{- end }}
{{ end }}
{{- end }}
{{ include "crowd.volumes" . | nindent 8 }}
{{ include "fluentd.config.volume" . | nindent 8 }}
{{ include "common.jmx.config.volume" . | nindent 8 }}
Expand Down
17 changes: 17 additions & 0 deletions src/main/charts/crowd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,23 @@ additionalHosts: []
# - "foo.local"
# - "bar.local"

# -- Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix
# for a ConfigMap name, fileName is used as subPath
#
additionalConfigMaps: []
# - name: extra-configmap
# keys:
# - fileName: hello.properties
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# foo=bar
# hello=world
# - fileName: hello.xml
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# content: |
# <xml>
# </xml>

# Monitoring
#
monitoring:
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/jira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Kubernetes: `>=1.21.x-0`

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalConfigMaps | list | `[]` | Create additional ConfigMaps with given names, keys and content. Ther Helm release name will be used as a prefix for a ConfigMap name, fileName is used as subPath |
| additionalContainers | list | `[]` | Additional container definitions that will be added to all Jira pods |
| additionalFiles | list | `[]` | Additional existing ConfigMaps and Secrets not managed by Helm that should be mounted into service container. Configuration details below (camelCase is important!): 'name' - References existing ConfigMap or secret name. 'type' - 'configMap' or 'secret' 'key' - The file name. 'mountPath' - The destination directory in a container. VolumeMount and Volumes are added with this name and index position, for example; custom-config-0, keystore-2 |
| additionalHosts | list | `[]` | Additional host aliases for each pod, equivalent to adding them to the /etc/hosts file. https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ |
Expand Down
16 changes: 16 additions & 0 deletions src/main/charts/jira/templates/configmap-additional-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $i, $key := .Values.additionalConfigMaps -}}
{{- with $ }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-{{ $key.name }}
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
data:
{{- range $key.keys }}
{{ .fileName -}}: |
{{ .content | trim | indent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
Loading

0 comments on commit d0cb30f

Please sign in to comment.