mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 19:06:23 -03:00
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:
@@ -15,4 +15,4 @@ maintainers:
|
||||
name: common
|
||||
sources: null
|
||||
type: library
|
||||
version: 10.3.1
|
||||
version: 10.4.0
|
||||
|
||||
@@ -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:
|
||||
|
||||
32
charts/common/templates/lib/dependencies/_solrInjector.tpl
Normal file
32
charts/common/templates/lib/dependencies/_solrInjector.tpl
Normal 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 -}}
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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: {}
|
||||
|
||||
Reference in New Issue
Block a user