From 9b0d7d1609c76731bd440ee98daf1f465a18e177 Mon Sep 17 00:00:00 2001 From: forselli-stratio <41321889+forselli-stratio@users.noreply.github.com> Date: Wed, 16 Dec 2020 10:05:04 +0100 Subject: [PATCH] [bitnami/fluentd] Allow to configure persistence for forwarders (#4725) --- bitnami/fluentd/Chart.yaml | 2 +- bitnami/fluentd/README.md | 2 ++ bitnami/fluentd/templates/forwarder-daemonset.yaml | 12 ++++++++++++ bitnami/fluentd/values-production.yaml | 13 +++++++++++++ bitnami/fluentd/values.yaml | 14 ++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/bitnami/fluentd/Chart.yaml b/bitnami/fluentd/Chart.yaml index 605796ede4..1c2d5f17d3 100644 --- a/bitnami/fluentd/Chart.yaml +++ b/bitnami/fluentd/Chart.yaml @@ -25,4 +25,4 @@ name: fluentd sources: - https://github.com/bitnami/bitnami-docker-fluentd - https://www.fluentd.org/ -version: 3.1.2 +version: 3.2.0 diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md index b8218911fd..8cf1bba401 100644 --- a/bitnami/fluentd/README.md +++ b/bitnami/fluentd/README.md @@ -84,6 +84,8 @@ The following tables lists the configurable parameters of the fluentd chart and | `forwarder.service.loadBalancerSourceRanges` | Addresses that are allowed when service is LoadBalancer | `[]` | | `forwarder.service.clusterIP` | Static clusterIP or None for headless services | `nil` | | `forwarder.service.annotations` | Annotations for the forwarder service | `{}` | +| `forwarder.persistence.enabled` | Enable persistence volume for the forwarder | `false` | +| `forwarder.persistence.hostPath.path` | Directory from the host node's filesystem to mount as hostPath volume for persistence. | `false` | | `forwarder.livenessProbe.enabled` | Enable liveness probes for the forwarder | `true` | | `forwarder.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | | `forwarder.livenessProbe.periodSeconds` | How often to perform the probe | `10` | diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 78fb263908..074469794c 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -111,8 +111,13 @@ spec: volumeMounts: - name: fluentd-config mountPath: /opt/bitnami/fluentd/conf + {{- if .Values.forwarder.persistence.enabled }} + - name: fluentd-buffer + mountPath: /opt/bitnami/fluentd/logs/buffers + {{- else }} - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers + {{- end }} {{- if .Values.tls.enabled }} - name: certs mountPath: /opt/bitnami/fluentd/certs @@ -145,8 +150,15 @@ spec: - name: fluentd-config configMap: name: {{ template "fluentd.forwarder.configMap" . }} + {{- if .Values.forwarder.persistence.enabled }} + - name: fluentd-buffer + hostPath: + path: {{ .Values.forwarder.persistence.hostPath.path }} + type: DirectoryOrCreate + {{- else }} - name: buffer emptyDir: {} + {{- end }} - name: varlog hostPath: path: /var/log diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml index fa44728f08..96b9a9fa32 100644 --- a/bitnami/fluentd/values-production.yaml +++ b/bitnami/fluentd/values-production.yaml @@ -284,6 +284,19 @@ forwarder: create: true pspEnabled: true + ## Persist data to a persistent volume + persistence: + enabled: true + ## If persistence enabled, a hostPath volume mounts a directory of your choice from the host node's filesystem into your Pod. + ## The host directory you chose is mounted into /opt/bitnami/fluentd/logs/buffers in your Pod + ## Example use case: mount host directory /tmp/buffer (if the directory doesn't exist, it creates it) into forwarder pod. + ## persistence: + ## enabled: true + ## hostPath: + ## path: /tmp/buffer + hostPath: + path: /opt/bitnami/fluentd/logs/buffers + ## Add init containers to forwarder pods ## For example: ## initContainers: diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 2e274a4a63..411a8e25f6 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -291,6 +291,20 @@ forwarder: ## image: your-image ## imagePullPolicy: Always ## + + ## Persist data to a persistent volume + persistence: + enabled: false + ## If persistence enabled, a hostPath volume mounts a directory of your choice from the host node's filesystem into your Pod. + ## The host directory you chose is mounted into /opt/bitnami/fluentd/logs/buffers in your Pod + ## Example use case: mount host directory /tmp/buffer (if the directory doesn't exist, it creates it) into forwarder pod. + ## persistence: + ## enabled: true + ## hostPath: + ## path: /tmp/buffer + hostPath: + path: /opt/bitnami/fluentd/logs/buffers + initContainers: [] ## Add sidecars to forwarder pods