Skip to content

Commit

Permalink
Allow using separate image/command for posthog web (#779)
Browse files Browse the repository at this point in the history
* Allow using separate image/command for posthog web

This will allow us to test out our nginx unit image on web first

* Add test

* Fix some issues

* Fix test

* Fix command
  • Loading branch information
frankh authored Nov 22, 2023
1 parent f95ceea commit 90bd9b7
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/posthog/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 30.35.0
version: 30.36.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
13 changes: 13 additions & 0 deletions charts/posthog/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ Set the posthog image
{{- end -}}
{{- end -}}

{{/*
Set the posthog web image
*/}}
{{- define "posthog.web.image.fullPath" -}}
{{ if .Values.web.image.sha -}}
"{{ .Values.web.image.repository }}@{{ .Values.web.image.sha }}"
{{- else if .Values.web.image.tag -}}
"{{ .Values.web.image.repository }}:{{ .Values.web.image.tag }}"
{{- else -}}
{{ include "posthog.image.fullPath" . }}
{{- end -}}
{{- end -}}

{{/*
Set zookeeper host
*/}}
Expand Down
9 changes: 8 additions & 1 deletion charts/posthog/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ spec:

containers:
- name: {{ .Chart.Name }}-web
image: {{ template "posthog.image.fullPath" . }}
image: {{ template "posthog.web.image.fullPath" . }}
{{ if .Values.web.image.command -}}
command:
{{- range .Values.web.image.command }}
- {{ . }}
{{- end }}
{{ else }}
command:
- ./bin/docker-server
{{ end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
Expand Down
26 changes: 26 additions & 0 deletions charts/posthog/tests/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,29 @@ tests:
content:
name: POSTHOG_POSTGRES_READ_HOST
value: beep-boop

- it: should be able to have web.image set
template: templates/web-deployment.yaml
set:
cloud: local
web.image.sha: sha256:2a16a47578d0193480dd02bcda7952f09acb34eacdf764315123f2271f72838d
web.image.repository: webimage
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].image
value: webimage@sha256:2a16a47578d0193480dd02bcda7952f09acb34eacdf764315123f2271f72838d

- it: should be able to have custom web.image.command set
template: templates/web-deployment.yaml
set:
cloud: local
web.image.command: [./bin/run]
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.template.spec.containers[0].command
value:
- ./bin/run
2 changes: 2 additions & 0 deletions charts/posthog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ web:
# -- Whether to install the PostHog web stack or not.
enabled: true

image: {}

podAnnotations:
# Uncomment these lines if you want Prometheus server to scrape metrics.
# prometheus.io/scrape: "true"
Expand Down

0 comments on commit 90bd9b7

Please sign in to comment.