-
Notifications
You must be signed in to change notification settings - Fork 385
svcat CLI can now filter the classes return by broker in svcat get classes
via a --broker
flag
#2786
svcat CLI can now filter the classes return by broker in svcat get classes
via a --broker
flag
#2786
Conversation
Hi @gmrodgers. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Welcome @gmrodgers! |
looks like |
Yep! Having problems getting verify running on my machine! Will fix that commit and try and get that sorted |
/ok-to-test |
other than the comment hiccup this looks great! |
Ive added in the License that my previous commit removed, seems one of the make commands popped it out but still seems to be breaking. My colleague is working on a branch hopefully that should mitigate some of the |
@@ -1,35 +1,19 @@ | |||
/* |
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.
Unfortunately, this comment needs to be reverted:
Boilerplate header is wrong for: ././pkg/svcat/service-catalog/service-catalogfakes/fake_svcat_client.go
IMO that this should be skipped by checker but somehow the generated files are not ignored.
Hi. @gmrodgers thanks for your PR! :) you can always check the travis job: https://travis-ci.org/github/kubernetes-sigs/service-catalog/jobs/665834302?utm_medium=notification&utm_source=github_status at the end of logs you will see there problem reported by verify
I also describe it here: #2786 (comment) the I will take a look on that PR today (approximately in ~2h) :) |
639299e
to
2950e28
Compare
Hey @mszostok I've reverted the changed to the boilerplate, hopefully will flow through now :) |
@@ -66,7 +66,7 @@ func (c *MarketplaceCmd) Run() error { | |||
Namespace: c.Namespace, | |||
Scope: servicecatalog.AllScope, | |||
} | |||
classes, err := c.App.RetrieveClasses(opts) | |||
classes, err := c.App.RetrieveClasses(opts, "") |
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.
I need to say that I do not like such API which requires from you to set some values when you are not interested in customizing that. IMO the best option here will be the functional options pattern. As a result you will have
# default behaviour
c.App.RetrieveClasses()
# sth changed
c.App.RetrieveClasses(WithBrokerName("myqsl"), InNamespace("system"))
benefits:
- in future you do not need to break the function signature (always backward compatible) (and this is already named as SDK so it is used by others)
- only can change the default behavior only if want without setting some additional values
but I joined the SC after the svcat was introduced so maybe let's do not do such huge refactor as you already did a nice work 👍
but at least let's try to avoid the magic value and introduce const for that case, similar approach is used in k8s for empty string in clients:
https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/types.go#L287-L290
so sth like c.App.RetrievClasses(opts, FromAllBrokers)
I've tested that and it works like a charm :) Please see this comment: #2786 (comment) and introduce that const and this will be ready to merge 👍 |
I think making it a const so the blank value seems less magic is a good idea. Not sure how I feel about the funcs as args, though. |
A few things are causing the `make verify` command (and subsequently `make`) to fail. These are addressed in this commit, as follows: 1. `make verify-docs` - Explicitely skip the localhost link in contribute/docs.md and remove a link for a non-yet-existent repository in pkg/kubernetes/README.md. 1. Exclude `bin/verify-links.sh` from the `verify-boilerplate.sh` check (this file is .gitignored) 1. Update GO_VERSION defined in the Makefile to match GO_VERSION defined in .travis.yml Addresses an issue mentioned in kubernetes-retired#2782.
7281456
to
38729e2
Compare
Hmmm so I squashed the commit into one feature commit |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gmrodgers, jberkhahn The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR is a
What this PR does / why we need it:
Adds filtering by broker to the
svcat get classes
subcommand via the--broker
flag.It also consequencely adds the broker providing the class to the table output of the
get
command.Which issue(s) this PR fixes
Partially fixes #1749 but does not include the plans filtering (personally I filtering by broker as more appropriate on the classes as it almost the "parent" of that. Let me know if you feel differently!
One think to note is that I've added a BrokerFiltered property to the GetCmd, I see that similar things are done on some commands, such as
get instances
but others likeget plans
uses a ClassFilter string. I chose the former but I would be interested if there was any context between the two choices!Please leave this checklist in the PR comment so that maintainers can ensure a good PR.
Merge Checklist:
breaking the chart release and existing clients who provide a
flag that will get an error when they try to update