-
Notifications
You must be signed in to change notification settings - Fork 385
svcat describe and get classes now support namespaced resources #2582
svcat describe and get classes now support namespaced resources #2582
Conversation
87f9279
to
72ab07b
Compare
kubeName string | ||
name string | ||
// DescribeCmd contains the information needed to describe a specific class | ||
type DescribeCmd struct { |
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.
this should have a public context or nothing should have a public context
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 don't remember what this means.
Expect(actions[1].Matches("get", "serviceclasses")).To(BeTrue()) | ||
Expect(actions[1].(testing.GetActionImpl).Name).To(Equal(classID)) | ||
}) | ||
It("doesn't short circuit on not-found errors", func() { |
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.
add a test for the both-not-found case
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.
looked at with jonathan. his comments are my comments
class, err := sdk.ServiceCatalog().ClusterServiceClasses().Get(kubeName, metav1.GetOptions{}) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to get class (%s)", err) | ||
func (sdk *SDK) RetrieveClassByID(kubeName string, opts ScopeOptions) (Class, 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.
same code as previously
class, err = c.App.RetrieveClassByName(c.name, servicecatalog.ScopeOptions{ | ||
Scope: servicecatalog.ClusterScope, | ||
}) | ||
class, err = c.App.RetrieveClassByName(c.Name, scopeOpts) |
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.
names look funny when compared with previous PR
72ab07b
to
b501f37
Compare
f5e570b
to
2b71b96
Compare
@MHBauer could you take another look at this? fixed your concerns. I'll have to submit another PR to change the naming stuff in the broker commands. |
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.
/gtm
kubeName string | ||
name string | ||
// DescribeCmd contains the information needed to describe a specific class | ||
type DescribeCmd struct { |
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 don't remember what this means.
@MHBauer looks like your LGTM didn't take, could you re /lgtm this? |
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'm kind of surprised the namespaced scoped describe class test works since the namespace scope doesn't work from the command line (flag not recognized) (see below)....
At md/svcat/class/describe_cmd.go:114
opts := servicecatalog.ScopeOptions{Scope: servicecatalog.AllScope}
plans, err := c.App.RetrievePlans(class.GetName(), opts)
if err != nil {
return err
}
I think if the scope is namespace we should set namespace for the plan scope as well. Probably applies to more then just plans. IE all describe operations pull up instances/classes/plans right? we should apply the same scope to all describe commands. Maybe this is best done in a follow up, if you agree would you mind creating an issue? Or let me know and I can create.
) | ||
describeCmd.AddScopedFlags(cmd.Flags(), true) | ||
|
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.
Missing describeCmd.AddNamespaceFlags(cmd.Flags(), false). Running svcat describe class --help doesn't show the -n or --namespace option and trying to use it I get errors about unknown flag
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.
Yeah, the reason the test passes is the actual bit that compiles the command and parses junk is inside the cobra framework, so I can't test it. I have to manually reach in and set the fields.
As for filtering the plans by namespace, that shouldn't be necessary because we're filtering by the exact k8s name of the parent class (filtered through the pkg/svcat interface so it doesn't matter if it's a ServiceClass or ClusterServiceClass).
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.
As for filtering the plans by namespace, that shouldn't be necessary because we're filtering by the exact k8s name of the parent class (filtered through the pkg/svcat interface so it doesn't matter if it's a ServiceClass or ClusterServiceClass).
I was doing some poking a week ago with this review as a non-admin user and specified a single namespace on the describe class command. I got errors indicating I didn't have privs to get cluster scoped plans. So I think this is a real issue, but I'll have to wait 'til next time I have an environment up and time to reproduce. I'm fine if we address that in a separate issue.
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.
oh huh, that is interesting. Although I think that's a larger problem that the scope of this PR, because doesn't that mean you wouldn't be able to see cluster plans to know what they're called to even provision one?
@@ -112,10 +112,6 @@ func (c *getCmd) Validate(args []string) error { | |||
} | |||
|
|||
func (c *getCmd) Run() error { | |||
fmt.Println("KUBENAME: ", c.kubeName) |
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 saw this output in my last built svcat - glad you are removing this, I wasn't aware we had actually checked this in like this.
2b71b96
to
bd66bb9
Compare
test fails |
real failure, need to update the goldens and the completions |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jboyd01 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 |
bd66bb9
to
bdf851d
Compare
updated the golden files |
/lgtm |
/test pull-service-catalog-xbuild |
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:
Which issue(s) this PR fixes
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