Skip to content

Commit

Permalink
PR feedback: remove secret name templates. Use nc instead of wget
Browse files Browse the repository at this point in the history
  • Loading branch information
artntek committed Nov 2, 2023
1 parent 6debd8c commit a67a189
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 36 deletions.
26 changes: 0 additions & 26 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
28 changes: 18 additions & 10 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,39 @@ 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
command:
- 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 "<schema name=\"dataone\"") == 1 ]]; do
echo waiting for Solr Schema to be accessible; sleep 1; done
URI="/solr/{{- .Values.solr.customCollection -}}
/admin/file?file=schema.xml&contentType=text/xml";
until [[ $(echo -e "GET $URI HTTP/1.1\r\nHost: {{ .Values.solr.hostname -}}
\r\n\r\n" | nc {{ .Values.solr.hostname }}{{ print " " -}}
{{ .Values.solr.service.ports.http }} | grep -c "<schema name=\"dataone") == 1 ]]; do
echo waiting for Solr Schema to be accessible at http://{{ .Values.solr.hostname }}:
{{- .Values.solr.service.ports.http }}$URI; sleep 1; done;
- name: init-rabbitmq
image: busybox:latest
command: ['sh', '-c', "until nc -z {{ .Values.rabbitmq.hostname }} {{ .Values.rabbitmq.hostport}} > /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 }}
Expand Down

0 comments on commit a67a189

Please sign in to comment.