1 From d22ad4870b78f74298189e383697ae6163ef49d7 Mon Sep 17 00:00:00 2001
2 From: Kevin Smith <kevin.smith@windriver.com>
3 Date: Wed, 17 Jul 2019 15:13:44 -0400
4 Subject: [PATCH 1/1] helm chart changes for stx monitor
7 stable/elasticsearch/values.yaml | 2 +-
8 stable/filebeat/templates/configmap.yaml | 34 ++++++++++++++++++++++++++++++
9 stable/filebeat/templates/daemonset.yaml | 15 +++++++++++++
10 stable/filebeat/values.yaml | 9 ++------
11 stable/kibana/values.yaml | 4 ++--
12 stable/logstash/templates/ingress.yaml | 2 +-
13 stable/logstash/templates/statefulset.yaml | 7 +++---
14 stable/logstash/values.yaml | 3 ++-
15 stable/metricbeat/templates/configmap.yaml | 34 ++++++++++++++++++++++++++++++
16 stable/metricbeat/templates/daemonset.yaml | 26 +++++++++++++++++++++++
17 stable/metricbeat/values.yaml | 4 ++--
18 11 files changed, 122 insertions(+), 18 deletions(-)
19 create mode 100755 stable/filebeat/templates/configmap.yaml
20 create mode 100755 stable/metricbeat/templates/configmap.yaml
22 diff --git a/stable/elasticsearch/values.yaml b/stable/elasticsearch/values.yaml
23 index bbc03dd..6dcd9b0 100644
24 --- a/stable/elasticsearch/values.yaml
25 +++ b/stable/elasticsearch/values.yaml
26 @@ -33,7 +33,7 @@ podSecurityPolicy:
29 repository: "docker.elastic.co/elasticsearch/elasticsearch-oss"
32 pullPolicy: "IfNotPresent"
33 # If specified, use these secrets to access the image
35 diff --git a/stable/filebeat/templates/configmap.yaml b/stable/filebeat/templates/configmap.yaml
37 index 0000000..c895965
39 +++ b/stable/filebeat/templates/configmap.yaml
44 + name: {{ template "filebeat.fullname" . }}
46 + app: {{ template "filebeat.fullname" . }}
47 + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
48 + release: "{{ .Release.Name }}"
49 + heritage: "{{ .Release.Service }}"
54 + BEAT_VER=$($BEAT version | awk '{print $3}')
55 + # check if logstash output is enabled, via crude parsing of the .yml file.
56 + sed -e '/output.logstash/,/enabled:/!d' ${BEAT}.yml | grep -i true
57 + if [[ $? -eq 0 ]]; then
58 + echo "logstash configured, exporting template to elasticsearch"
59 + $BEAT export template > /tmp/beat.template.json
60 + # remove the lifecycle section of the yaml, as elasticsearch will choke
61 + # on it as oss version does not support ilm.
62 + sed -i '/lifecycle/,+3d' /tmp/beat.template.json
63 + curl -XPUT -H "Content-Type: application/json" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/_template/{$BEAT}-{$BEAT_VER} -d@/tmp/beat.template.json
64 + # prime the index as a write index
65 + curl -XPUT -H "Content-Type: application/json" -d "{
67 + \"{BEAT}-{$BEAT_VER}\": {
68 + \"is_write_index\": \"true\"
71 + }" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/{$BEAT}-{$BEAT_VER}-000001
73 + echo "logstash not configured, not exporting template, should be done for us."
75 diff --git a/stable/filebeat/templates/daemonset.yaml b/stable/filebeat/templates/daemonset.yaml
76 index 2b8e265..00a5519 100644
77 --- a/stable/filebeat/templates/daemonset.yaml
78 +++ b/stable/filebeat/templates/daemonset.yaml
79 @@ -38,6 +38,21 @@ spec:
80 priorityClassName: "{{ .Values.priorityClassName }}"
83 + - name: "setup-script"
84 + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
85 + imagePullPolicy: {{ .Values.image.pullPolicy }}
89 + - /usr/share/filebeat/setup-script.sh
91 + - mountPath: /usr/share/filebeat/setup-script.sh
93 + subPath: setup-script.sh
94 + - name: filebeat-config
95 + mountPath: /usr/share/filebeat/filebeat.yml
97 + subPath: filebeat.yml
98 {{- if .Values.indexTemplateLoad }}
99 - name: "load-es-template"
100 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
101 diff --git a/stable/filebeat/values.yaml b/stable/filebeat/values.yaml
102 index 1907ffa..b4b766f 100644
103 --- a/stable/filebeat/values.yaml
104 +++ b/stable/filebeat/values.yaml
107 repository: docker.elastic.co/beats/filebeat-oss
110 pullPolicy: IfNotPresent
115 - # Mounted `filebeat-prospectors` configmap:
116 - path: ${path.config}/prospectors.d/*.yml
117 - # Reload prospectors configs as they change:
118 - reload.enabled: false
120 path: ${path.config}/modules.d/*.yml
121 # Reload module configs as they change:
122 @@ -18,7 +13,7 @@ config:
124 - add_cloud_metadata:
126 - filebeat.prospectors:
131 diff --git a/stable/kibana/values.yaml b/stable/kibana/values.yaml
132 index a3310f9..4ce4b2a 100644
133 --- a/stable/kibana/values.yaml
134 +++ b/stable/kibana/values.yaml
137 repository: "docker.elastic.co/kibana/kibana-oss"
140 pullPolicy: "IfNotPresent"
143 @@ -25,7 +25,7 @@ files:
144 ## Default Kibana configuration from kibana-docker.
147 - elasticsearch.url: http://elasticsearch:9200
148 + elasticsearch.hosts: http://elasticsearch:9200
150 ## Custom config properties below
151 ## Ref: https://www.elastic.co/guide/en/kibana/current/settings.html
152 diff --git a/stable/logstash/templates/ingress.yaml b/stable/logstash/templates/ingress.yaml
153 index d924504..0e26f89 100644
154 --- a/stable/logstash/templates/ingress.yaml
155 +++ b/stable/logstash/templates/ingress.yaml
156 @@ -33,6 +33,6 @@ spec:
157 - path: {{ $ingressPath }}
159 serviceName: {{ $fullName }}
164 diff --git a/stable/logstash/templates/statefulset.yaml b/stable/logstash/templates/statefulset.yaml
165 index d2bbc32..cca0050 100644
166 --- a/stable/logstash/templates/statefulset.yaml
167 +++ b/stable/logstash/templates/statefulset.yaml
168 @@ -25,11 +25,8 @@ spec:
169 {{ $key }}: {{ $value | quote }}
173 - checksum/patterns: {{ include (print $.Template.BasePath "/patterns-config.yaml") . | sha256sum }}
174 - checksum/templates: {{ include (print $.Template.BasePath "/files-config.yaml") . | sha256sum }}
175 - checksum/pipeline: {{ include (print $.Template.BasePath "/pipeline-config.yaml") . | sha256sum }}
176 {{- if .Values.podAnnotations }}
178 ## Custom pod annotations
179 {{- range $key, $value := .Values.podAnnotations }}
180 {{ $key }}: {{ $value | quote }}
181 @@ -46,6 +43,8 @@ spec:
183 {{ toYaml .Values.image.pullSecrets | indent 8 }}
186 + dnsPolicy: ClusterFirstWithHostNet
190 diff --git a/stable/logstash/values.yaml b/stable/logstash/values.yaml
191 index a9eb158..9a452b1 100644
192 --- a/stable/logstash/values.yaml
193 +++ b/stable/logstash/values.yaml
194 @@ -10,7 +10,7 @@ terminationGracePeriodSeconds: 30
197 repository: docker.elastic.co/logstash/logstash-oss
200 pullPolicy: IfNotPresent
201 ## Add secrets manually via kubectl on kubernetes cluster and reference here
203 @@ -67,6 +67,7 @@ ingress:
206 - logstash.cluster.local
209 # - secretName: logstash-tls
211 diff --git a/stable/metricbeat/templates/configmap.yaml b/stable/metricbeat/templates/configmap.yaml
213 index 0000000..21890b4
215 +++ b/stable/metricbeat/templates/configmap.yaml
220 + name: {{ template "metricbeat.fullname" . }}
222 + app: {{ template "metricbeat.fullname" . }}
223 + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
224 + release: "{{ .Release.Name }}"
225 + heritage: "{{ .Release.Service }}"
227 + setup-script.sh: |-
230 + BEAT_VER=$($BEAT version | awk '{print $3}')
231 + # check if logstash output is enabled, via crude parsing of the .yml file.
232 + sed -e '/output.logstash/,/enabled:/!d' ${BEAT}.yml | grep -i true
233 + if [[ $? -eq 0 ]]; then
234 + echo "logstash configured, exporting template to elasticsearch"
235 + $BEAT export template > /tmp/beat.template.json
236 + # remove the lifecycle section of the yaml, as elasticsearch will choke
237 + # on it as oss version does not support ilm.
238 + sed -i '/lifecycle/,+3d' /tmp/beat.template.json
239 + curl -XPUT -H "Content-Type: application/json" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/_template/{$BEAT}-{$BEAT_VER} -d@/tmp/beat.template.json
240 + # prime the index as a write index
241 + curl -XPUT -H "Content-Type: application/json" -d "{
243 + \"{BEAT}-{$BEAT_VER}\": {
244 + \"is_write_index\": \"true\"
247 + }" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/{$BEAT}-{$BEAT_VER}-000001
249 + echo "logstash not configured, not exporting template, should be done for us."
251 diff --git a/stable/metricbeat/templates/daemonset.yaml b/stable/metricbeat/templates/daemonset.yaml
252 index eadfb96..e3d7437 100644
253 --- a/stable/metricbeat/templates/daemonset.yaml
254 +++ b/stable/metricbeat/templates/daemonset.yaml
255 @@ -32,6 +32,23 @@ spec:
260 + - name: "setup-script"
261 + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
262 + imagePullPolicy: {{ .Values.image.pullPolicy }}
266 + - /usr/share/metricbeat/setup-script.sh
268 + - mountPath: /usr/share/metricbeat/setup-script.sh
270 + subPath: setup-script.sh
272 + mountPath: /usr/share/metricbeat/metricbeat.yml
274 + subPath: metricbeat.yml
277 - name: {{ .Chart.Name }}
278 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
279 @@ -62,6 +79,7 @@ spec:
284 {{- if .Values.daemonset.resources }}
285 {{ toYaml .Values.daemonset.resources | indent 10 }}
286 {{- else if .Values.resources }}
287 @@ -85,6 +103,10 @@ spec:
290 mountPath: /var/run/docker.sock
291 +#Mount the script so we can see it from running containter
292 + - mountPath: /usr/share/metricbeat/setup-script.sh
294 + subPath: setup-script.sh
295 {{- if .Values.extraVolumeMounts }}
296 {{ toYaml .Values.extraVolumeMounts | indent 8 }}
298 @@ -108,6 +130,10 @@ spec:
301 path: /var/run/docker.sock
302 + - name: setupscript
304 + name: {{ template "metricbeat.fullname" . }}
306 {{- if .Values.extraVolumes }}
307 {{ toYaml .Values.extraVolumes | indent 6 }}
309 diff --git a/stable/metricbeat/values.yaml b/stable/metricbeat/values.yaml
310 index 5094639..2908a1b 100644
311 --- a/stable/metricbeat/values.yaml
312 +++ b/stable/metricbeat/values.yaml
315 - repository: docker.elastic.co/beats/metricbeat
317 + repository: docker.elastic.co/beats/metricbeat-oss
319 pullPolicy: IfNotPresent
321 # The instances created by daemonset retrieve most metrics from the host