[incubator/solr] Allow adding a custom script to be run before starting Solr (using the entry point of the official Solr Docker Image) (#21598)

* Allow adding a custom script to be run before starting Solr

Signed-off-by: John Bai <pikapai@gmail.com>

* Allow adding a custom script to be run before starting Solr

Signed-off-by: John Bai <pikapai@gmail.com>

* Update incubator/solr/Chart.yaml

Bump version for new features

Co-Authored-By: Carlos Tadeu Panato Junior <ctadeu@gmail.com>
Signed-off-by: John Bai <pikapai@gmail.com>

Co-authored-by: Carlos Tadeu Panato Junior <ctadeu@gmail.com>
This commit is contained in:
John Bai
2020-04-27 22:42:04 -07:00
committed by GitHub
co-authored by Carlos Tadeu Panato Junior
parent b41d0e5eea
commit 886cac277e
6 changed files with 39 additions and 1 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
apiVersion: "v1"
name: "solr"
version: "1.4.0"
version: "1.5.0"
appVersion: "8.4.0"
description: "A helm chart to install Apache Solr: http://lucene.apache.org/solr/"
keywords:
+2
View File
@@ -31,6 +31,8 @@ The following table shows the configuration options for the Solr helm chart:
| `javaMem` | JVM memory settings to pass to Solr | `-Xms2g -Xmx3g` |
| `resources` | Resource limits and requests to set on the solr pods | `{}` |
| `extraEnvVars` | Additional environment variables to set on the solr pods (in yaml syntax) | `[]` |
| `initScript` | The file name of the custom script to be run before starting Solr | `""` |
| `terminationGracePeriodSeconds` | The termination grace period of the Solr pods | `180`|
| `image.repository` | The repository to pull the docker image from| `solr` |
| `image.tag` | The tag on the repository to pull | `7.7.2` |
+7
View File
@@ -80,6 +80,13 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" (include "solr.fullname" .) "config-map" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Define the name of the custom script configmap
*/}}
{{- define "solr.custom-script.configmap-name" -}}
{{- printf "%s-%s" (include "solr.fullname" .) "custom-script-config-map" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Define the labels that should be applied to all resources in the chart
*/}}
@@ -0,0 +1,13 @@
{{ if not ( eq .Values.initScript "" ) }}
---
apiVersion: "v1"
kind: "ConfigMap"
metadata:
name: "{{ include "solr.custom-script.configmap-name" . }}"
labels:
{{ include "solr.common.labels" . | indent 4}}
data:
solr-init.sh: |
{{ .Files.Get .Values.initScript | indent 4}}
{{ end }}
+12
View File
@@ -55,6 +55,14 @@ spec:
items:
- key: solr.xml
path: solr.xml
{{- if not ( eq .Values.initScript "" ) }}
- name: solr-init-script
configMap:
name: {{ include "solr.custom-script.configmap-name" . }}
items:
- key: solr-init.sh
path: solr-init.sh
{{- end }}
initContainers:
- name: check-zk
image: busybox:latest
@@ -199,6 +207,10 @@ spec:
volumeMounts:
- name: {{ include "solr.pvc-name" . }}
mountPath: /opt/solr/server/home
{{- if not ( eq .Values.initScript "" ) }}
- name: solr-init-script
mountPath: /docker-entrypoint-initdb.d
{{- end }}
{{ if .Values.tls.enabled }}
- name: "keystore-volume"
mountPath: "/etc/ssl/keystores"
+4
View File
@@ -22,6 +22,10 @@ resources: {}
# Extra environment variables - allows yaml definitions
extraEnvVars: []
# Specify the initial script file name here to be executed before starting Solr
# The file is located relative to the solr chart root folder
initScript: ""
# Sets the termination Grace period for the solr pods
# This can take a while for shards to elect new leaders
terminationGracePeriodSeconds: 180