From c6b897bfd079e954e1e9ffc0a9bec542b6d3e596 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:28:08 -0500 Subject: [PATCH] fix(ollama) fix ollama sidecar web gui; secret key env (#18476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Should fix the issue for the next update for ollama web gui ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/stable/ollama/Chart.yaml | 2 +- charts/stable/ollama/templates/_secrets.tpl | 13 +++++++++++++ charts/stable/ollama/templates/common.yaml | 12 +++++++++++- charts/stable/ollama/values.yaml | 4 ++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 charts/stable/ollama/templates/_secrets.tpl diff --git a/charts/stable/ollama/Chart.yaml b/charts/stable/ollama/Chart.yaml index 64c4831e7ff..d4cd6e34480 100644 --- a/charts/stable/ollama/Chart.yaml +++ b/charts/stable/ollama/Chart.yaml @@ -36,4 +36,4 @@ sources: - https://hub.docker.com/r/ollama/ollama - https://ghcr.io/ollama-webui/ollama-webui type: application -version: 1.2.1 +version: 1.2.2 diff --git a/charts/stable/ollama/templates/_secrets.tpl b/charts/stable/ollama/templates/_secrets.tpl new file mode 100644 index 00000000000..f20660769f6 --- /dev/null +++ b/charts/stable/ollama/templates/_secrets.tpl @@ -0,0 +1,13 @@ +{{/* Define the secrets */}} +{{- define "ollama.secrets" -}} +{{- $secretName := (printf "%s-ollama-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }} + +{{- $secretKey := randAlphaNum 64 -}} + + {{- with lookup "v1" "Secret" .Release.Namespace $secretName -}} + {{- $secretKey = index .data "WEBUI_SECRET_KEY" | b64dec -}} + {{- end }} +enabled: true +data: + WEBUI_SECRET_KEY: {{ $secretKey }} +{{- end -}} diff --git a/charts/stable/ollama/templates/common.yaml b/charts/stable/ollama/templates/common.yaml index b51394e00a4..d366871deb9 100644 --- a/charts/stable/ollama/templates/common.yaml +++ b/charts/stable/ollama/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render secrets for ollama */}} +{{- $secrets := include "ollama.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "ollama-secrets" $secrets -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/ollama/values.yaml b/charts/stable/ollama/values.yaml index 3569aa3dcc0..7ee130ff1bf 100644 --- a/charts/stable/ollama/values.yaml +++ b/charts/stable/ollama/values.yaml @@ -84,6 +84,10 @@ workload: port: "{{ .Values.service.main.ports.main.targetPort }}" env: OLLAMA_API_BASE_URL: '{{ printf "http://%v-api:%v/api" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.api.ports.api.targetPort }}' + WEBUI_SECRET_KEY: + secretKeyRef: + name: ollama-secrets + key: WEBUI_SECRET_KEY persistence: config: