grafana-operator icon indicating copy to clipboard operation
grafana-operator copied to clipboard

New `grafanafolder#spec.uid` property for stable UIDs

Open Baarsgaard opened this issue 6 months ago • 4 comments

I'm in the middle of defining a disaster-recovery process when recreating the Grafana Operator resources from scratch.

If I lose my cluster, ETCD state, or I mess up in a CD pipeline and any grafanafolder cr is deleted. Recreating it results in an entirely new metadata.uid.

Currently, the only way to recover from this is through manually/programmatically:

  1. Connect to every managed instance with the deleted folder
  2. Delete all provisioned Alertrules and Dashboards
  3. Delete the existing folder with the old UID
  4. Have Grafana-Operator recreate the Folder, Alertrules, and Dashboards

Describe the solution you'd like UID property on grafanafolder resource to ensure it's always the same for a specific folder name.

Describe alternatives you've considered

  • Using folderUID on Alertrules/Dashboards This could work, except when onboarding new Grafana instances the folder does not exist and I cannot create the dashboards
  • Using folder The folder will always have a different UID for each Grafana Instance. This could work, both when provisioning and Deleting. It does however mean I cannot use the folderRef and folderUID properties on Alertrules and Dashboards and the grafanafolder crd.
  • I have tried "Tricking" the operator by applying a GrafanaFolder with the metadata.uid already specified, but it's overwritten on first apply.

Baarsgaard avatar Aug 12 '24 13:08 Baarsgaard