diff --git a/docs/customresourcestate-metrics.md b/docs/customresourcestate-metrics.md index b0e1edd775..035ba457b1 100644 --- a/docs/customresourcestate-metrics.md +++ b/docs/customresourcestate-metrics.md @@ -482,5 +482,5 @@ Examples: [status, conditions, "[value=66]", name] # status.conditions[1].name = "b" # For generally matching against a field in an object schema, use the following syntax: -[metadata, annotations, "bar:baz"] # metadata.annotations["bar:baz"] = "baz" (if present, ignored otherwise) +[metadata, annotations, "bar=baz"] # metadata.annotations["bar=baz"] = "baz" (if present, ignored otherwise) ``` diff --git a/pkg/customresourcestate/registry_factory.go b/pkg/customresourcestate/registry_factory.go index a9c6a0a23f..ac5a0c68c1 100644 --- a/pkg/customresourcestate/registry_factory.go +++ b/pkg/customresourcestate/registry_factory.go @@ -613,8 +613,8 @@ func compilePath(path []string) (out valuePath, _ error) { part: part, op: func(m interface{}) interface{} { if mp, ok := m.(map[string]interface{}); ok { - kv := strings.Split(part, ":") - if len(kv) == 2 /* k:v */ { + kv := strings.Split(part, "=") + if len(kv) == 2 /* k=v */ { key := kv[0] val := kv[1] if v, ok := mp[key]; ok { diff --git a/pkg/customresourcestate/registry_factory_test.go b/pkg/customresourcestate/registry_factory_test.go index 0f919df817..87f7eb391a 100644 --- a/pkg/customresourcestate/registry_factory_test.go +++ b/pkg/customresourcestate/registry_factory_test.go @@ -332,10 +332,10 @@ func Test_values(t *testing.T) { newEachValue(t, 0, "type", "Provisioned"), newEachValue(t, 1, "type", "Ready"), }}, - {name: ": expression matching", each: &compiledInfo{ + {name: "= expression matching", each: &compiledInfo{ compiledCommon: compiledCommon{ labelFromPath: map[string]valuePath{ - "bar": mustCompilePath(t, "metadata", "annotations", "bar:baz"), + "bar": mustCompilePath(t, "metadata", "annotations", "bar=baz"), }, }, }, wantResult: []eachValue{