feat(solr): add solr (#162)

* feat(solr): add solr dep

* bump

Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
This commit is contained in:
Stavros Kois
2022-07-10 20:50:47 +03:00
committed by GitHub
parent 487172b1bb
commit 7e1abb8104
5 changed files with 70 additions and 1 deletions

View File

@@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 10.3.1
version: 10.4.0

View File

@@ -63,6 +63,24 @@ before chart installation.
name: clickhousecreds
key: ping
{{- end }}
{{- if .Values.solr.enabled }}
- name: "SOLR_HOST"
valueFrom:
secretKeyRef:
name: solrcreds
key: plainhost
- name: SOLR_CORES
value: "{{ .Values.solr.solrCores }}"
- name: SOLR_ENABLE_AUTHENTICATION
value: "{{ .Values.solr.solrEnableAuthentication }}"
- name: SOLR_ADMIN_USERNAME
value: "{{ .Values.solr.solrUsername }}"
- name: SOLR_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: solrcreds
key: solr-password
{{- end }}
command:
- "/bin/sh"
- "-c"
@@ -144,6 +162,14 @@ before chart installation.
sleep 2
done
{{- end }}
{{- if .Values.solr.enabled }}
if [ "$SOLR_ENABLE_AUTHENTICATION" == "yes" ]; then
until curl --fail --user "${SOLR_ADMIN_USERNAME}":"${SOLR_ADMIN_PASSWORD}" "${SOLR_HOST}":8983/solr/"${SOLR_CORES}"/admin/ping; do sleep 2; done
else
until curl --fail "${SOLR_HOST}":8983/solr/"${SOLR_CORES}"/admin/ping; do sleep 2; done
fi;
{{- end }}
EOF
volumeMounts:

View File

@@ -0,0 +1,32 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.solr.injector" -}}
{{- $host := printf "%v-%v" .Release.Name "solr" }}
{{- if .Values.solr.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: solrcreds
{{- $solrprevious := lookup "v1" "Secret" .Release.Namespace "solrcreds" }}
{{- $solrPass := "" }}
data:
{{- if $solrprevious }}
{{- $solrPass = ( index $solrprevious.data "solr-password" ) | b64dec }}
solr-password: {{ ( index $solrprevious.data "solr-password" ) }}
{{- else }}
{{- $solrPass = randAlphaNum 50 }}
solr-password: {{ $solrPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "http://%v:%v@%v-solr:8983/%v" .Values.solr.solrUsername $solrPass .Release.Name .Values.solr.solrCores ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.solr "solrPassword" ( $solrPass | quote ) }}
{{- $_ := set .Values.solr.url "plain" ( ( printf "%v-%v" .Release.Name "solr" ) | quote ) }}
{{- $_ := set .Values.solr.url "plainhost" ( ( printf "%v-%v" .Release.Name "solr" ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -30,4 +30,7 @@
{{- /* Autogenerate clickhouse passwords if needed */ -}}
{{- include "tc.common.dependencies.clickhouse.injector" . }}
{{- /* Autogenerate solr passwords if needed */ -}}
{{- include "tc.common.dependencies.solr.injector" . }}
{{- end -}}

View File

@@ -1166,3 +1166,11 @@ clickhouse:
existingSecret: "clickhousecreds"
# -- can be used to make an easy accessable note which URLS to use to access the DB.
url: {}
# -- solr dependency configuration
# @default -- See below
solr:
enabled: false
existingSecret: "solrcreds"
# -- can be used to make an easy accessable note which URLS to use to access the DB.
url: {}