From d57750c675d8981ad999ba309310411e65012bb6 Mon Sep 17 00:00:00 2001
From: Ryan Gonzalez <ryan.gonzalez@collabora.com>
Date: Thu, 4 Apr 2024 15:35:26 -0500
Subject: [PATCH] chart: Add support for setting custom env vars

This is needed to configure the Go runtime.

https://phabricator.apertis.org/T10420

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
---
 chart/templates/statefulset.yaml | 2 ++
 chart/values.yaml                | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/chart/templates/statefulset.yaml b/chart/templates/statefulset.yaml
index edd84b89..a30aa2c3 100644
--- a/chart/templates/statefulset.yaml
+++ b/chart/templates/statefulset.yaml
@@ -35,6 +35,8 @@ spec:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
         - name: {{ .Chart.Name }}-api
+          env:
+            {{- toYaml .Values.api.extraEnvVars | nindent 12 }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
           image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
diff --git a/chart/values.yaml b/chart/values.yaml
index 66dfae24..f32c0f5f 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -12,6 +12,14 @@ image:
 
 api:
   resources: {}
+  # Go runtime configuration variables can be set here, e.g.:
+  # extraEnvVars:
+  #   - name: GOMEMLIMIT
+  #     value: 128MiB
+  # For reference, see:
+  # - https://pkg.go.dev/runtime#hdr-Environment_Variables
+  # - https://go.dev/doc/gc-guide
+  extraEnvVars: []
 
 publish:
   resources: {}
-- 
GitLab