diff --git a/metricbeat/templates/configmap.yaml b/metricbeat/templates/configmap.yaml index 54183db1b..1272402b5 100644 --- a/metricbeat/templates/configmap.yaml +++ b/metricbeat/templates/configmap.yaml @@ -16,7 +16,7 @@ data: {{- end -}} {{- end -}} -{{- if .Values.daemonset.metricbeatConfig }} +{{- if and .Values.daemonset.enabled .Values.daemonset.metricbeatConfig }} --- apiVersion: v1 kind: ConfigMap @@ -34,7 +34,7 @@ data: {{- end -}} {{- end -}} -{{- if .Values.deployment.metricbeatConfig }} +{{- if and .Values.deployment.enabled .Values.deployment.metricbeatConfig }} --- apiVersion: v1 kind: ConfigMap diff --git a/metricbeat/tests/metricbeat_test.py b/metricbeat/tests/metricbeat_test.py index 7e1d6e5b9..bedad56d3 100644 --- a/metricbeat/tests/metricbeat_test.py +++ b/metricbeat/tests/metricbeat_test.py @@ -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(): @@ -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():