Closed kuanf closed 1 year ago
the jsonpath package in client-go v0.26.1 used currently does not support ['
and ']
to quote string, created an issue there .
we may need to do an ugly implementation ourselves.
jsonpath patterns to support:
.metadata.labels.['ibm.com']
.spec.['ibm.com'].product.resources
.spec.['ibm.com'].product.['watsonx.frontend'].resources
with filters
.spec.['ibm.com'][?(.name="watsonx")].resources
.spec.['ibm.com'][?(.name="['watsonx.frontend']")].resources
It seems the community is not responding to this issue. We'll do a quick/ugly implementation to support keys in metadata.labels
and metadata.annotations
with dot(.). (e.g. .metadata.labels.['ibm.com']
) But not other generic fields.
labels and annotations could be used to reference some keyword from owned resource. With this change more mappings could be folded by 1 pattern.
Use case 1 - labels:
Use case 2 - special field:
In order to work with fields with dot in the key, we can't use jsonpath like
.metadata.labels.ibm.com/type
or.spec.ibm.com.websphere.resources
According to evaluator from https://jsonpath.com/
the right way is to use
.metadata.labels.['ibm.com/type']
.spec.['ibm.com'].websphere.resources
we need to support that approach.