Skip to content

Commit

Permalink
salt: Disable loki grafana dashboard if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekiel-alexrod committed Oct 31, 2024
1 parent 644c876 commit 5378543
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
- Do no longer use `latest` for `storage-operator` image
(PR[#4299](https://github.com/scality/metalk8s/pull/4299))

- Loki Grafana dashboard and datasources are enabled only
if Loki is enabled.
(PR[#4464](https://github.com/scality/metalk8s/pull/4464))

## Release 127.0.7 (in development)

## Release 127.0.6
Expand Down
6 changes: 3 additions & 3 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,18 @@ def task(self) -> types.TaskDict:
),
Path("salt/metalk8s/addons/dex/deployed/nginx-ingress-ca-cert-configmap.sls"),
Path("salt/metalk8s/addons/logging/deployed/init.sls"),
Path("salt/metalk8s/addons/logging/deployed/dashboards.sls"),
Path("salt/metalk8s/addons/logging/deployed/namespace.sls"),
Path("salt/metalk8s/addons/logging/deployed/files/logs.json"),
Path("salt/metalk8s/addons/logging/deployed/files/loki.json"),
Path("salt/metalk8s/addons/logging/fluent-bit/config/fluent-bit.yaml.j2"),
Path("salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls"),
Path("salt/metalk8s/addons/logging/fluent-bit/deployed/configmap.sls"),
Path("salt/metalk8s/addons/logging/fluent-bit/deployed/init.sls"),
Path("salt/metalk8s/addons/logging/fluent-bit/deployed/service-configuration.sls"),
Path("salt/metalk8s/addons/logging/loki/config/loki.yaml"),
Path("salt/metalk8s/addons/logging/loki/deployed/files/logs.json"),
Path("salt/metalk8s/addons/logging/loki/deployed/files/loki.json"),
Path("salt/metalk8s/addons/logging/loki/deployed/chart.sls"),
Path("salt/metalk8s/addons/logging/loki/deployed/datasource.sls"),
Path("salt/metalk8s/addons/logging/loki/deployed/dashboards.sls"),
Path("salt/metalk8s/addons/logging/loki/deployed/init.sls"),
Path("salt/metalk8s/addons/logging/loki/deployed/loki-configuration-secret.sls"),
Path("salt/metalk8s/addons/logging/loki/deployed/macro.j2"),
Expand Down
27 changes: 0 additions & 27 deletions salt/metalk8s/addons/logging/deployed/dashboards.sls

This file was deleted.

12 changes: 11 additions & 1 deletion salt/metalk8s/addons/logging/deployed/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@ include:
- metalk8s.addons.logging.loki.deployed
- metalk8s.addons.logging.fluent-bit.deployed
- metalk8s.addons.prometheus-operator.deployed.namespace
- .dashboards

{#- In MetalK8s 128.0 we changed the fluent-bit dashboard to use
the one from the helm chart. We need to remove the old one
to avoid conflicts.
This can be removed in `development/129.0` #}
Ensure old fluent-bit dashboard does no longer exists:
metalk8s_kubernetes.object_absent:
- name: fluent-bit-dashboard
- namespace: metalk8s-monitoring
- apiVersion: v1
- kind: ConfigMap
16 changes: 16 additions & 0 deletions salt/metalk8s/addons/logging/loki/deployed/dashboards.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!jinja | metalk8s_kubernetes
{%- from "metalk8s/addons/prometheus-operator/macros.j2"
import configmaps_from_dashboards with context %}
{{ configmaps_from_dashboards([
{
'name': 'logs',
'title': 'Logs',
'tags': ['logging'],
},
{
'name': 'loki',
'title': 'Loki',
'tags': ['logging'],
}
]) }}
2 changes: 2 additions & 0 deletions salt/metalk8s/addons/logging/loki/deployed/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include:
- .chart
- .service
- .datasource
- .dashboards
- .workaround-job-dep

{#- Due to a bug in Loki that prevent deletion of the old chunks,
Expand Down Expand Up @@ -45,6 +46,7 @@ Ensure Loki objects does not exist:
force_absent: True
- mods:
- metalk8s.addons.logging.loki.deployed.chart
- metalk8s.addons.logging.loki.deployed.dashboards
Ensure Loki config does not exist:
metalk8s_kubernetes.object_absent:
Expand Down
3 changes: 3 additions & 0 deletions tests/post/steps/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ def check_grafana_dashboards(host, grafana_api):
expected_dashboards = expected_dashboards_json["all"]
if utils.get_pillar(host, "addons:fluent-bit:enabled"):
expected_dashboards.update(expected_dashboards_json["fluent-bit"])
if utils.get_pillar(host, "addons:loki:enabled"):
expected_dashboards.update(expected_dashboards_json["Logs"])
expected_dashboards.update(expected_dashboards_json["Loki"])

uid_mismatches = []
extra_dashboards = []
Expand Down

0 comments on commit 5378543

Please sign in to comment.