Skip to content

Commit 3ac1df1

Browse files
authored
[Monochart 0.27.0] Feature: deployment.yaml volume mounts (#275)
* `[Monochart]` Feature: `deployment.yaml` volume mounts (#273) * update chart to allow volumes * update chart for more conditionals, fixes Volumes, Volume Mounts, Pull Secrets, ENV (cherry picked from commit 61ffa1b) * update version
1 parent b8033f0 commit 3ac1df1

5 files changed

Lines changed: 46 additions & 9 deletions

File tree

incubator/monochart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
description: A declarative helm chart for deploying common types of services on Kubernetes
33
name: monochart
4-
version: 0.26.0
5-
appVersion: 0.26.0
4+
version: 0.27.0
5+
appVersion: 0.27.0
66
home: https://github.com/cloudposse/charts/tree/master/incubator/monochart
77
icon: https://raw.githubusercontent.com/cloudposse/charts/master/incubator/monochart/logo.png
88
maintainers:

incubator/monochart/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,16 @@ env:
6161
value: {{ default "" $value | quote }}
6262
{{- end }}
6363
{{- end }}
64+
6465
{{/*
6566
https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables
6667
*/}}
6768
{{- with $root.Values.envFromFieldRefFieldPath }}
69+
70+
{{/* Only add env block if not used by above .Values.env */}}
71+
{{- if not $root.Values.env}}
6872
env:
73+
{{- end }}
6974
{{- range $name, $value := . }}
7075
- name: {{ $name }}
7176
valueFrom:

incubator/monochart/templates/deployment.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,33 +96,44 @@ spec:
9696
protocol: {{ default "TCP" $port.protocol }}
9797
{{- end }}
9898
{{- end }}
99+
{{- if or .Values.deployment.pod.volumeMounts .Values.persistence.enabled .Values.configMaps.enabled .Values.secrets.enabled }}
99100
volumeMounts:
101+
{{- if .Values.deployment.pod.volumeMounts }}
102+
{{- toYaml .Values.deployment.pod.volumeMounts | nindent 8 }}
103+
{{- end }}
100104
{{- if .Values.persistence.enabled }}
101105
- mountPath: {{ .Values.persistence.mountPath | quote }}
102106
name: storage
103107
{{- end }}
104108
{{- include "monochart.files.volumeMounts" . | nindent 8 }}
109+
{{- end }}
105110
{{- with .Values.probes }}
106111
{{ toYaml . | indent 8 }}
107112
{{- end }}
108113
{{- with .Values.resources }}
109114
resources:
110115
{{ toYaml . | indent 10 }}
111116
{{- end }}
112-
{{- with .Values.deployment.pod.hostAliases }}
117+
{{- with .Values.deployment.pod.hostAliases }}
113118
hostAliases:
114-
{{ toYaml . | indent 8 }}
115-
{{- end }}
119+
{{- toYaml . | indent 8 }}
120+
{{- end }}
121+
{{- if or .Values.dockercfg.enabled .Values.image.pullSecrets }}
116122
imagePullSecrets:
117-
{{- if .Values.dockercfg.enabled }}
123+
{{- end }}
124+
{{- if .Values.dockercfg.enabled }}
118125
- name: {{ include "common.fullname" . }}
119-
{{- end }}
120-
{{- with .Values.image.pullSecrets }}
126+
{{- end }}
127+
{{- with .Values.image.pullSecrets }}
121128
{{- range . }}
122129
- name: {{ . }}
123130
{{- end }}
124-
{{- end }}
131+
{{- end }}
132+
{{- if or .Values.deployment.volumes .Values.persistence.enabled .Values.configMaps.enabled .Values.secrets.enabled }}
125133
volumes:
134+
{{- if .Values.deployment.volumes }}
135+
{{- toYaml .Values.deployment.volumes | nindent 6 }}
136+
{{- end }}
126137
{{- if .Values.persistence.enabled }}
127138
- name: storage
128139
{{- if .Values.persistence.enabled }}
@@ -133,4 +144,6 @@ spec:
133144
{{- end }}
134145
{{- end }}
135146
{{- include "monochart.files.volumes" . | nindent 6 }}
147+
{{- end }}
148+
136149
{{- end -}}

incubator/monochart/test/full.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ deployment:
6565
## https://github.com/jtblin/kube2iam
6666
# iam.amazonaws.com/role: role-arn
6767
labels: {}
68+
69+
## Directly attach Volume
70+
volumeMounts:
71+
- name: apmsocketpath
72+
mountPath: /var/run/datadog
73+
volumes:
74+
- hostPath:
75+
path: /var/run/datadog/
76+
name: apmsocketpath
77+
6878
affinity:
6979
# use of simple rule
7080
affinityRule: "ShouldBeOnDifferentNode"

incubator/monochart/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ deployment:
103103
labels: {}
104104
# command:
105105
args: []
106+
107+
volumeMounts: []
108+
# - name: apmsocketpath
109+
# mountPath: /var/run/datadog
110+
111+
volumes: []
112+
# - name: apmsocketpath
113+
# hostPath:
114+
# path: /var/run/datadog/
106115

107116
statefulset:
108117
enabled: false

0 commit comments

Comments
 (0)