-
Notifications
You must be signed in to change notification settings - Fork 429
Manage Grafana Service Accounts from the Grafana CR #1907
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
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.
Hi, thanks for the PR! :D
As this is WIP I have mostly commented on style rather than functionality or wording.
Since you diligent with adding logs, I would like to direct you to: https://github.com/grafana/grafana-operator/blob/master/controllers/contactpoint_controller.go#L209
It's one of the few examples of debug level logs in the project by adding the .V(1)
It could be useful to you if you've been wanting to add more logs but have been holding back.
In case you have questions, feel free to leave comments!
44516fc
to
297df4d
Compare
fc35937
to
45a06ca
Compare
4d3109a
to
881b3c0
Compare
75871ab
to
f96b8a8
Compare
f62728d
to
c1fc015
Compare
04117f2
to
163fb27
Compare
Thank you for your continued investment in this feature - it's very appreciated! We took some time to answer your questions
If it doesn't singificantly simplify the implementation, we'd prefer for service accounts to be specified as part of the Grafana CR.
When keeping the service accounts as part of the
This is a good point and being able to specify the namespace for the secret is something that we definetly want
This isn't really a questions but more of a topic for a follow-up PR. For what
We discussed this and came to the conclusion that conditions are probably the
The only situation in which a finalizer would be applicable would be with
This is something we can explore in a follow up PR. Let's keep it to the default Again thanks for all the work! If you have more questions or want to chat about this PR, feel free to join our maintainer meeting every Monday at 11:00 CEST. If you prefer async communication, discussing this further in the PR is also always possible :) |
UPD: I see there's ongoing work in the main branch to move away from Chainsaw-based tests and to revamp the Grafana reconciliation cycle. Because these updates look quite significant, I'll wait until they've been merged and then revise my code accordingly. This will ensure that my changes align smoothly with the updated infrastructure.
#1469
See full de# proposal #003.
Summary
This PR adds declarative management of Grafana Service Accounts directly in the
Grafana
Custom Resource.It removes the need to provision SAs and API tokens manually and lets the operator keep them in sync.
What's in this PR
spec.grafanaServiceAccounts
to theGrafana
CR.Secret
objects owned by the parentGrafana
.tests/e2e/grafanaserviceaccount
) cover create / rename / role change / disable / delete.Still to do
expires
field.permissions:
subsection for fine-grained access control.Open questions
Proposal embeds service-account config in the
Grafana
CR, but I have a working PoC of a standaloneGrafanaServiceAccount
CRD on a side branch (needs a quick rebase).The current reconciler creates/updates service accounts only in the namespace that hosts the parent
Grafana
.Tokens are written as
Secret
s in the same namespace. No support for cross-namespace references today. Any objection to keeping it that way?The proposal sketches a
permissions:
section, and I already have code for it on another branch. Validation is blocked because the required Grafana API endpoints are Enterprise/Cloud-only. So, it's not included to this PR.It currently runs in a new stage between
deployment
andcomplete
. That stage can error a couple of times while Grafana is starting, and if it wedges we never reachcomplete
. Options I see:a. Move SA reconciliation after
complete
(risk: stage-creep, users may key offcomplete
, breaks compatibility).b. Rename current
complete
to something else and make SA the newcomplete
(breaks compatibility also).c. Use Kubernetes-style
Conditions
, reconciling sub-resources independently. Cleaner, but hard to mix Conditions with the current sequential sub-reconcilers (they seem mutually exclusive).I didn't add any. Can you spot a case where we must guarantee cleanup via a finalizer?
orgId
supportAll operations target the default organization at the moment. Do we need
orgId
in the spec?