From 344ed57da591d9d9e676df3db4caa75c4c157ee3 Mon Sep 17 00:00:00 2001
From: Aditya Thebe <thebeaditya@gmail.com>
Date: Mon, 2 Oct 2023 14:57:07 +0545
Subject: [PATCH] fix: helm chart

---
 chart/templates/deployment.yaml | 10 +++++++---
 chart/values.yaml               |  5 +++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml
index d41d8c2ca..c98af5afc 100644
--- a/chart/templates/deployment.yaml
+++ b/chart/templates/deployment.yaml
@@ -42,9 +42,11 @@ spec:
             - --disable-postgrest={{ .Values.disablePostgrest }}
             - --change-retention-days={{ .Values.configChangeRetentionDays }}
             - --analysis-retention-days={{ .Values.configAnalysisRetentionDays }}
+          {{- if .Values.upstream.enabled}}
           envFrom:
             - secretRef:
-              name: {{ .Values.upstream.secretKeyRef.name }}
+                name: {{ .Values.upstream.secretKeyRef.name }}
+          {{- end}}
           env:
             - name: DB_URL
               valueFrom:
@@ -53,10 +55,12 @@ spec:
                   key: {{ .Values.db.secretKeyRef.key }}
             - name: NAMESPACE
               value: {{ .Values.namespace | default .Release.Namespace }}
+            {{- if .Values.upstream.enabled}}
             - name: AGENT_NAME
-              value: {{ .Values.upstream.agentName }}
+              value: '{{ .Values.upstream.agentName }}'
             - name: UPSTREAM_PAGE_SIZE
-              value: {{ .Values.upstream.pageSize }}
+              value: '{{ .Values.upstream.pageSize }}'
+            {{- end}}
           resources:
             {{- toYaml .Values.resources | nindent 12 }}
       {{- with .Values.extra }}
diff --git a/chart/values.yaml b/chart/values.yaml
index 6548c913c..d9853670a 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -62,9 +62,10 @@ serviceAccount:
   annotations: {}
 
 upstream:
+  enabled: true
   secretKeyRef:
-    name: upstream
-  agentName: 
+    name: upstream # Must contain: UPSTREAM_USER, UPSTREAM_PASS & UPSTREAM_HOST
+  agentName: default-agent
   pageSize: 500
 
 extra: