From 342b10f76b27715abc13c991619b83f850dcbe29 Mon Sep 17 00:00:00 2001
From: Nacho Barrientos <nacho.barrientos@cern.ch>
Date: Fri, 7 Mar 2025 13:29:51 +0100
Subject: [PATCH] Correct fluentbit's extraVolumes' indentation

---
 templates/fluentbit-logs/daemonset.yaml      |  2 +-
 templates/fluentbit-metrics/statefulset.yaml |  2 +-
 tests/fluentbit-logs/daemonset.yaml          | 12 +++++++++++-
 tests/fluentbit-metrics/statefulset.yaml     | 12 +++++++++++-
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/templates/fluentbit-logs/daemonset.yaml b/templates/fluentbit-logs/daemonset.yaml
index e384fc6..017c9d6 100644
--- a/templates/fluentbit-logs/daemonset.yaml
+++ b/templates/fluentbit-logs/daemonset.yaml
@@ -64,6 +64,6 @@ spec:
             path: /etc/machine-id
             type: File
       {{- if .Values.logs.fluentbit.extraVolumes }}
-        {{- toYaml .Values.logs.fluentbit.extraVolumes | nindent 4 }}
+        {{- toYaml .Values.logs.fluentbit.extraVolumes | nindent 8 }}
       {{- end }}
 {{- end -}}
diff --git a/templates/fluentbit-metrics/statefulset.yaml b/templates/fluentbit-metrics/statefulset.yaml
index 0cb8f8c..a967d76 100644
--- a/templates/fluentbit-metrics/statefulset.yaml
+++ b/templates/fluentbit-metrics/statefulset.yaml
@@ -59,6 +59,6 @@ spec:
           emptyDir:
             sizeLimit: {{ .Values.metrics.fluentbit.diskMaxCache }}
       {{- if .Values.metrics.fluentbit.extraVolumes }}
-        {{- toYaml .Values.metrics.fluentbit.extraVolumes | nindent 4 }}
+        {{- toYaml .Values.metrics.fluentbit.extraVolumes | nindent 8 }}
       {{- end }}
 {{- end }}
diff --git a/tests/fluentbit-logs/daemonset.yaml b/tests/fluentbit-logs/daemonset.yaml
index d16a653..e493ee1 100644
--- a/tests/fluentbit-logs/daemonset.yaml
+++ b/tests/fluentbit-logs/daemonset.yaml
@@ -36,16 +36,26 @@ tests:
           apiVersion: "apps/v1"
           name: it-monit-logs-collector-fluentbit
         not: true
-  - it: should deploy extra volume mounts if configured
+  - it: should deploy extra volumes and volume mounts if configured
     set:
       logs.enabled: true
       logs.fluentbit.enabled: true
       logs.fluentbit.extraVolumeMounts:
         - name: test
           mountPath: /test
+      logs.fluentbit.extraVolumes:
+        - name: test
+          configMap:
+            name: test-configmap
     asserts:
       - contains:
           path: spec.template.spec.containers[0].volumeMounts
           content:
             name: test
             mountPath: /test
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: test
+            configMap:
+              name: test-configmap
diff --git a/tests/fluentbit-metrics/statefulset.yaml b/tests/fluentbit-metrics/statefulset.yaml
index 597d557..b5fdafd 100644
--- a/tests/fluentbit-metrics/statefulset.yaml
+++ b/tests/fluentbit-metrics/statefulset.yaml
@@ -27,16 +27,26 @@ tests:
           apiVersion: "apps/v1"
           name: it-monit-metrics-collector-fluentbit
         not: true
-  - it: should deploy extra volume mounts if configured
+  - it: should deploy extra volumes and volume mounts if configured
     set:
       metrics.enabled: true
       metrics.fluentbit.enabled: true
       metrics.fluentbit.extraVolumeMounts:
         - name: test
           mountPath: /test
+      metrics.fluentbit.extraVolumes:
+        - name: test
+          configMap:
+            name: test-configmap
     asserts:
       - contains:
           path: spec.template.spec.containers[0].volumeMounts
           content:
             name: test
             mountPath: /test
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: test
+            configMap:
+              name: test-configmap
-- 
GitLab