1 From 33fc3cb13670c8e76e7a93455865c81b9f13b0e0 Mon Sep 17 00:00:00 2001
2 From: Kevin Smith <kevin.smith@windriver.com>
3 Date: Tue, 3 Sep 2019 10:43:50 -0400
4 Subject: [PATCH 1/1] ipv6 helm chart changes
7 .../elasticsearch/templates/client-deployment.yaml | 2 +-
8 .../elasticsearch/templates/data-statefulset.yaml | 2 +-
9 .../templates/master-statefulset.yaml | 2 +-
10 stable/filebeat/templates/configmap.yaml | 47 +++++++++++++++++-----
11 stable/filebeat/templates/daemonset.yaml | 21 ++++++++++
12 stable/metricbeat/templates/configmap.yaml | 47 +++++++++++++++++-----
13 stable/metricbeat/templates/daemonset.yaml | 21 ++++++++++
14 7 files changed, 119 insertions(+), 23 deletions(-)
16 diff --git a/stable/elasticsearch/templates/client-deployment.yaml b/stable/elasticsearch/templates/client-deployment.yaml
17 index 047e3c8..5625ee0 100644
18 --- a/stable/elasticsearch/templates/client-deployment.yaml
19 +++ b/stable/elasticsearch/templates/client-deployment.yaml
20 @@ -102,7 +102,7 @@ spec:
24 - value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.client.heapSize }} -Xmx{{ .Values.client.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.client.additionalJavaOpts }}"
25 + value: "-Djava.net.preferIPv6Addresses=true -Xms{{ .Values.client.heapSize }} -Xmx{{ .Values.client.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.client.additionalJavaOpts }}"
26 {{- range $key, $value := .Values.cluster.env }}
28 value: {{ $value | quote }}
29 diff --git a/stable/elasticsearch/templates/data-statefulset.yaml b/stable/elasticsearch/templates/data-statefulset.yaml
30 index a407803..44b6be1 100644
31 --- a/stable/elasticsearch/templates/data-statefulset.yaml
32 +++ b/stable/elasticsearch/templates/data-statefulset.yaml
33 @@ -120,7 +120,7 @@ spec:
37 - value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.data.heapSize }} -Xmx{{ .Values.data.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.data.additionalJavaOpts }}"
38 + value: "-Djava.net.preferIPv6Addresses=true -Xms{{ .Values.data.heapSize }} -Xmx{{ .Values.data.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.data.additionalJavaOpts }}"
39 {{- range $key, $value := .Values.cluster.env }}
41 value: {{ $value | quote }}
42 diff --git a/stable/elasticsearch/templates/master-statefulset.yaml b/stable/elasticsearch/templates/master-statefulset.yaml
43 index 048535c..7c48fe3 100644
44 --- a/stable/elasticsearch/templates/master-statefulset.yaml
45 +++ b/stable/elasticsearch/templates/master-statefulset.yaml
46 @@ -124,7 +124,7 @@ spec:
50 - value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.master.heapSize }} -Xmx{{ .Values.master.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.master.additionalJavaOpts }}"
51 + value: "-Djava.net.preferIPv6Addresses=true -Xms{{ .Values.master.heapSize }} -Xmx{{ .Values.master.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.master.additionalJavaOpts }}"
52 {{- range $key, $value := .Values.cluster.env }}
54 value: {{ $value | quote }}
55 diff --git a/stable/filebeat/templates/configmap.yaml b/stable/filebeat/templates/configmap.yaml
56 index c895965..9433176 100644
57 --- a/stable/filebeat/templates/configmap.yaml
58 +++ b/stable/filebeat/templates/configmap.yaml
59 @@ -10,8 +10,41 @@ metadata:
64 + # This is best effort to load the template into elasticsearch
65 + # if beats are going to elasticsearch via logstash.
68 BEAT_VER=$($BEAT version | awk '{print $3}')
70 + ADDR=$OUTPUT_ELASTICSEARCH_HOSTS
73 + # Check if this is a map of entries. If so, we'll only export the template
74 + # to the first address
75 + if [[ ${ADDR:0:1} == [ ]]; then
76 + # Remove the square brackets
78 + # Take the first entry in case there are more than one
83 + # Check if user has formatted with http:// on front, if not we need to add
85 + if [[ ${ADDR} == http* ]]; then
90 + # Check for ip address containing special characters where -g must be used in curl command
91 + # IPV6 Addresses should come in with square braces around the address.
93 + if [[ ${ADDR} == *[* ]]; then
98 # check if logstash output is enabled, via crude parsing of the .yml file.
99 sed -e '/output.logstash/,/enabled:/!d' ${BEAT}.yml | grep -i true
100 if [[ $? -eq 0 ]]; then
101 @@ -20,15 +53,9 @@ data:
102 # remove the lifecycle section of the yaml, as elasticsearch will choke
103 # on it as oss version does not support ilm.
104 sed -i '/lifecycle/,+3d' /tmp/beat.template.json
105 - 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
106 - # prime the index as a write index
107 - curl -XPUT -H "Content-Type: application/json" -d "{
109 - \"{BEAT}-{$BEAT_VER}\": {
110 - \"is_write_index\": \"true\"
113 - }" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/{$BEAT}-{$BEAT_VER}-000001
114 + curl -v $CURL_G -XPUT -H "Content-Type: application/json" $HTTP$ADDR/_template/$BEAT-$BEAT_VER -d@/tmp/beat.template.json
116 - echo "logstash not configured, not exporting template, should be done for us."
117 + echo "logstash not configured, not exporting template, should be done for us."
119 + # Above is non-fatal if there is a problem. Always pass.
121 diff --git a/stable/filebeat/templates/daemonset.yaml b/stable/filebeat/templates/daemonset.yaml
122 index 00a5519..b8536fb 100644
123 --- a/stable/filebeat/templates/daemonset.yaml
124 +++ b/stable/filebeat/templates/daemonset.yaml
125 @@ -53,6 +53,17 @@ spec:
126 mountPath: /usr/share/filebeat/filebeat.yml
128 subPath: filebeat.yml
130 + ## make output.elasticsearch parms visible
131 + {{- range $key, $value := .Values.config}}
132 + {{- $configname := $key | upper | replace "." "_" -}}
133 + {{ if eq $configname "OUTPUT_ELASTICSEARCH" -}}
134 + {{- range $key2, $value2 := $value}}
135 + - name: "{{ $configname }}_{{ $key2 | upper }}"
136 + value: {{ $value2 | quote }}
140 {{- if .Values.indexTemplateLoad }}
141 - name: "load-es-template"
142 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
143 @@ -95,6 +106,16 @@ spec:
146 fieldPath: spec.nodeName
147 + ## make output.elasticsearch parms visible
148 + {{- range $key, $value := .Values.config}}
149 + {{- $configname := $key | upper | replace "." "_" -}}
150 + {{ if eq $configname "OUTPUT_ELASTICSEARCH" -}}
151 + {{- range $key2, $value2 := $value}}
152 + - name: "{{ $configname }}_{{ $key2 | upper }}"
153 + value: {{ $value2 | quote }}
157 {{- if .Values.extraVars }}
158 {{ toYaml .Values.extraVars | indent 8 }}
160 diff --git a/stable/metricbeat/templates/configmap.yaml b/stable/metricbeat/templates/configmap.yaml
161 index 21890b4..f990f0c 100644
162 --- a/stable/metricbeat/templates/configmap.yaml
163 +++ b/stable/metricbeat/templates/configmap.yaml
164 @@ -10,8 +10,41 @@ metadata:
169 + # This is best effort to load the template into elasticsearch
170 + # if beats are going to elasticsearch via logstash.
173 BEAT_VER=$($BEAT version | awk '{print $3}')
175 + ADDR=$OUTPUT_ELASTICSEARCH_HOSTS
178 + # Check if this is a map of entries. If so, we'll only export the template
179 + # to the first address
180 + if [[ ${ADDR:0:1} == [ ]]; then
181 + # Remove the square brackets
183 + # Take the first entry in case there are more than one
188 + # Check if user has formatted with http:// on front, if not we need to add
190 + if [[ ${ADDR} == http* ]]; then
195 + # Check for ip address containing special characters where -g must be used in curl command
196 + # IPV6 Addresses should come in with square braces around the address.
198 + if [[ ${ADDR} == *[* ]]; then
203 # check if logstash output is enabled, via crude parsing of the .yml file.
204 sed -e '/output.logstash/,/enabled:/!d' ${BEAT}.yml | grep -i true
205 if [[ $? -eq 0 ]]; then
206 @@ -20,15 +53,9 @@ data:
207 # remove the lifecycle section of the yaml, as elasticsearch will choke
208 # on it as oss version does not support ilm.
209 sed -i '/lifecycle/,+3d' /tmp/beat.template.json
210 - 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
211 - # prime the index as a write index
212 - curl -XPUT -H "Content-Type: application/json" -d "{
214 - \"{BEAT}-{$BEAT_VER}\": {
215 - \"is_write_index\": \"true\"
218 - }" http://{$STX_ELASTICSEARCH_CLIENT_SERVICE_HOST}:{$STX_ELASTICSEARCH_CLIENT_SERVICE_PORT_HTTP}/{$BEAT}-{$BEAT_VER}-000001
219 + curl -v $CURL_G -XPUT -H "Content-Type: application/json" $HTTP$ADDR/_template/$BEAT-$BEAT_VER -d@/tmp/beat.template.json
221 - echo "logstash not configured, not exporting template, should be done for us."
222 + echo "logstash not configured, not exporting template, should be done for us."
224 + # Above is non-fatal if there is a problem. Always pass.
226 diff --git a/stable/metricbeat/templates/daemonset.yaml b/stable/metricbeat/templates/daemonset.yaml
227 index e3d7437..1ae3a34 100644
228 --- a/stable/metricbeat/templates/daemonset.yaml
229 +++ b/stable/metricbeat/templates/daemonset.yaml
230 @@ -49,6 +49,17 @@ spec:
232 subPath: metricbeat.yml
234 + ## make output.elasticsearch parms visible
235 + {{- range $key, $value := .Values.daemonset.config}}
236 + {{- $configname := $key | upper | replace "." "_" -}}
237 + {{ if eq $configname "OUTPUT_ELASTICSEARCH" -}}
238 + {{- range $key2, $value2 := $value}}
239 + - name: "{{ $configname }}_{{ $key2 | upper }}"
240 + value: {{ $value2 | quote }}
246 - name: {{ .Chart.Name }}
247 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
248 @@ -73,6 +84,16 @@ spec:
251 fieldPath: spec.nodeName
252 + ## make output.elasticsearch parms visible
253 + {{- range $key, $value := .Values.daemonset.config}}
254 + {{- $configname := $key | upper | replace "." "_" -}}
255 + {{ if eq $configname "OUTPUT_ELASTICSEARCH" -}}
256 + {{- range $key2, $value2 := $value}}
257 + - name: "{{ $configname }}_{{ $key2 | upper }}"
258 + value: {{ $value2 | quote }}
262 {{- if .Values.extraEnv }}
263 {{ toYaml .Values.extraEnv | indent 8 }}