clusterpedia
clusterpedia copied to clipboard
support list field filtering
support list field filtering
kubectl get po --field-selector="spec.containers[].name!=container1"
kubectl get po --field-selector="spec.containers[].name == container1"
kubectl get po --field-selector="spec.containers[1].name in (container1,container2)"
PostgreSQL
SELECT *
FROM "resources",
jsonb_array_elements(object -> 'status' -> 'conditions') as obj
WHERE "group" = 'apps'
AND "resource" = 'deployments'
AND "version" = 'v1'
AND obj ->> 'status' = 'True'
ORDER BY namespace, name
LIMIT 10;
MySQL
SELECT *
FROM resources
WHERE `group` = 'apps'
AND resource = 'deployments'
AND version = 'v1'
AND json_contains(object, '{"status": "True"}', '$.status.conditions')
ORDER BY namespace, name
LIMIT 10;
@scydas Thanks for your work. The sql statements in postgres can seriously break sql generation, we can see if others have a need for this feature.
hi! I think this is a very necessary feature, in a multi-cluster environment, there are bound to be a lot of pods, and if there is a problem with the service and I need to check the status of the pods. I need this feature to retrieve the unhealthy pods, but pod.stauts.conditions is an array, so I can't do it. Only search by myself 😣.
`status: conditions:
- lastProbeTime: null lastTransitionTime: "2022-01-17T12:08:20Z" status: "True" type: Initialized
- lastProbeTime: null lastTransitionTime: "2022-01-17T12:14:44Z" status: "True" type: Ready
- lastProbeTime: null lastTransitionTime: "2022-01-17T12:14:44Z" status: "True" type: ContainersReady
- lastProbeTime: null lastTransitionTime: "2022-01-17T12:08:20Z" status: "True" type: PodScheduled`
For mysql, array fields can be filtered using raw sql.
For pg, we may add a fromSQL
query parameter in the future to override the pg syntax