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

Add folder UID to grafanaFolder #1599

Closed
atos-cosmin-gavagiuc opened this issue Jul 2, 2024 · 4 comments
Closed

Add folder UID to grafanaFolder #1599

atos-cosmin-gavagiuc opened this issue Jul 2, 2024 · 4 comments
Labels
question Further information is requested

Comments

@atos-cosmin-gavagiuc
Copy link
Contributor

Can we specify the folder UID, as optional, when creating the Grafana folder?
This way, we can pre-provision the parent folder and use its UID as the parentUID for the child folder.

Otherwise, I fear that the folder UID will be autogenerated and will differ in each Grafana environment.

@atos-cosmin-gavagiuc atos-cosmin-gavagiuc added enhancement New feature or request needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 2, 2024
@atos-cosmin-gavagiuc atos-cosmin-gavagiuc changed the title add folder UID to grafanaFolder Add folder UID to grafanaFolder Jul 2, 2024
@theSuess theSuess added question Further information is requested and removed enhancement New feature or request needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 2, 2024
@theSuess
Copy link
Member

theSuess commented Jul 2, 2024

Hey, the folder UID will be taken from the kubernetes metadata.uid field. When provisioning from scratch, this will be the same across all instances.

For example:

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaFolder
metadata:
  name: grafanafolder-sample
  namespace: default
  uid: a4de2d73-0cc1-425f-b9d1-7142e5c6d4bc
spec:
  instanceSelector: {}
  resyncPeriod: 5m
  title: Example Folder

Will use a4de2d73-0cc1-425f-b9d1-7142e5c6d4bc as the UID.

We'll add folderRef to the folder resource next, which will allow you to reference other folder resources without ever having to think about UIDs

For future versions of the resources (https://github.com/grafana/grafana-operator/milestone/4) we can consider a user-provided UID field.

@theSuess theSuess closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
@atos-cosmin-gavagiuc
Copy link
Contributor Author

metadata

Hey, the folder UID will be taken from the kubernetes metadata.uid field. When provisioning from scratch, this will be the same across all instances.

For example:

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaFolder
metadata:
  name: grafanafolder-sample
  namespace: default
  uid: a4de2d73-0cc1-425f-b9d1-7142e5c6d4bc
spec:
  instanceSelector: {}
  resyncPeriod: 5m
  title: Example Folder

Will use a4de2d73-0cc1-425f-b9d1-7142e5c6d4bc as the UID.

We'll add folderRef to the folder resource next, which will allow you to reference other folder resources without ever having to think about UIDs

For future versions of the resources (https://github.com/grafana/grafana-operator/milestone/4) we can consider a user-provided UID field.

I was searching through the CRD and couldn't find a way to do that, so this is awesome. Thanks! I'll test it now.

@tippl
Copy link

tippl commented Jul 12, 2024

Hello, I've been looking forward to support for nested folders in Grafana Operator, however I'm at a bit of a loss here.
I legitimately wonder what is the point of the parentUID if the UID is not user-selectable.

As far as i can tell, metadata.uid is a read-only field that is generated on resource creation, any attempt to manually set it at creation just leads to the manual value being thrown away and replaced by an autogenerated one. This goes from both manually testing it out and the k8s documentation here.

So the only way to create a nested folder now seems to be to create a folder, describe the object and use the UID in creating the nested folder. Also as dashboards do not take a folderUID, there seems to be no way to actually use the operator to create a dashboard in the nested folder...

Please tell me if I'm mistaken in any of this, but my testing seems to match what i wrote. There seems to be no way to actually use this feature.

@theSuess
Copy link
Member

We're not quite finished implementing this feature. #1604 will add parentFolderRef in addition to parentFolderUid. This will allow you to reference folders without the need to wait for a UID and enables you to create complex folder structures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants