-
Notifications
You must be signed in to change notification settings - Fork 263
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
Get revision and service listing skeletons in. #2
Conversation
This adds the kn program, with basic commands for service and revision listing in. kn service list kn revision list They use the genericclioptions library from kubernetes to support jsonpath, yaml, and json output. The default is to just list the names of the objects, for now, until we add in some of the kubectl-based libraries for creating tables in another commit. This is deliberately bare-bones; I am looking to get the basic skeletons of how this repository is laid out down. No tests yet. Soon.
@sixolet what do you think about pattern a lot of go CLIs go with: have a cmd/kn/ directory with main.go and pkg/kn/commands/ that contains implementation of commands (similar to https://github.com/kubernetes/kubernetes/blob/master/cmd/kubectl/kubectl.go) |
i think we should also figure out how to move some of this stuff into objects instead of global variables. i've heard for example from riff folks that they want to use CLI commands as a library as well to add more of their own commands. might be a bit cleaner. we should also figure out how to only have one exit point (one |
That structure of files sounds fine and I'll make this PR so; this is just the structure generated for me by the cobra commandline, rather than something I decided was best. I'll look at the exiting and non-global suggestions and see if they fit in this PR or a separate follow-on PR or two. |
K, I think making stuff less global is going to wait; the examples I can find of Cobra best practices all have their commands global and things initialized using module init functions. Let's have conversation about how to unglobalize stuff after this is in? |
pkg/kn/commands/service_list.go
Outdated
// use the current context in kubeconfig | ||
config, err := clientcmd.BuildConfigFromFlags("", kubeCfgFile) | ||
if err != nil { | ||
panic(err.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.
return err here
pkg/kn/commands/revision_list.go
Outdated
// use the current context in kubeconfig | ||
config, err := clientcmd.BuildConfigFromFlags("", kubeCfgFile) | ||
if err != nil { | ||
panic(err.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.
return err here
ok. will wait for that.
knctl does it the same way as kubectl
ultimately all commands are combined into root cmd: https://github.com/cppforlife/knctl/blob/master/pkg/knctl/cmd/knctl.go |
Agreeing with @cppforlife on the non global variable thing. In That said, we can iterate in follow-ups if needed 👼 |
…r triggered by main.go init
/lgtm as a starting point.
i think this should be next. writing some unit tests may actually change some of the structure. |
/approve |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cppforlife, sixolet, vdemeester 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 |
…collection (knative#465) * define data structure to be shared across all functionalities among components, i.e. data collection, github issues tracking, and slack notification * Flaky tests reporting(Part 2): collects data for flaky tests discovery As discussed, flaky tests reporting consists of github issues tracking and slack notification, so it's important to decide a common data interface that can be easily consumable by both github issues trakcing and slack notification flows. This commit defines this data structure, plus logic of data collection. Update tools/flaky-test-reporter/main.go Co-Authored-By: chaodaiG <[email protected]> Update tools/flaky-test-reporter/main.go Co-Authored-By: chaodaiG <[email protected]> * update based on PR comments
# This is the 1st commit message: adding BUILT-IN SOURCE column for kn source list-types # The commit message knative#2 will be skipped: # changing list test to check for BUILT-IN SOURCE column # The commit message knative#3 will be skipped: # changing e2e source list test to check for BUILT-IN SOURCE column # The commit message knative#4 will be skipped: # adding CHANGELOG entry # The commit message knative#5 will be skipped: # kn source list-types: changing BUILT-IN SOURCE to BUILT-IN and moving DESCRIPTION column to the end # The commit message knative#6 will be skipped: # changing BUILT-IN SOURCE to BUILT-IN in changelog # The commit message knative#7 will be skipped: # Update CHANGELOG.adoc # # Co-authored-by: David Simansky <[email protected]> # The commit message knative#8 will be skipped: # kn source list-types: changing column header to S, values to X, and moving to second column # The commit message knative#9 will be skipped: # fixing CHANGELOG merge conflict
* # This is a combination of 9 commits. # This is the 1st commit message: adding BUILT-IN SOURCE column for kn source list-types # The commit message #2 will be skipped: # changing list test to check for BUILT-IN SOURCE column # The commit message #3 will be skipped: # changing e2e source list test to check for BUILT-IN SOURCE column # The commit message #4 will be skipped: # adding CHANGELOG entry # The commit message #5 will be skipped: # kn source list-types: changing BUILT-IN SOURCE to BUILT-IN and moving DESCRIPTION column to the end # The commit message #6 will be skipped: # changing BUILT-IN SOURCE to BUILT-IN in changelog # The commit message #7 will be skipped: # Update CHANGELOG.adoc # # Co-authored-by: David Simansky <[email protected]> # The commit message #8 will be skipped: # kn source list-types: changing column header to S, values to X, and moving to second column # The commit message #9 will be skipped: # fixing CHANGELOG merge conflict * adding BUILT-IN SOURCE column for kn source list-types
This adds the kn program, with basic commands for service and revision listing
in.
kn service list
kn revision list
They use the genericclioptions library from kubernetes to support jsonpath,
yaml, and json output. The default is to just list the names of the objects, for
now, until we add in some of the kubectl-based libraries for creating tables in
another commit.
This is deliberately bare-bones; I am looking to get the basic skeletons of how
this repository is laid out down.
No tests yet. Soon.