Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[kibana] added plugins support #285

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion elasticsearch/examples/security/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ secrets:
docker.elastic.co/elasticsearch/elasticsearch:$(STACK_VERSION) \
/bin/sh -c " \
elasticsearch-certutil ca --out /app/elastic-stack-ca.p12 --pass '' && \
elasticsearch-certutil cert --name security-master --ca /app/elastic-stack-ca.p12 --pass '' --ca-pass '' --out /app/elastic-certificates.p12" && \
elasticsearch-certutil cert --name security-master --dns security-master --ca /app/elastic-stack-ca.p12 --pass '' --ca-pass '' --out /app/elastic-certificates.p12" && \
docker cp elastic-helm-charts-certs:/app/elastic-certificates.p12 ./ && \
docker rm -f elastic-helm-charts-certs && \
openssl pkcs12 -nodes -passin pass:'' -in elastic-certificates.p12 -out elastic-certificate.pem && \
Expand Down
73 changes: 72 additions & 1 deletion kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,69 @@ spec:
configchecksum: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
{{- end }}
spec:
{{- if (.Values.plugins.enabled) }}
initContainers:
- name: kibana-plugins-install
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
command:
- /bin/bash
- "-c"
- |
set -e
rm -rf plugins/lost+found
plugins=(
{{- range .Values.plugins.values }}
{{ . }}
{{- end }}
)
if {{ .Values.plugins.reset }}
then
for p in $(./bin/kibana-plugin list | cut -d "@" -f1)
do
./bin/kibana-plugin remove ${p}
done
fi
for i in "${plugins[@]}"
do
IFS=',' read -ra PLUGIN <<< "$i"
pluginInstalledCheck=$(./bin/kibana-plugin list | grep "${PLUGIN[0]}" | cut -d '@' -f1 || true)
pluginVersionCheck=$(./bin/kibana-plugin list | grep "${PLUGIN[0]}" | cut -d '@' -f2 || true)
if [ "${pluginInstalledCheck}" = "${PLUGIN[0]}" ]
then
if [ "${pluginVersionCheck}" != "${PLUGIN[1]}" ]
then
./bin/kibana-plugin remove "${PLUGIN[0]}"
./bin/kibana-plugin install "${PLUGIN[2]}"
fi
else
./bin/kibana-plugin install "${PLUGIN[2]}"
fi
done
env:
{{- if .Values.elasticsearchURL }}
- name: ELASTICSEARCH_URL
value: "{{ .Values.elasticsearchURL }}"
{{- else if .Values.elasticsearchHosts }}
- name: ELASTICSEARCH_HOSTS
value: "{{ .Values.elasticsearchHosts }}"
{{- end }}
- name: SERVER_HOST
value: "{{ .Values.serverHost }}"
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 10 }}
{{- end }}
volumeMounts:
{{- range $path, $config := .Values.kibanaConfig }}
- name: kibanaconfig
mountPath: /usr/share/kibana/config/{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- if .Values.plugins.enabled}}
- name: plugins
mountPath: /usr/share/kibana/plugins
{{- end }}
{{- end}}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
Expand All @@ -38,7 +101,7 @@ spec:
{{- if .Values.serviceAccount }}
serviceAccount: {{ .Values.serviceAccount }}
{{- end }}
volumes:
volumes:
{{- range .Values.secretMounts }}
- name: {{ .name }}
secret:
Expand All @@ -49,6 +112,10 @@ spec:
configMap:
name: {{ template "fullname" . }}-config
{{- end }}
{{- if .Values.plugins.enabled}}
- name: plugins
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down Expand Up @@ -121,3 +188,7 @@ spec:
mountPath: /usr/share/kibana/config/{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- if .Values.plugins.enabled}}
- name: plugins
mountPath: /usr/share/kibana/plugins
{{- end }}
13 changes: 13 additions & 0 deletions kibana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ kibanaConfig: {}
# key:
# nestedkey: value

# List of plugins to install using initContainer
# NOTE : We notice that lower resource constraints given to the chart + plugins are likely not going to work well.
plugins:
# set to true to enable plugins installation
enabled: false
# set to true to remove all kibana plugins before installation
reset: false
# Use <plugin_name,version,url> to add/upgrade plugin
values:
# - elastalert-kibana-plugin,1.1.0,https://github.com/bitsensor/elastalert-kibana-plugin/releases/download/1.1.0/elastalert-kibana-plugin-1.1.0-7.3.0.zip
# - logtrail,0.1.31,https://github.com/sivasamyk/logtrail/releases/download/v0.1.31/logtrail-6.6.0-0.1.31.zip
# - other_plugin

# If Pod Security Policy in use it may be required to specify security context as well as service account

podSecurityContext:
Expand Down