@@ -7,6 +7,7 @@ metadata:
7
7
{{- with .Values.graylog.customLabels }}
8
8
{{ . | toYaml | indent 4 }}
9
9
{{- end }}
10
+ {{ $graylogVersion := .Values.graylog.image.tag | default .Chart.AppVersion }}
10
11
spec :
11
12
serviceName : {{ template "graylog.service.headless.name" . }}
12
13
replicas : {{ .Values.graylog.replicas }}
74
75
rm -rf /usr/share/graylog/data/journal/messagejournal-0
75
76
rm -rf /usr/share/graylog/data/journal/recovery-point-offset-checkpoint
76
77
{{- end }}
77
- {{- if .Values.graylog.init.kubectlLocation }}
78
- wget {{ .Values.graylog.init.kubectlLocation }} -O /k8s/kubectl
79
- {{- else }}
80
- {{.Capabilities.KubeVersion}}
81
- wget https://dl.k8s.io/release/{{ .Values.graylog.init.kubectlVersion | default (regexReplaceAll "-.+" .Capabilities.KubeVersion.Version "") }}/bin/linux/amd64/kubectl -O /k8s/kubectl
82
- {{- end }}
83
- chmod +x /k8s/kubectl
84
-
85
78
GRAYLOG_HOME=/usr/share/graylog
86
79
chown -R 1100:1100 ${GRAYLOG_HOME}/data/
87
80
securityContext :
94
87
volumeMounts :
95
88
- name : journal
96
89
mountPath : /usr/share/graylog/data/journal
97
- - name : kubectl
98
- mountPath : /k8s
99
90
{{- if .Values.graylog.init.resources }}
100
91
resources :
101
92
{{ toYaml .Values.graylog.init.resources | indent 12 }}
@@ -110,6 +101,12 @@ spec:
110
101
command :
111
102
- /entrypoint.sh
112
103
env :
104
+ # Kubernetes Auto Master Selection
105
+ # https://go2docs.graylog.org/5-0/downloading_and_installing_graylog/docker_installation.htm#KubernetesAutomaticMasterSelection
106
+ - name : POD_NAME
107
+ valueFrom :
108
+ fieldRef :
109
+ fieldPath : metadata.name
113
110
- name : GRAYLOG_SERVER_JAVA_OPTS
114
111
{{- $javaOpts := .Values.graylog.javaOpts }}
115
112
{{- if .Values.graylog.heapSize }}
@@ -231,26 +228,21 @@ spec:
231
228
- name : files
232
229
mountPath : /etc/graylog/server
233
230
{{- end }}
234
- - name : kubectl
235
- mountPath : /k8s
231
+
236
232
{{- if .Values.graylog.extraVolumeMounts }}
237
233
{{ toYaml .Values.graylog.extraVolumeMounts | nindent 12 }}
238
234
{{- end }}
239
- {{ $graylogVersion := .Values.graylog.image.tag | default .Chart.AppVersion }}
240
- {{- if semverCompare "< 4.2.0-0" ( $graylogVersion ) }}
241
235
lifecycle :
242
236
preStop :
243
237
exec :
244
238
command :
245
239
- bash
246
240
- -ec
247
241
- |
248
- ROOT_PASSWORD=`/k8s/kubectl get secret {{ template "graylog.fullname" . }} -o "jsonpath={.data['graylog-password-secret']}" | base64 -d`
249
242
curl {{ if .Values.graylog.tls.enabled }}-k{{ end }} -XPOST -sS \
250
- -u "{{ .Values.graylog.rootUsername }}:${ROOT_PASSWORD }" \
243
+ -u "{{ .Values.graylog.rootUsername }}:${GRAYLOG_PASSWORD_SECRET }" \
251
244
-H "X-Requested-By: {{ template "graylog.fullname" . }}" \
252
245
{{ template "graylog.formatUrl" (list . "localhost:9000/api/system/shutdown/shutdown") }}
253
- {{- end }}
254
246
{{- if .Values.graylog.sidecarContainers }}
255
247
{{ toYaml .Values.graylog.sidecarContainers | nindent 8 }}
256
248
{{- end }}
@@ -278,8 +270,6 @@ spec:
278
270
configMap :
279
271
name : {{ template "graylog.fullname" . }}-files
280
272
{{- end }}
281
- - name : kubectl
282
- emptyDir : {}
283
273
{{- if .Values.graylog.extraVolumes }}
284
274
{{ toYaml .Values.graylog.extraVolumes | nindent 8 }}
285
275
{{- end }}
0 commit comments