Repository navigation
fix(roles/grafana_grizzly): move dashboards back into their folder on Grafana 13.1+ - #423
Merged
Merged
Conversation
… Grafana 13.1+ Grafana 13.1 routes /api/dashboards/db into the Kubernetes save path, which sets the folder from folderUid only (grafana/grafana#122027). grizzly sends folderId, so every dashboard it adds or updates lands in the root and loses the viewer permission inherited from the folder; anonymous viewers and the IcingaWeb2 iframes get 403. After grr apply, grafana_grizzly and monitoring_plugins_grafana_dashboards now compare the folder of each dashboard resource with /api/search and save the misfiled ones again with folderUid. "general" means the root and is skipped. Stopgap until the switch to gcx. Verified against Grafana 13.2.2 on Rocky 9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On icinga-demo (Grafana 13.2.2), the graphs embedded in IcingaWeb2 failed with "Failed to load dashboard 403" for 18 of the Monitoring Plugins dashboards, among them
memory-usage,pingandcpu-usage.Grafana 13.1 routes
/api/dashboards/dbinto the Kubernetes save path, which sets the folder fromfolderUidonly (saveDashboardViaK8s()inpkg/api/dashboard.go, grafana/grafana#122027). grizzly sendsfolderId, so every dashboard it adds or updates lands in the root. A dashboard moved there loses the viewer permission it inherited from the folder, while dashboards created in the root get their own; the anonymous viewer that IcingaWeb2 embeds Grafana with then gets 403. No grizzly release sendsfolderUid.Changes
grafana-move-dashboards-into-folders.yml: takes the dashboards and their folders, reads the current folder of every dashboard with a single/api/search, and saves only the misfiled ones again withfolderUid. That puts them back and restores the permission. Dashboards Grafana does not know, and those whose resource namesgeneral(the root in grizzly), are left alone.grr apply, with theDashboardresources parsed from the applied files on the controller.Stopgap until the switch to gcx (Linuxfabrik/monitoring-plugins#1062).
Tests
setup_icinga2_master --tags monitoring_plugins_grafana_dashboards: withswap-usagechanged in Grafana beforehand,grrreportedDashboard.swap-usage updatedand filed it in the root, the new task moved it back. Afterwards no Linuxfabrik dashboard was in the root,swap-usageanswered the anonymous viewer with 200 and carried the content grizzly applied.--checkreads only.kind: Dashboardquoted and unquoted,folder: general) are recognised and skipped.ansible-linton the changed roles: only the four existing findings outside these lines. No Molecule scenario exists for Grafana.