-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
UPSTREAM: 31163: add resource filter handling #10574
UPSTREAM: 31163: add resource filter handling #10574
Conversation
6f099ee
to
e9d59ac
Compare
Please open this upstream and let's do this review there. |
if err != nil { | ||
return err | ||
for ix := range infos { | ||
filter := kubectl.NewResourceFilter(filterOptionsForCommand(cmd, allNamespaces)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you creating one filter per info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to track whether the filter removed anything to trigger "was filtered out" message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to track whether the filter removed anything to trigger "was filtered out" message.
Ah, did this upstream although since I am creating a filter per every info I had to approach it differently to how they had it. Would a better implementation be to determine if a runtime.Object
is a list of resources, then either return a list with unfiltered pods / remove filtered pods from that list?
e9d59ac
to
c52667f
Compare
bbb1a29
to
8397d49
Compare
89a0ef9
to
340de34
Compare
[test] |
c0ac1f5
to
0cf11da
Compare
09fe0bd
to
74e848c
Compare
f3c62af
to
2b9e40a
Compare
@smarterclayton @fabianofranz Upstream merged, PTAL |
LGTM, please squash. |
UPSTREAM: kubernetes/kubernetes#31163 Fixes openshift#9901 Resources are currently filtered (in order to prevent printing) at print time in their HumanReadablePrinter handlers. This design makes it not possible to filter objects when they are printed using any other printer, such as YAML, JSON, or the NamePrinter. This patch removes any filters previously added at the printer level for pods and adds a way to define resource-specific filters before they are sent to a printer handler. A woking filter handler for pods has also been implemented. Filters affect resources being printed through the HumanReadablePrinter, YAML, JSON, and `--template` printers.
2b9e40a
to
e4a3e8b
Compare
conformance test flaked on #9548 re[test] |
conformance test flaked on #11079 re[test] |
Evaluated for origin test up to e4a3e8b |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9284/) |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9284/) (Image: devenv-rhel7_5076) |
Evaluated for origin merge up to e4a3e8b |
Fixes: #9901
Upstream: kubernetes/kubernetes#31163
Resources are currently filtered (in order to prevent printing) at print
time in their HumanReadablePrinter handlers. This design makes it not
possible to filter objects when they are printed using any other
printer, such as YAML, JSON, or the NamePrinter.
This patch removes any filters previously added at the printer level for
pods and adds a way to define resource-specific filters before they are
sent to a printer handler. A woking filter handler for pods has also been
implemented.
Filters affect resources being printed through the HumanReadablePrinter,
name printer, YAML, JSON, and
--template
printers.Print pods with different outputs
$ oc get pods
$ oc get pods --show-all=false -o name
$ oc get pods --show-all=false --template='{{(.metadata.name)}} '
cc @fabianofranz @smarterclayton @deads2k @liggitt @rhcarvalho