Skip to content

Commit 7d9f245

Browse files
authored
add extravolumes(/mounts) to helm chart
add extravolumes(/mounts) to helm chart Signed-off-by: zvlb <vl.zemtsov@gmail.com>
1 parent f01355b commit 7d9f245

File tree

6 files changed

+171
-115
lines changed

6 files changed

+171
-115
lines changed

helm/charts/envoy-xds-controller/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: "0.72"
18+
version: "0.73"
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

helm/charts/envoy-xds-controller/templates/_helpers.tpl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,41 @@ Create the name of the service account to use
7474
{{- else -}}
7575
{{ default "default" .Values.serviceAccount.name }}
7676
{{- end -}}
77+
{{- end -}}
78+
79+
{{/*
80+
Generate volumeMounts
81+
*/}}
82+
{{- define "chart.volumeMounts" -}}
83+
{{- $mounts := list -}}
84+
{{- if .Values.webhook.enabled -}}
85+
{{- $mounts = append $mounts (dict "name" "cert" "mountPath" "/tmp/k8s-webhook-server/serving-certs" "readOnly" true) -}}
86+
{{- end -}}
87+
{{- if .Values.extraVolumeMounts -}}
88+
{{- $mounts = concat $mounts .Values.extraVolumeMounts -}}
89+
{{- end -}}
90+
{{- if $mounts -}}
91+
{{- toYaml $mounts -}}
92+
{{- end -}}
93+
{{- end -}}
94+
95+
{{/*
96+
Generate volumes
97+
*/}}
98+
{{- define "chart.volumes" -}}
99+
{{- $volumes := list -}}
100+
{{- if .Values.webhook.enabled -}}
101+
{{- $certVolume := dict "name" "cert"
102+
"secret" (dict
103+
"secretName" (.Values.webhook.tls.name | required "webhook.tls.name is required")
104+
"defaultMode" 420
105+
) -}}
106+
{{- $volumes = append $volumes $certVolume -}}
107+
{{- end -}}
108+
{{- if .Values.extraVolumes -}}
109+
{{- $volumes = concat $volumes .Values.extraVolumes -}}
110+
{{- end -}}
111+
{{- if $volumes -}}
112+
{{- toYaml $volumes -}}
113+
{{- end -}}
77114
{{- end -}}

helm/charts/envoy-xds-controller/templates/deployment.yaml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,18 @@ spec:
4141
{{- end }}
4242
containers:
4343
- image: {{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}
44-
{{- if .Values.args }}
44+
{{- if or .Values.args .Values.cacheAPI.enabled }}
4545
args:
46+
{{- if .Values.args }}
4647
{{- toYaml .Values.args | nindent 10 }}
48+
{{- end }}
4749
{{- if .Values.cacheAPI.enabled }}
4850
- --development={{ .Values.development }}
4951
- --enable-cache-api=true
5052
- --cache-api-port={{ .Values.cacheAPI.port }}
5153
- --cache-api-scheme={{ .Values.cacheAPI.scheme }}
5254
- --cache-api-addr={{ .Values.cacheAPI.address }}
5355
{{- end }}
54-
{{- else if .Values.cacheAPI.enabled }}
55-
args:
56-
- --development={{ .Values.development }}
57-
- --enable-cache-api=true
58-
- --cache-api-port={{ .Values.cacheAPI.port }}
59-
- --cache-api-scheme={{ .Values.cacheAPI.scheme }}
60-
- --cache-api-addr={{ .Values.cacheAPI.address }}
6156
{{- end }}
6257
env:
6358
- name: XDS_PORT
@@ -92,14 +87,14 @@ spec:
9287
{{- tpl . $ | nindent 10 }}
9388
{{- end }}
9489
{{- if .Values.webhook.enabled }}
95-
{{- if .Values.webhook.tls.name }}
90+
{{- if .Values.webhook.tls.name }}
9691
- name: TLS_SECRET_NAME
9792
value: {{ .Values.webhook.tls.name }}
98-
{{- end }}
99-
{{- if .Values.webhook.port }}
93+
{{- end }}
94+
{{- if .Values.webhook.port }}
10095
- name: WEBHOOK_PORT
10196
value: "{{ .Values.webhook.port }}"
102-
{{- end }}
97+
{{- end }}
10398
{{- end }}
10499
{{- if not .Values.webhook.enabled }}
105100
- name: WEBHOOK_DISABLE
@@ -120,15 +115,16 @@ spec:
120115
imagePullPolicy: {{ .Values.image.pullPolicy }}
121116
name: envoy-xds-controller
122117
resources:
123-
{{ toYaml .Values.resources | indent 12 }}
124-
{{- if .Values.webhook.enabled }}
118+
{{- toYaml .Values.resources | nindent 12 }}
119+
{{- /* Volume Mounts */}}
120+
{{- $mounts := include "chart.volumeMounts" . }}
121+
{{- if $mounts }}
125122
volumeMounts:
126-
- mountPath: /tmp/k8s-webhook-server/serving-certs
127-
name: cert
128-
readOnly: true
123+
{{- $mounts | nindent 10 }}
124+
{{- end }}
125+
{{- /* Volumes */}}
126+
{{- $volumes := include "chart.volumes" . }}
127+
{{- if $volumes }}
129128
volumes:
130-
- name: cert
131-
secret:
132-
defaultMode: 420
133-
secretName: {{ .Values.webhook.tls.name }}
134-
{{- end }}
129+
{{- $volumes | nindent 8 }}
130+
{{- end }}

helm/charts/envoy-xds-controller/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ secrets: {}
152152
# username: "logstash"
153153
# password: "password"
154154

155+
# -- Extra Volumes for the pod
156+
extraVolumes: []
157+
# - name: example
158+
# configMap:
159+
# name: example
160+
161+
# -- Extra Volume Mounts for the container
162+
extraVolumeMounts: []
163+
# - name: example
164+
# mountPath: /example
155165

156166
# Validating Webhook Options
157167
webhook:

0 commit comments

Comments
 (0)