From c833a4c776a788dad1adf5d620ee308612a24953 Mon Sep 17 00:00:00 2001 From: Nathan Savage Date: Fri, 30 Aug 2024 10:58:03 +0100 Subject: [PATCH] fixed logic issue with apiKey and readOnlyApiKey primitive values introduced in last commit --- charts/qdrant/templates/_helpers.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/qdrant/templates/_helpers.tpl b/charts/qdrant/templates/_helpers.tpl index 325a397..1601081 100644 --- a/charts/qdrant/templates/_helpers.tpl +++ b/charts/qdrant/templates/_helpers.tpl @@ -68,6 +68,7 @@ Create secret {{- define "qdrant.secret" -}} {{- $readOnlyApiKey := false }} {{- $apiKey := false }} +{{- if eq (typeOf .Values.apiKey) "dict" -}} {{- if .Values.apiKey.valueFrom -}} {{- /* Retrieve the value from the secret as specified in valueFrom */ -}} {{- $secretName := .Values.apiKey.valueFrom.secretKeyRef.name -}} @@ -75,6 +76,7 @@ Create secret {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace $secretName) | default dict -}} {{- $secretData := (get $secretObj "data") | default dict -}} {{- $apiKey = (get $secretData $secretKey | b64dec) -}} +{{- end -}} {{- else if .Values.apiKey | toJson | eq "true" -}} {{- /* Retrieve existing randomly generated api key or create a new one */ -}} {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (printf "%s-apikey" (include "qdrant.fullname" . ))) | default dict -}} @@ -83,6 +85,7 @@ Create secret {{- else if .Values.apiKey -}} {{- $apiKey = .Values.apiKey -}} {{- end -}} +{{- if eq (typeOf .Values.apiKey) "dict" -}} {{- if .Values.readOnlyApiKey.valueFrom -}} {{- /* Retrieve the value from the secret as specified in valueFrom */ -}} {{- $secretName := .Values.readOnlyApiKey.valueFrom.secretKeyRef.name -}} @@ -90,6 +93,7 @@ Create secret {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace $secretName) | default dict -}} {{- $secretData := (get $secretObj "data") | default dict -}} {{- $readOnlyApiKey = (get $secretData $secretKey | b64dec) -}} +{{- end -}} {{- else if eq (.Values.readOnlyApiKey | toJson) "true" -}} {{- /* retrieve existing randomly generated api key or create new one */ -}} {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (printf "%s-apikey" (include "qdrant.fullname" . ))) | default dict -}}