-
Notifications
You must be signed in to change notification settings - Fork 382
make svcat describe and get broker now support namespaced resources #2564
make svcat describe and get broker now support namespaced resources #2564
Conversation
1449ee9
to
20267d3
Compare
/retest |
20267d3
to
66c50ea
Compare
/cc @MHBauer could you take a look at this when you have some time? |
pretty big, could take a while |
cc needs to be on it's own line |
or it's just broke |
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.
sorry for taking so long. I see tiny nits and have questions.
Only one instance of "Why did you write it that way".
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2018 The Kubernetes Authors. |
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.
mock changes, ignoring.
@@ -46,7 +46,7 @@ type SvcatClient interface { | |||
|
|||
Deregister(string, *ScopeOptions) error | |||
RetrieveBrokers(opts ScopeOptions) ([]Broker, error) | |||
RetrieveBroker(string) (*apiv1beta1.ClusterServiceBroker, error) | |||
RetrieveBrokerByID(string, ScopeOptions) (Broker, error) |
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 change the method name?
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.
missed the scope addition.
@@ -23,6 +23,13 @@ import ( | |||
"github.com/kubernetes-incubator/service-catalog/pkg/svcat/service-catalog" | |||
) | |||
|
|||
func getBrokerScope(broker servicecatalog.Broker) string { | |||
if broker.GetNamespace() != "" { |
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.
is empty string already resolved to "default" at this point?
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.
Note that this isn't an actual v1beta1 broker, it's our custom-spun interface that spans the two types for svcat to use - this always returns "" for CSB's: https://github.com/kubernetes-incubator/service-catalog/blob/master/pkg/apis/servicecatalog/v1beta1/broker.go#L30
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.
👍
@@ -126,6 +126,9 @@ tree: | |||
use: binding NAME |
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.
ok
@@ -14,89 +14,217 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ |
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 trust the @jberkhahn tests.
Thanks for the review @MHBauer. Gotta jet atm, but I will get this stuff looked at ASAP. |
66c50ea
to
b59db35
Compare
/retest |
1 similar comment
/retest |
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 more understanding of how opts matches works.
} | ||
table = append(table, []string{"URL:", broker.GetURL()}) | ||
table = append(table, []string{"Status:", getBrokerStatusFull(broker.GetStatus())}) | ||
t.AppendBulk(table) |
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 like it.
} | ||
} | ||
|
||
if opts.Scope.Matches(NamespaceScope) { |
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.
else if?
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.
it can't be an else if, its possible to match both
if err != nil && !apierrors.IsNotFound(err) { | ||
return nil, fmt.Errorf("unable to search servicebrokers k8s by name (%s)", err) | ||
} | ||
} |
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.
return sb here ?
if err != nil && !apierrors.IsNotFound(err) { | ||
return nil, fmt.Errorf("unable to search clusterservicebrokers by k8s name (%s)", err) | ||
} | ||
} |
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.
return csb here?
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.
its possible we get both a sb and csb back, if they were created with the same name, which is possible as they're different types
strange case, makes sense now. gotta handle "all" |
/assign @jboyd01 |
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.
Sorry it took me so long to review. One nit and a simplification
pkg/svcat/service-catalog/broker.go
Outdated
@@ -29,6 +29,10 @@ import ( | |||
"k8s.io/apimachinery/pkg/util/wait" | |||
) | |||
|
|||
// MultipleBrokersFoundError is the error returned when we find a clusterservicebroker | |||
// and a servicebroker with the same name | |||
const MultipleBrokersFoundError = "Too many brokers found" |
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.
nit: what do you think about "more then one" vs "too many" ?
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.
sounds good.
sb = nil | ||
} | ||
if err != nil && !apierrors.IsNotFound(err) { | ||
return nil, fmt.Errorf("unable to search servicebrokers k8s by name (%s)", err) |
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.
should this be "unable to search servicebrokers by k8s name" ? (ie the placement of k8s). And should we not spell out kubernetes?
change 135 & 136 to } else {
as we already know err != nil
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.
will do.
b59db35
to
52de896
Compare
-add RetrieveBrokerByID to pkg/svcat
52de896
to
ac5837b
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MHBauer 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 |
/test pull-service-catalog-xbuild |
…netes-retired#2564) -add RetrieveBrokerByID to pkg/svcat
This PR is a
What this PR does / why we need it:
per #2451 as part of the burndown on namespace resources, this changes the behavior of svcat get and describe to as follows:
-if only 1 is found, return it
if >1 are found, ask the user to specify scope
This also adds a typeline to the various places brokers are displayed to the user to inform them if its a clusterservicebroker or servicebroker
Which issue(s) this PR fixes
#2451
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