K8s: Indexing: Fix v2 (#100683)

This commit is contained in:
Stephanie Hingtgen 2025-03-03 23:04:53 -07:00 committed by GitHub
parent c1b48cc488
commit 503bc2ba66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 8 deletions

View File

@ -211,15 +211,27 @@ func readDashboardIter(iter *jsoniter.Iterator, lookup DatasourceLookup) (*Dashb
}
case "annotations":
for sub := iter.ReadObject(); sub != ""; sub = iter.ReadObject() {
if sub == "list" {
for iter.ReadArray() {
v := iter.Read()
logf("[dash.anno] %v\n", v)
}
} else {
iter.Skip()
switch iter.WhatIsNext() {
case jsoniter.ArrayValue:
// dashboards v2 is an array
for iter.ReadArray() {
v := iter.Read()
logf("[dash.anno] %v\n", v)
}
case jsoniter.ObjectValue:
// dashboards v0/v1 are an object
for sub := iter.ReadObject(); sub != ""; sub = iter.ReadObject() {
if sub == "list" {
for iter.ReadArray() {
v := iter.Read()
logf("[dash.anno] %v\n", v)
}
} else {
iter.Skip()
}
}
default:
iter.Skip()
}
case "templating":