[bitnami/logstash] Add persistence and volumePermissions (#6284)

* [bitnami/logstash] Add persistence and volumePermissions

* Chart version bump

* Chart fix linting

* Apply suggestions

* Add persistence section

* Update bitnami/logstash/README.md

Co-authored-by: Juan Ariza Toledano <juanariza@vmware.com>

* [bitnami/logstash] Update components versions

Signed-off-by: Bitnami Containers <containers@bitnami.com>

Co-authored-by: Juan Ariza Toledano <juanariza@vmware.com>
Co-authored-by: Bitnami Containers <containers@bitnami.com>
This commit is contained in:
Miguel Ruiz
2021-05-08 03:59:40 +02:00
committed by GitHub
parent f599e61cd3
commit f777de217f
5 changed files with 163 additions and 4 deletions

View File

@@ -62,3 +62,10 @@ logstash: metrics
Please enable the Montoring API (--set enableMonitoringAPI="true")
{{- end -}}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "logstash.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}

View File

@@ -49,6 +49,29 @@ spec:
runAsUser: {{ .Values.securityContext.runAsUser }}
fsGroup: {{ .Values.securityContext.fsGroup }}
{{- end }}
{{- if or (and .Values.securityContext.enabled .Values.volumePermissions.enabled .Values.persistence.enabled) (.Values.initContainers) }}
initContainers:
{{- if and .Values.securityContext.enabled .Values.volumePermissions.enabled }}
- name: volume-permissions
image: {{ include "logstash.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} "{{ .Values.persistence.mountPath }}"
securityContext: {{ .Values.volumePermissions.securityContext | toYaml | nindent 12 }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: logstash
image: {{ include "logstash.image" . }}
@@ -66,6 +89,10 @@ spec:
value: {{ ternary "yes" "no" .Values.enableMonitoringAPI | quote }}
- name: LOGSTASH_API_PORT_NUMBER
value: {{ .Values.monitoringAPIPort | quote }}
{{- if .Values.persistence.enabled }}
- name: LOGSTASH_DATA_DIR
value: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
@@ -91,6 +118,10 @@ spec:
resources: {{- toYaml .Values.resources | nindent 12 }}
{{- end }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if or .Values.input .Values.filter .Values.output .Values.existingConfiguration }}
- name: configurations
mountPath: /bitnami/logstash/config
@@ -128,6 +159,28 @@ spec:
configMap:
name: {{ include "logstash.configmapName" . }}
{{- end }}
{{- if and .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" .) }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{ include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) }}
{{- end }}