Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of extra envs as map in Helm chart #2146

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix usage of extra envs as map in Helm chart
alexintech committed Jun 9, 2023

Verified

This commit was signed with the committer’s verified signature.
rezkiy37 Michael (Mykhailo) Kravchenko
commit 9ac831a3316629a7aa9bd1bb642c2b9ccb5b0a5a
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix receive channel filter in alert groups API [#2140](https://github.com/grafana/oncall/pull/2140)
- Helm chart: Fix usage of `env` settings as map;
Fix usage of `mariadb.auth.database` and `mariadb.auth.username` for MYSQL env variables by @alexintech [#2146](https://github.com/grafana/oncall/pull/2146)

## v1.2.41 (2023-06-08)

4 changes: 2 additions & 2 deletions helm/oncall/templates/_env.tpl
Original file line number Diff line number Diff line change
@@ -257,15 +257,15 @@ http://{{ include "oncall.grafana.fullname" . }}
{{- if and (not .Values.mariadb.enabled) .Values.externalMysql.db_name -}}
{{- required "externalMysql.db_name is required if not mariadb.enabled" .Values.externalMysql.db_name | quote}}
{{- else -}}
"oncall"
{{- .Values.mariadb.auth.database | default "oncall" | quote -}}
{{- end -}}
{{- end -}}

{{- define "snippet.mysql.user" -}}
{{- if and (not .Values.mariadb.enabled) .Values.externalMysql.user -}}
{{- .Values.externalMysql.user | quote }}
{{- else -}}
"root"
{{- .Values.mariadb.auth.username | default "root" | quote -}}
{{- end -}}
{{- end -}}

30 changes: 16 additions & 14 deletions helm/oncall/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -97,17 +97,7 @@ Create the name of the service account to use
{{- include "snippet.mysql.env" . | nindent 4 }}
{{- include "snippet.rabbitmq.env" . | nindent 4 }}
{{- include "snippet.redis.env" . | nindent 4 }}
{{- if .Values.env }}
{{- if (kindIs "map" .Values.env) }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value }}
{{- end -}}
{{/* support previous schema */}}
{{- else }}
{{- toYaml .Values.env | nindent 4 }}
{{- end }}
{{- end }}
{{- include "oncall.extraEnvs" . | nindent 4 }}
{{- end }}

{{- define "oncall.postgresql.wait-for-db" }}
@@ -122,7 +112,19 @@ Create the name of the service account to use
{{- include "snippet.postgresql.env" . | nindent 4 }}
{{- include "snippet.rabbitmq.env" . | nindent 4 }}
{{- include "snippet.redis.env" . | nindent 4 }}
{{- if .Values.env }}
{{- toYaml .Values.env | nindent 4 }}
{{- end }}
{{- include "oncall.extraEnvs" . | nindent 4 }}
{{- end }}

{{- define "oncall.extraEnvs" -}}
{{- if .Values.env }}
{{- if (kindIs "map" .Values.env) }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value }}
{{- end -}}
{{/* support previous schema */}}
{{- else }}
{{- toYaml .Values.env }}
{{- end }}
{{- end }}
{{- end }}
Comment on lines +118 to +130
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

12 changes: 1 addition & 11 deletions helm/oncall/templates/celery/_deployment.tpl
Original file line number Diff line number Diff line change
@@ -59,17 +59,7 @@ spec:
{{- end }}
{{- include "snippet.rabbitmq.env" . | nindent 12 }}
{{- include "snippet.redis.env" . | nindent 12 }}
{{- if .Values.env }}
{{- if (kindIs "map" .Values.env) }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value }}
{{- end -}}
{{/* support previous schema */}}
{{- else }}
{{- toYaml .Values.env | nindent 12 }}
{{- end }}
{{- end }}
{{- include "oncall.extraEnvs" . | nindent 12 }}
{{- if .Values.celery.livenessProbe.enabled }}
livenessProbe:
exec:
12 changes: 1 addition & 11 deletions helm/oncall/templates/engine/deployment.yaml
Original file line number Diff line number Diff line change
@@ -59,17 +59,7 @@ spec:
{{- end }}
{{- include "snippet.rabbitmq.env" . | nindent 12 }}
{{- include "snippet.redis.env" . | nindent 12 }}
{{- if .Values.env }}
{{- if (kindIs "map" .Values.env) }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value }}
{{- end -}}
{{/* support previous schema */}}
{{- else }}
{{- toYaml .Values.env | nindent 12 }}
{{- end }}
{{- end }}
{{- include "oncall.extraEnvs" . | nindent 12 }}
livenessProbe:
httpGet:
path: /health/
4 changes: 1 addition & 3 deletions helm/oncall/templates/engine/job-migrate.yaml
Original file line number Diff line number Diff line change
@@ -74,9 +74,7 @@ spec:
{{- end }}
{{- include "snippet.rabbitmq.env" . | nindent 12 }}
{{- include "snippet.redis.env" . | nindent 12 }}
{{- if .Values.env }}
{{- toYaml .Values.env | nindent 12 }}
{{- end }}
{{- include "oncall.extraEnvs" . | nindent 12 }}
resources:
{{- toYaml .Values.engine.resources | nindent 12 }}
{{- end }}
Loading