Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[Metricbeat] Dont generate config if not enabled #767

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions metricbeat/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
{{- end -}}
{{- end -}}

{{- if .Values.daemonset.metricbeatConfig }}
{{- if and .Values.daemonset.enabled .Values.daemonset.metricbeatConfig }}
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -34,7 +34,7 @@ data:
{{- end -}}
{{- end -}}

{{- if .Values.deployment.metricbeatConfig }}
{{- if and .Values.deployment.enabled .Values.deployment.metricbeatConfig }}
---
apiVersion: v1
kind: ConfigMap
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/tests/metricbeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,11 @@ def test_disable_daemonset():
enabled: false
"""
r = helm_template(config)
cfg = r["configmap"]

assert name not in r.get("daemonset", {})
assert name + "-daemonset-config" not in cfg
assert name + "-deployment-config" in cfg


def test_disable_deployment():
Expand All @@ -1189,8 +1192,11 @@ def test_disable_deployment():
enabled: false
"""
r = helm_template(config)
cfg = r["configmap"]

assert name + "-metrics" not in r.get("deployment", {})
assert name + "-daemonset-config" in cfg
assert name + "-deployment-config" not in cfg


def test_do_not_install_kube_stat_metrics():
Expand Down