From a67a189ccf35e73f380596b81f7fbbf9cfdbd77a Mon Sep 17 00:00:00 2001 From: Matthew B <106352182+artntek@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:36:09 -0700 Subject: [PATCH] PR feedback: remove secret name templates. Use nc instead of wget --- helm/templates/_helpers.tpl | 26 -------------------------- helm/templates/deployment.yaml | 28 ++++++++++++++++++---------- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index b6993133..daf761dd 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -60,29 +60,3 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} - -{{/* -Get the rabbitmq password secret. -*/}} -{{- define "idx.rabbitmq.secretPasswordName" -}} - {{- $rabbitmq := default dict .Values.rabbitmq -}} - {{- $auth := default dict $rabbitmq.auth -}} - {{- if $auth.existingPasswordSecret -}} - {{- printf "%s" (tpl .Values.rabbitmq.auth.existingPasswordSecret $) -}} - {{- else -}} - {{- printf "NEED_TO_SET_.Values.rabbitmq.auth.existingPasswordSecret_!!" -}} - {{- end -}} -{{- end -}} - -{{/* -Get the solr password secret. -*/}} -{{- define "idx.solr.secretPasswordName" -}} - {{- $solr := default dict .Values.solr -}} - {{- $solrauth := default dict $solr.auth -}} - {{- if $solrauth.existingSecret -}} - {{- printf "%s" (tpl .Values.solr.auth.existingSecret $) -}} - {{- else -}} - {{- printf "NEED_TO_SET_.Values.solr.auth.existingPasswordSecret_!!" -}} - {{- end -}} -{{- end -}} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index b29a8cef..9f0ea924 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -67,15 +67,17 @@ spec: - name: RABBITMQ_PASSWORD valueFrom: secretKeyRef: - name: {{ template "idx.rabbitmq.secretPasswordName" . }} + name: {{ .Values.rabbitmq.auth.existingPasswordSecret }} key: rabbitmq-password optional: false + {{- if .Values.solr.auth.enabled }} - name: SOLR_ADMIN_PASSWORD valueFrom: secretKeyRef: - name: {{ template "idx.solr.secretPasswordName" . }} + name: {{ .Values.solr.auth.existingSecret }} key: SOLR_ADMIN_PASSWORD - optional: false + optional: true + {{ end }} initContainers: - name: init-solr image: busybox:latest @@ -83,15 +85,21 @@ spec: - sh - -c - > - until [[ $(wget -O- "{{- .Values.solr.hostname -}}: - {{- .Values.solr.service.ports.http -}}/solr/ - {{- .Values.solr.customCollection -}} - /admin/file?file=schema.xml&contentType=text/xml"{{- printf " " -}} - | grep -c " /dev/null; do echo waiting for RabbitMQ; sleep 2; done"] + command: + - sh + - -c + - > + until nc -z {{ .Values.rabbitmq.hostname }} {{ .Values.rabbitmq.hostport }} > + {{- print " " }}/dev/null; do echo waiting for RabbitMQ; sleep 2; done; {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }}