-
Notifications
You must be signed in to change notification settings - Fork 397
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
Implement spec.uid
for GrafanaDashboard
#1694
Conversation
is it possible for this to only override the uid if a uid is not already configured? some collections of dashboards already have a uid in them and then link to each other through that but other dashboards have no uid at all and it would helpful to make sure that the uid can be deterministic if the dashboard's uid isn't present 🤔 |
Just to sum up the behaviours:
All of which has their drawbacks, notably:
Personally I don't see much difference between 2 and 3 except they introduce annoyances in two different use cases. Yes, it's possible, but I don't know if its the right direction to go in. |
@Baarsgaard the scenario I’m thinking of is how to maintain multiple k8s clusters all with Grafana operator running on them, pointing to what should ostensibly be the “same” Grafana. Having something deterministic is better than using the metadata uid. Although maybe that’s not the best use of this feature and I should instead open a different PR that directly addresses that. |
@kcolford The opposite of my use case where I have 1 Grafana operator with multiple Grafana instances in tens of other clusters! |
ff840db
to
35d58c4
Compare
@Baarsgaard I think that could work, but it could get messy with determining whether a dashboard already specifies a uid or not. Definitely still possible though, I was just hoping to avoid some extra work. |
35d58c4
to
f75d093
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! From a technical standpoint, this looks great. However, in its current implementation, this would break compatibility with existing setups that rely on the UID being taken from the dashboard spec.
To avoid this, we should only override the UID when the field is actually set.
Once that's implemented, I'm more than happy to merge this!
@theSuess Sure, but in this case, should the |
It should be left immutable, since editing the UID still shouldn't be allowed. |
It is possible, part of the Chainsaw tests validate that behaviour right now! |
edbfd2f
to
6b702a2
Compare
Alright @theSuess I think that's it? |
Code looks good at first glance - will try it out tomorrow & hopefully also merge it/release a new version :) |
558dfb2
to
0873848
Compare
0873848
to
7358927
Compare
I've cleaned up the commit history a bit and queued the PR for merge - thanks again! |
Followed the same pattern as #1686 for the CustomUID.
As discussed in the weekly sync,
spec.uid
ormetadata.uid
will always overwritedashboardModel.uid
.Thanks to the existing
Status.UID
update detection, existing dashboards are automatically migrated to usingmetadata.uid
by the operator.Local procedure for testing
Chainsaw tests
Manual
../test-dashboard.yaml
spec.uid