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 query service env vars handling for additionalEnvs (closes #578) #591

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
Prev Previous commit
Next Next commit
ref: refactor env rendering to use common helper function
TheShubhendra committed Jan 4, 2025
commit 914341e6064daf176bf63648582fe8da5f76eb4d
27 changes: 27 additions & 0 deletions charts/signoz/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -740,3 +740,30 @@ imagePullSecrets:
{{- end }}
{{- end }}
{{- end }}

{{/*
Function to render environment variables
*/}}
{{- define "common.renderAdditionalEnv" -}}
{{- $dict := . -}}
{{- $processedKeys := dict -}}
{{- range keys . | sortAlpha }}
{{- $val := pluck . $dict | first -}}
{{- $key := upper . -}}
{{- if not (hasKey $processedKeys $key) }}
{{- $processedKeys = merge $processedKeys (dict $key true) -}}
{{- $valueType := printf "%T" $val -}}
{{- if eq $valueType "map[string]interface {}" }}
- name: {{ $key }}
{{ toYaml $val | indent 2 -}}
{{- else if eq $valueType "string" }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- else }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}

14 changes: 1 addition & 13 deletions charts/signoz/templates/query-service/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -138,19 +138,7 @@ spec:
value: {{ quote .Values.queryService.configVars.telemetryEnabled }}
- name: DEPLOYMENT_TYPE
value: {{ .Values.queryService.configVars.deploymentType }}
{{- range $key, $val := .Values.queryService.additionalEnvs }}
- name: {{ $key }}
{{- if kindIs "map" $val }}
{{- if $val.value}}
value: {{ $val.value | quote }}
{{- end}}
{{- if $val.valueFrom }}
valueFrom: {{ toYaml $val.valueFrom | nindent 16 }}
{{- end}}
{{- else }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- include "common.renderAdditionalEnv" .Values.queryService.additionalEnvs | nindent 12 }}
{{- if .Values.queryService.smtpVars.enabled }}
- name: SMTP_ENABLED
value: "true"