diff --git a/charts/graylog/templates/_helpers.tpl b/charts/graylog/templates/_helpers.tpl index 7467982..862f0af 100644 --- a/charts/graylog/templates/_helpers.tpl +++ b/charts/graylog/templates/_helpers.tpl @@ -53,11 +53,18 @@ app.kubernetes.io/name: {{ include "graylog.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{/* +Init script ConfigMap name +*/}} +{{- define "graylog.cm.init.name" }} +{{- include "graylog.fullname" . | printf "%s-init-cm" }} +{{- end }} + {{/* Service account name */}} -{{- define "graylog.serviceAccountName" -}} -{{ $defaultName := "default" }} +{{- define "graylog.serviceAccountName" }} +{{- $defaultName := "default" }} {{- if .Values.serviceAccount.create }} {{- $defaultName = include "graylog.fullname" . | printf "%s-sa" }} {{- end }} @@ -67,8 +74,8 @@ Service account name {{/* MongoDB service account name */}} -{{- define "graylog.mongodb.serviceAccountName" -}} -{{ $defaultName := "default" }} +{{- define "graylog.mongodb.serviceAccountName" }} +{{- $defaultName := "default" }} {{- if .Values.mongodb.serviceAccount.create }} {{- $defaultName = include "graylog.fullname" . | printf "%s-mongo-sa" }} {{- end }} diff --git a/charts/graylog/templates/config/init-graylog.yaml b/charts/graylog/templates/config/init-graylog.yaml index f35e887..475fc91 100644 --- a/charts/graylog/templates/config/init-graylog.yaml +++ b/charts/graylog/templates/config/init-graylog.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: init-script-cm + name: {{ include "graylog.cm.init.name" . }} data: init-script.sh: | #!/bin/sh diff --git a/charts/graylog/templates/policy/pdb/datanode.yaml b/charts/graylog/templates/policy/pdb/datanode.yaml index b88e0dc..06eb66d 100644 --- a/charts/graylog/templates/policy/pdb/datanode.yaml +++ b/charts/graylog/templates/policy/pdb/datanode.yaml @@ -1,9 +1,9 @@ {{- if .Values.datanode.podDisruptionBudget.enabled }} -{{- if include "graylog.datanode.replicas" . | int | lt 1 }} +{{- if ge (include "graylog.datanode.replicas" . | int) 1 }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: - name: graylog-datanode + name: {{ include "graylog.fullname" . | printf "%s-pdb-datanode" }} namespace: {{ .Release.Namespace }} labels: app: graylog-datanode @@ -13,5 +13,6 @@ spec: selector: matchLabels: app: graylog-datanode + {{- include "graylog.selectorLabels" . | nindent 6 }} {{- end }} {{- end }} diff --git a/charts/graylog/templates/policy/pdb/graylog.yaml b/charts/graylog/templates/policy/pdb/graylog.yaml index e0f1ca7..a0debcf 100644 --- a/charts/graylog/templates/policy/pdb/graylog.yaml +++ b/charts/graylog/templates/policy/pdb/graylog.yaml @@ -1,5 +1,5 @@ {{- if and .Values.graylog.enabled .Values.graylog.podDisruptionBudget.enabled }} -{{- if include "graylog.replicas" . | int | lt 2 }} +{{- if ge (include "graylog.replicas" . | int) 2 }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: @@ -13,5 +13,6 @@ spec: selector: matchLabels: app: graylog-app + {{- include "graylog.selectorLabels" . | nindent 6 }} {{- end }} {{- end }} diff --git a/charts/graylog/templates/service/datanode.yaml b/charts/graylog/templates/service/datanode.yaml index 92f169e..9c0b7e5 100644 --- a/charts/graylog/templates/service/datanode.yaml +++ b/charts/graylog/templates/service/datanode.yaml @@ -17,4 +17,5 @@ spec: port: {{ .Values.datanode.service.ports.config | default 9300 |int }} selector: app: graylog-datanode + {{- include "graylog.selectorLabels" . | nindent 4 }} {{ end }} diff --git a/charts/graylog/templates/service/graylog.yaml b/charts/graylog/templates/service/graylog.yaml index dbb443b..7c84e65 100644 --- a/charts/graylog/templates/service/graylog.yaml +++ b/charts/graylog/templates/service/graylog.yaml @@ -30,4 +30,5 @@ spec: protocol: TCP selector: app: graylog-app + {{- include "graylog.selectorLabels" . | nindent 4 }} {{- end }} diff --git a/charts/graylog/templates/service/ingress/graylog-forwarder.yaml b/charts/graylog/templates/service/ingress/graylog-forwarder.yaml index 72fb8ec..410292d 100644 --- a/charts/graylog/templates/service/ingress/graylog-forwarder.yaml +++ b/charts/graylog/templates/service/ingress/graylog-forwarder.yaml @@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: graylog-forwarder + name: {{ include "graylog.fullname" . | printf "%s-forwarder" }} labels: {{- include "graylog.labels" . | nindent 4 }} {{- with .Values.ingress.forwarder.annotations }} diff --git a/charts/graylog/templates/workload/statefulsets/graylog.yaml b/charts/graylog/templates/workload/statefulsets/graylog.yaml index 8bea0db..6a781d0 100644 --- a/charts/graylog/templates/workload/statefulsets/graylog.yaml +++ b/charts/graylog/templates/workload/statefulsets/graylog.yaml @@ -182,7 +182,7 @@ spec: volumes: - name: init-script configMap: - name: init-script-cm + name: {{ include "graylog.cm.init.name" . }} defaultMode: 0755 {{- if .Values.graylog.config.tls.enabled }} - name: tls-creds