Skip to content

Commit adbb220

Browse files
authored
Allow setting envvars in the events deployment (#648)
1 parent 05ebd37 commit adbb220

File tree

4 files changed

+62
-2
lines changed

4 files changed

+62
-2
lines changed

charts/posthog/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type: application
1111

1212
# This is the chart version. This version number should be incremented each time you make changes
1313
# to the chart and its templates, including the app version.
14-
version: 30.1.0
14+
version: 30.2.0
1515

1616
# This is the version number of the application being deployed. This version number should be
1717
# incremented each time you make changes to the application.

charts/posthog/templates/events-deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ spec:
113113
{{- if .Values.env }}
114114
{{ toYaml .Values.env | indent 8 }}
115115
{{- end }}
116-
{{- if .Values.web.env }}
116+
{{- if .Values.events.env }}
117+
{{ toYaml .Values.events.env | indent 8 }}
118+
{{- else if .Values.web.env }}
117119
{{ toYaml .Values.web.env | indent 8 }}
118120
{{- end }}
119121

charts/posthog/tests/events-deployment.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,61 @@ tests:
183183
name: SENTRY_DSN
184184
value: sentry.endpoint
185185

186+
- it: uses web.env if events.env is empty
187+
template: templates/events-deployment.yaml # TODO: remove once secrets.yaml will be fixed/removed
188+
set:
189+
cloud: local # TODO: remove once secrets.yaml will be fixed/removed
190+
env:
191+
- name: FIRST
192+
value: one
193+
web:
194+
env:
195+
- name: SECOND
196+
value: two
197+
asserts:
198+
- contains:
199+
path: spec.template.spec.containers[0].env
200+
content:
201+
name: FIRST
202+
value: one
203+
- contains:
204+
path: spec.template.spec.containers[0].env
205+
content:
206+
name: SECOND
207+
value: two
208+
209+
- it: ignores web.env if events.env is set
210+
template: templates/events-deployment.yaml # TODO: remove once secrets.yaml will be fixed/removed
211+
set:
212+
cloud: local # TODO: remove once secrets.yaml will be fixed/removed
213+
env:
214+
- name: FIRST
215+
value: one
216+
web:
217+
env:
218+
- name: SECOND
219+
value: two
220+
events:
221+
env:
222+
- name: THIRD
223+
value: three
224+
asserts:
225+
- contains:
226+
path: spec.template.spec.containers[0].env
227+
content:
228+
name: FIRST
229+
value: one
230+
- contains:
231+
path: spec.template.spec.containers[0].env
232+
content:
233+
name: THIRD
234+
value: three
235+
- notContains:
236+
path: spec.template.spec.containers[0].env
237+
content:
238+
name: SECOND
239+
value: two
240+
186241
- it: allows setting imagePullSecrets
187242
template: templates/events-deployment.yaml # TODO: remove once secrets.yaml will be fixed/removed
188243
set:

charts/posthog/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ events:
7474
# for configuration options
7575
behavior:
7676

77+
# -- Additional env variables to inject into the events stack, uses `web.env` if empty.
78+
env: []
79+
7780
# -- Container security context for the events stack HorizontalPodAutoscaler.
7881
securityContext:
7982
enabled: false

0 commit comments

Comments
 (0)