kubernetes / kubernetes/kubectl

Jsonpath: add support for OR operation in list filters

Open
#1,341 13 comments 1 reaction 0 assignees View on GitHub
kind/feature lifecycle/rotten needs-triage priority/backlog
Dominant language
Go
Stars
3.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

JsonPath describes a "or operation" for list filters that is not implemented in kubectl

I would like to add the possibility to do the following:

`kubectl get deploy -o jsonpath='{.items[?(@.metadata.name=="foo") || ?(@.metadata.name=="bar")].metadata.name}`

With this feature one could do more complex filtering without having to do more than one kubectl request

Contributor guide

Open the contributing guide

Research direction

Start by locating kubectl's JSONPath list-filter implementation and its existing filter tests. Compare the current behavior with the issue's example using ||; done means the example can select deployments named foo or bar in a single kubectl request.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.