From 97477f28bd16f776d6324f700c4d94cacc73e408 Mon Sep 17 00:00:00 2001 From: nr-rkallempudi Date: Wed, 17 Jul 2024 20:11:21 +0530 Subject: [PATCH] [newrelic-logging] Update Docs: "fluentBit.k8sLoggingExclude" needs to be 'true' and not 'On' (#1426) #### Is this a new chart No. It is an existing chart named newrelic-logging #### What this PR does / why we need it: Template is failing to generate valid YAML file if there are multiple pod labels #### Which issue this PR fixes *(optional, in `fixes #(, fixes #, ...)` format, will close that issue when PR gets merged)* - fixes #1312 #### Special notes for your reviewer: Tested scenarios with following values and observed results in compiled yaml file: fluentBit.k8sLoggingExclude: off -> false fluentBit.k8sLoggingExclude: on -> true fluentBit.k8sLoggingExclude: true -> true fluentBit.k8sLoggingExclude: false -> false Not having the attribute fluentBit.k8sLoggingExclude -> false #### Checklist [Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.] - [x] Chart Version bumped - [x] Variables are documented in the README.md - [x] Title of the PR starts with chart name (e.g. `[mychartname]`) --- charts/newrelic-logging/Chart.lock | 6 +-- charts/newrelic-logging/Chart.yaml | 4 +- charts/newrelic-logging/README.md | 2 +- .../templates/daemonset-windows.yaml | 2 +- .../newrelic-logging/templates/daemonset.yaml | 2 +- .../fluentbit_k8logging_exclude_test.yaml | 45 +++++++++++++++++++ charts/newrelic-logging/values.yaml | 2 +- 7 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 charts/newrelic-logging/tests/fluentbit_k8logging_exclude_test.yaml diff --git a/charts/newrelic-logging/Chart.lock b/charts/newrelic-logging/Chart.lock index 339365e43..064abf8aa 100644 --- a/charts/newrelic-logging/Chart.lock +++ b/charts/newrelic-logging/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common-library repository: https://helm-charts.newrelic.com - version: 1.1.1 -digest: sha256:3c9053021f3c22aa3cdfc6781d3498bcbedb0b973af9121b1722469744fb5162 -generated: "2023-03-21T22:34:27.606266389Z" + version: 1.2.0 +digest: sha256:fa87cb007564a39a72739a3e850a91d6b03c0fc27a1115deac042b3ef77b4142 +generated: "2024-07-17T19:29:15.951407+05:30" diff --git a/charts/newrelic-logging/Chart.yaml b/charts/newrelic-logging/Chart.yaml index eef40e9e9..df24625d3 100644 --- a/charts/newrelic-logging/Chart.yaml +++ b/charts/newrelic-logging/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: A Helm chart to deploy New Relic Kubernetes Logging as a DaemonSet, supporting both Linux and Windows nodes and containers name: newrelic-logging -version: 1.22.2 +version: 1.22.3 appVersion: 2.0.0 home: https://github.com/newrelic/kubernetes-logging icon: https://newrelic.com/assets/newrelic/source/NewRelic-logo-square.svg @@ -15,5 +15,5 @@ keywords: - newrelic dependencies: - name: common-library - version: 1.1.1 + version: 1.2.0 repository: "https://helm-charts.newrelic.com" diff --git a/charts/newrelic-logging/README.md b/charts/newrelic-logging/README.md index c3ee9874f..2f7e4e853 100644 --- a/charts/newrelic-logging/README.md +++ b/charts/newrelic-logging/README.md @@ -149,7 +149,7 @@ See [values.yaml](values.yaml) for the default values | `fluentBit.linuxMountPath` | The path mounted on linux Fluent-Bit pods to read logs from. Defaults to /var because some engines write the logs to /var/log and others to /var/lib (symlinked to /var/log) so Fluent-Bit need access to both in those cases | `/var` | | `fluentBit.db` | Node path used by Fluent Bit to store a database file to keep track of monitored files and offsets. | `/var/log/containers/*.log` | | `fluentBit.k8sBufferSize` | Set the buffer size for HTTP client when reading responses from Kubernetes API server. A value of 0 results in no limit and the buffer will expand as needed. | `32k` | -| `fluentBit.k8sLoggingExclude` | Set to "On" to allow excluding pods by adding the annotation `fluentbit.io/exclude: "true"` to pods you wish to exclude. | `Off` | +| `fluentBit.k8sLoggingExclude` | Set to "true" to allow excluding pods by adding the annotation `fluentbit.io/exclude: "true"` to pods you wish to exclude. | `false` | | `fluentBit.additionalEnvVariables` | Additional environmental variables for fluentbit pods | `[]]` | | `fluentBit.persistence.mode` | The [persistence mode](#Fluent-Bit-persistence-modes) you want to use, options are "hostPath", "none" or "persistentVolume" (this last one available only for linux) | | `fluentBit.persistence.persistentVolume.storageClass` | On "persistentVolume" [persistence mode](#Fluent-Bit-persistence-modes), indicates the storage class that will be used for create the PersistentVolume and PersistentVolumeClaim. | | diff --git a/charts/newrelic-logging/templates/daemonset-windows.yaml b/charts/newrelic-logging/templates/daemonset-windows.yaml index 754c1f79d..a4a9e08fc 100644 --- a/charts/newrelic-logging/templates/daemonset-windows.yaml +++ b/charts/newrelic-logging/templates/daemonset-windows.yaml @@ -95,7 +95,7 @@ spec: - name: K8S_BUFFER_SIZE value: {{ $.Values.fluentBit.k8sBufferSize | quote }} - name: K8S_LOGGING_EXCLUDE - value: {{ $.Values.fluentBit.k8sLoggingExclude | quote }} + value: {{ $.Values.fluentBit.k8sLoggingExclude | default "false" | quote }} - name: LOW_DATA_MODE value: {{ include "newrelic-logging.lowDataMode" $ | default "false" | quote }} - name: RETRY_LIMIT diff --git a/charts/newrelic-logging/templates/daemonset.yaml b/charts/newrelic-logging/templates/daemonset.yaml index 311159100..1bc779a99 100644 --- a/charts/newrelic-logging/templates/daemonset.yaml +++ b/charts/newrelic-logging/templates/daemonset.yaml @@ -108,7 +108,7 @@ spec: - name: K8S_BUFFER_SIZE value: {{ .Values.fluentBit.k8sBufferSize | quote }} - name: K8S_LOGGING_EXCLUDE - value: {{ .Values.fluentBit.k8sLoggingExclude | quote }} + value: {{ .Values.fluentBit.k8sLoggingExclude | default "false" | quote }} - name: LOW_DATA_MODE value: {{ include "newrelic-logging.lowDataMode" . | default "false" | quote }} - name: RETRY_LIMIT diff --git a/charts/newrelic-logging/tests/fluentbit_k8logging_exclude_test.yaml b/charts/newrelic-logging/tests/fluentbit_k8logging_exclude_test.yaml new file mode 100644 index 000000000..446f829b0 --- /dev/null +++ b/charts/newrelic-logging/tests/fluentbit_k8logging_exclude_test.yaml @@ -0,0 +1,45 @@ +suite: test fluent-bit exclude logging +templates: + - templates/daemonset.yaml + - templates/configmap.yaml + - templates/persistentvolume.yaml +release: + name: my-release + namespace: my-namespace +tests: + - it: K8S_LOGGING_EXCLUDE set true + templates: + - templates/daemonset.yaml + set: + licenseKey: nr_license_key + fluentBit: + k8sLoggingExclude: true + asserts: + - equal: + path: spec.template.spec.containers[0].env[?(@.name=="K8S_LOGGING_EXCLUDE")].value + value: "true" + template: templates/daemonset.yaml + - it: K8S_LOGGING_EXCLUDE set false + templates: + - templates/daemonset.yaml + set: + licenseKey: nr_license_key + fluentBit: + k8sLoggingExclude: false + asserts: + - equal: + path: spec.template.spec.containers[0].env[?(@.name=="K8S_LOGGING_EXCLUDE")].value + value: "false" + template: templates/daemonset.yaml + - it: K8S_LOGGING_EXCLUDE set value xyz and expect it to be set + templates: + - templates/daemonset.yaml + set: + licenseKey: nr_license_key + fluentBit: + k8sLoggingExclude: xyz + asserts: + - equal: + path: spec.template.spec.containers[0].env[?(@.name=="K8S_LOGGING_EXCLUDE")].value + value: "xyz" + template: templates/daemonset.yaml diff --git a/charts/newrelic-logging/values.yaml b/charts/newrelic-logging/values.yaml index e411705d7..991f9ee9c 100644 --- a/charts/newrelic-logging/values.yaml +++ b/charts/newrelic-logging/values.yaml @@ -33,7 +33,7 @@ fluentBit: windowsDb: "C:\\var\\log\\flb_kube.db" criEnabled: true k8sBufferSize: "32k" - k8sLoggingExclude: "Off" + k8sLoggingExclude: "false" retryLimit: 5 sendMetrics: false extraEnv: []