From bdb1004baee183fed9b473e655a96edc0ced9b97 Mon Sep 17 00:00:00 2001 From: Sergey Baranov <37897781+skarj@users.noreply.github.com> Date: Tue, 7 Aug 2018 18:08:10 +0300 Subject: [PATCH] filebeat index template loading (#7035) --- stable/filebeat/Chart.yaml | 2 +- stable/filebeat/README.md | 3 ++- stable/filebeat/templates/daemonset.yaml | 15 ++++++++++++++- stable/filebeat/values.yaml | 6 ++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/stable/filebeat/Chart.yaml b/stable/filebeat/Chart.yaml index a6019b6713..7611b8a46f 100644 --- a/stable/filebeat/Chart.yaml +++ b/stable/filebeat/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: A Helm chart to collect Kubernetes logs with filebeat icon: https://www.elastic.co/assets/blt47799dcdcf08438d/logo-elastic-beats-lt.svg name: filebeat -version: 0.6.0 +version: 0.7.0 appVersion: 6.3.1 home: https://www.elastic.co/products/beats/filebeat sources: diff --git a/stable/filebeat/README.md b/stable/filebeat/README.md index 9cd17c7121..d27779aec6 100644 --- a/stable/filebeat/README.md +++ b/stable/filebeat/README.md @@ -39,13 +39,14 @@ The following table lists the configurable parameters of the filebeat chart and | `config.output.file.number_of_files` | | `5` | | `config.http.enabled` | | `false` | | `config.http.port` | | `5066` | +| `indexTemplateLoad` | List of Elasticsearch hosts to load index template, when logstash output is used | `[]` | | `plugins` | List of beat plugins | `[]` | | `extraVars` | A map of additional environment variables | `{}` | | `extraVolumes` | Add additional volumes | `[]` | | `extraVolumeMounts` | Add additional mounts | `[]` | | `resources` | | `{}` | |`priorityClassName` | priorityClassName | `nil` | -| `nodeSelector` | | `{}` | +| `nodeSelector` | | `{}` | | `annotations` | | `{}` | | `tolerations` | | `[]` | | `affinity` | | `{}` | diff --git a/stable/filebeat/templates/daemonset.yaml b/stable/filebeat/templates/daemonset.yaml index 73b9c726b3..dfde8ce6c8 100644 --- a/stable/filebeat/templates/daemonset.yaml +++ b/stable/filebeat/templates/daemonset.yaml @@ -26,10 +26,23 @@ spec: checksum/secret: {{ toYaml .Values.config | sha256sum }} {{- if .Values.annotations }} {{ toYaml .Values.annotations | indent 8 }} -{{- end }} +{{- end }} spec: {{- if .Values.priorityClassName }} priorityClassName: "{{ .Values.priorityClassName }}" +{{- end }} +{{- if .Values.indexTemplateLoad }} + initContainers: + - name: "load-es-template" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: "Always" + command: + - /bin/bash + - -c + - filebeat setup --template + -E output.logstash.enabled=false + -E output.file.enabled=false + -E output.elasticsearch.hosts=[{{- range $index, $host := .Values.indexTemplateLoad }}{{ if $index }}, {{ end }}{{ $host | quote }}{{- end }}] {{- end }} containers: - name: {{ .Chart.Name }} diff --git a/stable/filebeat/values.yaml b/stable/filebeat/values.yaml index 777c6ef05e..d5fe4c6610 100644 --- a/stable/filebeat/values.yaml +++ b/stable/filebeat/values.yaml @@ -47,6 +47,12 @@ config: http.enabled: false http.port: 5066 +# Upload index template to Elasticsearch if Logstash output is enabled +# https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-template.html +# List of Elasticsearch hosts +indexTemplateLoad: [] + # - elasticsearch:9200 + # List of beat plugins plugins: [] # - kinesis.so