Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Central grafana datasources and cli fixes #3450

Merged
merged 10 commits into from
Nov 30, 2023

Conversation

GeorgianaElena
Copy link
Member

@GeorgianaElena GeorgianaElena commented Nov 24, 2023

Fixes #1510.

This PR:

  • renames the prometheus datasource of the 2i2c's Grafana to 2i2c
  • creates a new deployer sub-command called grafana central-ds to manage the datasources in the central Grafana
  • replaces the deployer grafana update-central-datasources command that added all clusters in the repo as datasources, in bulk to four individual commands:
    • one to add a cluster as datasource
    • one to delete a cluster from the datasources list
    • one to list all of the clusters that are not marked as datasources in the 2i2c grafana, but doesn't take any action
    • one to list all of the datasources in the central grafana that don;t have a cluster counterpart in this repo
  • updates the add cluster / rm cluster with central grafana update steps.

Note, that "renaming" the prometheus data source was a bit tricky:

  • this was a config that was provisioned through config, and it's marked as not editable in our support chart
    datasources:
    datasources.yaml:
    apiVersion: 1
    datasources:
    # Automatically add the prometheus server in the same namespace as the grafana as a datasource
    - name: prometheus
    orgId: 1
    type: prometheus
    # This is the name of the kubernetes service exposed by the prometheus server
    url: http://support-prometheus-server
    access: proxy
    isDefault: true
    editable: false
    , so it had to be deleted through config
  • Followed the docs at https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources to add a deleteDatasources list entry
  • Then renamed the default provisioned datasource of the 2i2c cluster to be 2i2c instead of prometheus
  • Then removed the deleteDatasources entry.
  • Note that the datasources in deleteDatasources are first deleted, then whatever is listed under datasouces is added.

📚 Documentation preview 📚: https://2i2c-pilot-hubs--3450.org.readthedocs.build/en/3450/

This comment was marked as resolved.

@GeorgianaElena GeorgianaElena marked this pull request as ready for review November 27, 2023 15:35
@GeorgianaElena GeorgianaElena requested a review from a team as a code owner November 27, 2023 15:35
Copy link
Contributor

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wieee @GeorgianaElena, looks great to me!!

deployer/commands/grafana/central_grafana.py Show resolved Hide resolved
deployer/README.md Show resolved Hide resolved
@GeorgianaElena
Copy link
Member Author

GeorgianaElena commented Nov 30, 2023

I haven't merged this yet, because apparently apart from having 2i2c and prometheus point to the same prometheus data source there is also something called default that appears in the list of clusters in each of the Grafana panels.

Screenshot 2023-11-30 at 10 12 58

However this default is not present in the list of datasource (like prometheus was), so I've been trying to figure out if I can get rid of it.

Screenshot 2023-11-30 at 10 14 07

@GeorgianaElena
Copy link
Member Author

Ok, finally found it 🎉 I guess looking at the same problem with fresh eyes, really does help.

Apparently having a datasource be marked as the default one, causes a placeholder called default be shown in the Grafana panels, but not in the datasources. Not having a default datasource explicitly set, solves it, and the first datasource (alphabetically) is shown as the default one in panels.

Also, I've updated the support chart to not set a default for either of the cluster's Grafana, otherwise, you are presented with two possible clusters in the panels, which is confusing.

Screenshot 2023-11-30 at 10 29 17

@GeorgianaElena
Copy link
Member Author

Ok, going for a merge now 🚀 Thanks for reviewing @consideRatio and @sgibson91!

@GeorgianaElena GeorgianaElena merged commit efda48e into 2i2c-org:master Nov 30, 2023
33 checks passed
@GeorgianaElena GeorgianaElena deleted the central-grafana-fix branch November 30, 2023 08:46
Copy link

🎉🎉🎉🎉

Monitor the deployment of the hubs here 👉 https://github.com/2i2c-org/infrastructure/actions/runs/7044058319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done 🎉
Development

Successfully merging this pull request may close these issues.

2i2c datasource showing up twice in central grafana
3 participants