Add command group for ContainerSource#1016
Add command group for ContainerSource#1016knative-prow-robot merged 6 commits intoknative:masterfrom
Conversation
d35403d to
b7e652e
Compare
maximilien
left a comment
There was a problem hiding this comment.
Thanks for contribution. Obviously you are missing tests so this is just quick review for initial feedback.
One key thing that I feel (and may be wrong) is whether some parts of this PR (e.g., flags parsing for env options and others) is not common to other commands? If it is can we avoid duplication?
Thanks.
Some of the flag handling is common with the flag handling of service commands group. It also contains a big refactor. Just in order to ease the review, I will submit another PR to refactor the service commands group. |
c1598b6 to
096ae12
Compare
096ae12 to
9cd3071
Compare
9cd3071 to
eb4e0f7
Compare
|
@daisy-ycguo the PR is really cool, I think we should continue to work on this to get it ready for 0.18 I think the coverage is still a bit low. @dsimansk could you give this PR a review ? That would be really awesome ! |
0076ce4 to
9239aa6
Compare
|
@rhuss sorry I've missed the first ping that was long time ago. I'll definitely take a look and review the PR. |
9239aa6 to
9676b19
Compare
maximilien
left a comment
There was a problem hiding this comment.
Some comments.
Also, any change for a e2e test? Important since that’s a feature tying multiple parts of the system. OK to do so as a separate PR.
Let me try to do e2e in this PR. Thank you for reminder. |
| v1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2" | ||
| "knative.dev/eventing/pkg/client/clientset/versioned/scheme" | ||
| clientv1alpha2 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2" |
There was a problem hiding this comment.
I wonder if we can aim for v1 here rather than v1alpha2, since it's available on current Eventing master. Therefore it will be in 0.19 release.
https://github.com/knative/eventing/blob/master/pkg/apis/sources/v1/container_types.go
There was a problem hiding this comment.
Good suggestion. I will suggest we upgrade all build-in sources (ApiServerSource, SinkBinding and ContainerSource) from v1alpha2 to v1 in another PR.
I don't see much difference in container sources between v1alpha2 and v1. We need to check the spec for other two build-in sources. Agree ?
There was a problem hiding this comment.
I have had a similar question to Navid that he actually replied to that it's fine to use older API as we want to support it until it goes away.
/cc @navidshaikh am I right here? :)
There was a problem hiding this comment.
I created an issue #1160. Let's do the upgrade in following PRs. Currently, Kn Client support only 1 version of Eventing sources, that is v1alpha2. We might not want to support v1alpha2 of apiserversource, sinkbinding and pingsource, while another version of container source.
There was a problem hiding this comment.
Yeah, we are following the "defensive" approach as described in #462
48fd3a6 to
0c910c6
Compare
829b924 to
1653c14
Compare
|
@navidshaikh @dsimansk @maximilien |
1653c14 to
c8050a0
Compare
dsimansk
left a comment
There was a problem hiding this comment.
@daisy-ycguo looks good!
I've added a few comments though, mostly around function's return handling, but those are rather cosmetic ones.
| if err == nil { | ||
| fmt.Fprintf(cmd.OutOrStdout(), "ContainerSource '%s' created in namespace '%s'.\n", args[0], namespace) | ||
| } | ||
|
|
||
| return err |
There was a problem hiding this comment.
I'd remove the explicit if err == nil check since it's going to be always true due to the condition above.
| if err == nil { | |
| fmt.Fprintf(cmd.OutOrStdout(), "ContainerSource '%s' created in namespace '%s'.\n", args[0], namespace) | |
| } | |
| return err | |
| fmt.Fprintf(cmd.OutOrStdout(), "ContainerSource '%s' created in namespace '%s'.\n", args[0], namespace) | |
| return nil |
There was a problem hiding this comment.
Good suggestions. Thank you. I changed in the new version.
| listFlags.EnsureWithNamespace() | ||
| } | ||
|
|
||
| err = listFlags.Print(sourceList, cmd.OutOrStdout()) |
There was a problem hiding this comment.
The following would be sufficient here. Just return here and remove the rest of code below.
| err = listFlags.Print(sourceList, cmd.OutOrStdout()) | |
| return listFlags.Print(sourceList, cmd.OutOrStdout()) |
| err = srcClient.UpdateContainerSource(b.Build()) | ||
| if err == nil { | ||
| fmt.Fprintf(cmd.OutOrStdout(), "Container source '%s' updated in namespace '%s'.\n", args[0], namespace) | ||
| } |
There was a problem hiding this comment.
This kind of breaks the code flow of code for me. Maybe we could first check if err != nil and display similar message error message like in create op.
| v1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2" | ||
| "knative.dev/eventing/pkg/client/clientset/versioned/scheme" | ||
| clientv1alpha2 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2" |
There was a problem hiding this comment.
I have had a similar question to Navid that he actually replied to that it's fine to use older API as we want to support it until it goes away.
/cc @navidshaikh am I right here? :)
c8050a0 to
d5ed58f
Compare
|
The following is the coverage report on the affected files.
|
dsimansk
left a comment
There was a problem hiding this comment.
Thanks @daisy-ycguo looks OK now.
/approve
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: daisy-ycguo, dsimansk, maximilien The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
David meets all criteria for an approver: - [x] Reviewer for at least 3 months - [x] Primary reviewer for at least 10 substantial PRs to the codebase, e.g. * knative#1246 * knative#1194 * knative#738 * knative#832 * knative#1016 * knative#877 * knative#667 * knative#697 * knative#1212 * knative#835 - [x] Reviewed at least 30 PRs to the codebase ([38 assigned PRs](https://github.com/knative/client/pulls?q=type%3Apr+assignee%3Adsimansk+)) - [x] Nominated by a WG lead (rhuss) Congrats David ! Thanks a lot for your awesome work & contributions.
David meets all criteria for an approver: - [x] Reviewer for at least 3 months - [x] Primary reviewer for at least 10 substantial PRs to the codebase, e.g. * knative#1246 * knative#1194 * knative#738 * knative#832 * knative#1016 * knative#877 * knative#667 * knative#697 * knative#1212 * knative#835 - [x] Reviewed at least 30 PRs to the codebase ([38 assigned PRs](https://github.com/knative/client/pulls?q=type%3Apr+assignee%3Adsimansk+)) - [x] Nominated by a WG lead (rhuss) Congrats David ! Thanks a lot for your awesome work & contributions.
David meets all criteria for an approver: - [x] Reviewer for at least 3 months - [x] Primary reviewer for at least 10 substantial PRs to the codebase, e.g. * #1246 * #1194 * #738 * #832 * #1016 * #877 * #667 * #697 * #1212 * #835 - [x] Reviewed at least 30 PRs to the codebase ([38 assigned PRs](https://github.com/knative/client/pulls?q=type%3Apr+assignee%3Adsimansk+)) - [x] Nominated by a WG lead (rhuss) Congrats David ! Thanks a lot for your awesome work & contributions.
Description
Add command groups for container source, including
Reference
Fixes #809