Skip to content

Commit 7c0c973

Browse files
committed
avoid possible index error
1 parent fb0bf04 commit 7c0c973

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

graylog/templates/_helpers.tpl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,20 @@ Graylog External URI
304304
{{- if and .Values.graylog.config.tls.enabled .Values.graylog.config.tls.cn }}
305305
{{- $externalHost = .Values.graylog.config.tls.cn }}
306306
{{- $scheme = "https" }}
307-
{{- else if len .Values.ingress.web.tls | lt 0 | and .Values.ingress.web.enabled }}
308-
{{- $externalHost = index (index .Values.ingress.web.tls 0).hosts 0 }}
307+
{{- else if and .Values.ingress.enabled .Values.ingress.web.enabled .Values.ingress.web.tls }}
308+
{{- with .Values.ingress.web.tls }}
309+
{{- with (index . 0).hosts }}
310+
{{- $externalHost = index . 0 | default "" }}
311+
{{- end }}
312+
{{- end }}
309313
{{- $scheme = "https" }}
310314
{{- $port = "" }}
311-
{{- else if len .Values.ingress.web.hosts | lt 0 | and .Values.ingress.web.enabled }}
312-
{{- $externalHost = (index .Values.ingress.web.hosts 0).host }}
315+
{{- else if and .Values.ingress.enabled .Values.ingress.web.enabled .Values.ingress.web.hosts }}
316+
{{- with .Values.ingress.web.hosts }}
317+
{{- with (index . 0) }}
318+
{{- $externalHost = .host | default "" }}
319+
{{- end }}
320+
{{- end }}
313321
{{- $port = "" }}
314322
{{- else if eq .Values.graylog.custom.service.type "LoadBalancer" | and $svc $svc.status.loadBalancer }}
315323
{{- $lbName := index $svc.status.loadBalancer.ingress 0 }}

graylog/templates/config/graylog.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ data:
4646
GRAYLOG_HTTP_ENABLE_TLS: {{ .Values.graylog.config.tls.enabled | quote }}
4747
GRAYLOG_HTTP_TLS_CERT_FILE: "/usr/share/graylog/tls/tls.crt"
4848
GRAYLOG_HTTP_TLS_KEY_FILE: "/usr/share/graylog/tls/tls.key"
49-
{{- $externalUri := include "graylog.externalUri" . }}
50-
{{- if $externalUri }}
51-
GRAYLOG_HTTP_EXTERNAL_URI: {{ $externalUri | quote }}
49+
{{- with (include "graylog.externalUri" .) }}
50+
GRAYLOG_HTTP_EXTERNAL_URI: {{ . | quote }}
5251
{{- end -}}
5352
{{/* http_publish_uri is rendered directly on the PodSpec for each Graylog node based on $POD_NAME */}}
5453
# GRAYLOG_HTTP_PUBLISH_URI: ""

0 commit comments

Comments
 (0)