-
Notifications
You must be signed in to change notification settings - Fork 461
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
Make UID of grafana Fluent Bit dashboard configurable in values #532
Make UID of grafana Fluent Bit dashboard configurable in values #532
Conversation
@eg-ayoub what version of Grafana are you using? |
@stevehipwell I have tested the dashboards from this on grafana 10.3.3
and this is with the value set to some arbitrary uid
|
@eg-ayoub I'm not sure what the purpose of the PR is given that the current dashboards using |
@stevehipwell thank you for your response. |
@stevehipwell checking back about this PR. Is this an unwanted feature ? |
@eg-ayoub I think you might be better off looking outside this chart if you want to manage Grafana dashboards based on the UID; the chart implementation of a random UID looks to be the right solution on this context. |
@stevehipwell sorry but I disagree, I don't see any good reason to not allow the user to use fixed UID for the dashboard, especially since the behavior for the users not specifying anything will be exactly the same as today. |
@TeddyAndrieux you're more than welcome to disagree, but you haven't provided a good reason to back your disagreement up with. |
@stevehipwell the reason is "Why not ?" I mean there is no reason to not authorize it if it helps some users. And I don't see why people that want to have fixed UID shouldn't use this chart ? To me having a fixed UID is quite useful if you want to pre-define link to a dashboard (i.e.: |
@TeddyAndrieux I'm happy to listen to a case for why the extra maintenance and cognitive overhead caused by additional chart complexity is worth accepting. My standing position is that bespoke behaviour on ancillary functionality which can easily be managed outside of the chart is something to avoid adding. |
@stevehipwell "complexity" ?? It's a simple value
Except managing the dashboard by hand I don't see how it can be done, to me it just means with your approach that if you want a fixed UID you cannot use the dashboard that comes with the helm chart, which is really sad, we have to manage our own dashboard make sure it gets updated properly ... where it could basically come with the helm chart To me either it's a hardcoded value (like in most of the helm charts in the community) either it's configurable. By the way, the PR could be simplified a bit with just
|
@TeddyAndrieux this chart isn't single purpose and there can be multiple installations in a given cluster so the fixed What would you be looking to set the |
To be honest we don't really care we just want this to be pre-define (even if it changes on each version it's fine for us) |
@TeddyAndrieux I assume you mean the same version of the chart across multiple clusters? As once the chart is installed the |
I think the following (untested) change would make the most sense to provide a deterministic 40 character "uid": "{{ sha1sum (printf "%s-%s" .Release.Namespace .Release.Name) }}", |
It's not the case today if we come from a previous version and we upgrade to the latest one it will change from But on my side I was really talking about this case I'm fine if it changes from one version to another I just need to be able to know it before applying the install/upgrade Yes to me it's fine also a hash based on Namespace + Name |
@stevehipwell @TeddyAndrieux ok in that case I can go ahead and rework this PR to apply that specific change |
d13009a
to
3e8f1e7
Compare
@TeddyAndrieux that was the one off change when it was switched to
You're right it should be. "uid": "{{ sha1sum (printf "%s-%s" .Release.Namespace (include "fluent-bit.fullname" .)) }}", @eg-ayoub you could modify the logic slightly to support a "uid": {{ ternary (sha1sum (printf "\"%s-%s\"" .Release.Namespace (include "fluent-bit.fullname" .))) "null" .Values.dashboards.deterministicUid }}, |
465f016
to
876d137
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 @eg-ayoub. You'll need to add the dashboards.deterministicUid
value to values.yaml and it should default to false
so it doesn't churn for anyone who doesn't opt in. Could you also updated ci/ci-values.yaml to set dashboards.deterministicUid
to true
.
To make this mergeable you'll also need to bump the version and update the release notes annotations.
Just tested this "uid": {{ ternary (sha1sum (printf "\"%s-%s\"" .Release.Namespace (include "fluent-bit.fullname" .))) "null" .Values.dashboards.deterministicUid }}, with value set to True and it does not work on my side I think it's because it's the "namespace-name" that is quoted and not the sha1sum, I would do something like that instead "uid": {{ if .Values.dashboards.deterministicUid }}"{{ sha1sum (printf "%s-%s" .Release.Namespace (include "fluent-bit.fullname" .)) }}"{{ else }}null{{ end }}, |
@TeddyAndrieux I've tested it locally and it works correctly as pasted here if the default value is correctly configured. You could modify the clause to |
@stevehipwell I may have miss explained it, I mean the rendering of the helm template works well but the resulting json is wrong since there is no "quote" on the UID E.g.: With namespace default and name "test" we get the following "title": "test-fluent-bit",
"uid": e51705004faf6bbbf2d1a4d779250ef34f008917,
"version": 7, Because it's quoted before the sha1sum $ echo -n '"default-test-fluent-bit"' | sha1sum
e51705004faf6bbbf2d1a4d779250ef34f008917 - |
Sorry I missed which bit wasn't working, yes the quotes were in the wrong place. "uid": {{ ternary (printf "\"%s\"" (sha1sum (printf "%s-%s" .Release.Namespace (include "fluent-bit.fullname" .)))) "null" .Values.dashboards.deterministicUid }}, |
876d137
to
91c95d2
Compare
91c95d2
to
dd3d5d4
Compare
dd3d5d4
to
99ffb1a
Compare
99ffb1a
to
29a3c78
Compare
@stevehipwell I've applied all the changes, I think this is ready to merge 😄 |
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 @eg-ayoub. Could you rebase your branch and bump the chart version so I can run the tests?
Signed-off-by: Ayoub Nasr <[email protected]>
Signed-off-by: Ayoub Nasr <[email protected]>
29a3c78
to
07fdb73
Compare
@stevehipwell rebased. |
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.
LGTM
value still defaults to null