K8s: Reduce folder get calls in modes 0-2 (#102831)

This commit is contained in:
Stephanie Hingtgen
2025-03-26 05:44:10 +02:00
committed by GitHub
parent 9e10a7f9ce
commit 0ce28c8dd8
6 changed files with 134 additions and 8 deletions
+24
View File
@@ -58,6 +58,9 @@ const AnnoKeySourcePath = "grafana.app/sourcePath"
const AnnoKeySourceChecksum = "grafana.app/sourceChecksum"
const AnnoKeySourceTimestamp = "grafana.app/sourceTimestamp"
const AnnoKeyFullpath = "grafana.app/fullpath"
const AnnoKeyFullpathUIDs = "grafana.app/fullpathUIDs"
// LabelKeyDeprecatedInternalID gives the deprecated internal ID of a resource
// Deprecated: will be removed in grafana 13
const LabelKeyDeprecatedInternalID = "grafana.app/deprecatedInternalID"
@@ -97,6 +100,11 @@ type GrafanaMetaAccessor interface {
// Deprecated: This will be removed in Grafana 13
SetDeprecatedInternalID(id int64)
GetFullpath() string
SetFullpath(path string)
GetFullpathUIDs() string
SetFullpathUIDs(uids string)
GetSpec() (any, error)
SetSpec(any) error
@@ -317,6 +325,22 @@ func (m *grafanaMetaAccessor) SetDeprecatedInternalID(id int64) {
m.obj.SetLabels(labels)
}
func (m *grafanaMetaAccessor) GetFullpath() string {
return m.get(AnnoKeyFullpath)
}
func (m *grafanaMetaAccessor) SetFullpath(path string) {
m.SetAnnotation(AnnoKeyFullpath, path)
}
func (m *grafanaMetaAccessor) GetFullpathUIDs() string {
return m.get(AnnoKeyFullpathUIDs)
}
func (m *grafanaMetaAccessor) SetFullpathUIDs(uids string) {
m.SetAnnotation(AnnoKeyFullpathUIDs, uids)
}
// GetAnnotations implements GrafanaMetaAccessor.
func (m *grafanaMetaAccessor) GetAnnotations() map[string]string {
return m.obj.GetAnnotations()