Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support list field filtering #48

Open
scydas opened this issue Jan 11, 2022 · 3 comments
Open

support list field filtering #48

scydas opened this issue Jan 11, 2022 · 3 comments
Labels
pending Need to discuss wontfix This will not be worked on

Comments

@scydas
Copy link
Contributor

scydas commented Jan 11, 2022

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;
@Iceber
Copy link
Member

Iceber commented Jan 12, 2022

@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.

@Iceber Iceber added the pending Need to discuss label Jan 12, 2022
@feeltimeQ
Copy link
Contributor

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`

@Iceber
Copy link
Member

Iceber commented Jul 13, 2022

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

@Iceber Iceber added the wontfix This will not be worked on label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Need to discuss wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants