Closed IfSentient closed 3 months ago
Works for me using kind
jq '.spec.versions[0].selectableFields' definitions/relation.gamma.ext.grafana.com.json
[
{
"jsonPath": ".spec.relationType"
},
{
"jsonPath": ".spec.fromRef.apiVersion"
},
{
"jsonPath": ".spec.fromRef.kind"
},
{
"jsonPath": ".spec.fromRef.name"
},
{
"jsonPath": ".spec.toRef.apiVersion"
},
{
"jsonPath": ".spec.toRef.kind"
},
{
"jsonPath": ".spec.toRef.name"
}
]
kubectl get relations --field-selector spec.relation=dependency --field-selector spec.fromRef.name=service-a
NAME AGE
service-a-depends-on-service-b 3m5s
@IfSentient looks like TestCustomCacheInformer_Run_CacheState
is experiencing the issues that you've addressed in https://github.com/grafana/grafana-app-sdk/pull/359, could you confirm?
@radiohead
=== RUN TestCustomCacheInformer_Run_CacheState
informer_customcache_test.go:231:
Error Trace: /home/runner/work/grafana-app-sdk/grafana-app-sdk/operator/informer_customcache_test.go:231
Error: Should be true
Test: TestCustomCacheInformer_Run_CacheState
Messages: timed out waiting for event
Looks like it, the timed out waiting for event
is due to the channel write being blocked the the mutex lock stopping the listener from starting the channel read to unblock it. Let me re-run the tests and see if it passes, as it's a race condition that seems to depend on the resourcing of the test runner (as it comes down to order of execution in goroutines prior to the fix).
EDIT: still failing, it might be best to get https://github.com/grafana/grafana-app-sdk/pull/359 merged first and then merge main
into this to get the tests to pass.
What this PR Does
Add support for specifying arbitrary selectable fields in a CUE kind, using new
selectableFields
string array inversions[version]
. Generated CRDs will now include the provided selectable fields.Added support for exposing custom selectable fields from
resource.Schema
, for future use (primarily API servers and the like) which will need this information. Codegen automatically adds these to the generatedresource.Schema
when applicable.Testing
Unfortunately, I was unable to get k3d to work with the kubernetes CustomResourceFieldSelectors feature gate, so this was tested on a kind cluster, and k3d support is not built into the local setup.
Setup files
kind:
Cluster info for
ctlptl
:example.yaml
:Test output
Resolves https://github.com/grafana/grafana-app-sdk/issues/355