Commit Graph

28 Commits

Author SHA1 Message Date
Roland Huß 46d5e60e42
refactor(source): Update to Knative eventing 0.13.0 (#705)
* chore(e2e): Optimized tests

Smoke Tests now run before the E2E tests, but in the same cluster

* chore: Removed unneeded test

* fix

* fix

* fix

* fix

* chore: Update to serving & eventing v0.13.0

* refactor(source): Update to Knative eventing 0.13.0

* Moved to "sources.knative.dev" API group
* Replaced CronJobSource with PingSource (and removed unsupported options for service account, requests limits)
* Move to versions:
  - SinkBinding v1alpha2
  - PingSource v1alpha2
  - ApiServerSource v1alpha1

* update to eventing 0.13.1

* go.sum fix

* fixed test

* test updates

* try to enhance error output

* fix test.

* update tests infra to 0.13.1
2020-03-06 13:47:27 -08:00
David Simansky 034a9b387e
feat(XDG home): use XDG_CONFIG_HOME as default config location (#668)
* feat(XDG home): use XDG_CONFIG_HOME as default config location

* fix: typo in comment

* feat(XDG home): update readme and usage strings
2020-02-28 06:24:51 -08:00
Ying Chun Guo d14c01fb5d
Allow configuration sink prefixes (#676) 2020-02-28 02:02:51 -08:00
David Simansky 8bca0bdfff
fix(help): initialize default help cmd early (#664) 2020-02-13 03:58:35 -08:00
Murugappan Chetty de7e3880d4 Fix misleading error message when verb is bad (#589)
* validate sub command verb (#557)

* fix review comments for pr #555

* validate sub commands

* update error message

* use inner args returned by find func

* return appropriate error message for #557

* return appropriate error message for #557

* Revert "fix review comments for pr #555"

This reverts commit 14ea8d2dc6.

* review comments for pr 589

* misleading error message when verb is bad (#557)

* misleading error message when verb is bad (#557)

* misleading error message when verb is bad (#557)
2020-01-19 23:47:04 -08:00
dr.max b640219140 load config values from viper if present in config (#468)
* init config flags in root cmd's PersistentPreRunE

* change Cfg.LookupPlugins to pointer to bool

* simplified logic in setting initial config flags from viper config
2019-12-19 02:24:31 -08:00
Ying Chun Guo 7def9f49eb Add command for creation of a plain trigger (#541) 2019-12-16 07:41:01 -08:00
Ying Chun Guo 003dba3616 Add creating ApiServerSource event source to Client (#415) 2019-12-10 03:52:46 -08:00
dr.max 1f27ecaa92 removes remaining references to 'lookup-plugins-in-path' (#481) 2019-11-11 09:56:21 -08:00
Navid Shaikh 44dafbd780 Adds zsh completion (#476)
* Adds zsh completion

 - Adds back zsh completion after vendoring cobra library with a fix
 - Updates the command definition to accept argument either of ['bash', 'zsh']
 - Moves the completion command definition under `pkg/kn/commands/completion`
 - Updates docs
 - Updates CHANGELOG.adoc

* fix(golint): exported function should have comment

* Fixes PR number in CHANGELOG.adoc

* Updates unit tests
2019-11-05 02:42:25 -08:00
Navid Shaikh df04573590 fix(version): Displays supported APIs and version (#453)
* fix(version): Displays supported APIs and version

 Fixes #404

 ```
  ./kn version
Version:      v20191017-local-6328a73-dirty
Build Date:   2019-10-17 09:55:55
Git Revision: 6328a73
Supported APIs:
- serving.knative.dev/v1alpha1 (knative-serving v0.8.0)
 ```

* Removes ServingVersion feeding from ldflags

 - hardcodes the supported APIs as they're supposed to be updated when we bump deps

* Fixes typo in e2e tests

* Uses array for deterministic order of printing supported APIs
2019-10-18 03:35:18 -07:00
Roland Huß 53125bcbdb chore: Some minor printout fixes (#442)
* chore: Some minor printout fixes

* test fixes
2019-10-11 09:51:31 -07:00
Toshinori Sugita 699ac5e7cb fix lint errors (#388)
* fix typo (misspell)

* ineffectual assignment to err (ineffassign)

* if block ends with a return statement, so drop this else and outdent its block (golint)

* should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)

* struct field LogHttp should be LogHTTP (golint)

* fix last typo
2019-08-24 22:46:13 -07:00
Naomi Seyfer 25c726453e Update serving dependency to 0.8; change all import paths (#368)
* Update serving to 0.8. Try building.

* Find the right serving version

* Change our own import path to knative.dev to match

* Remove dependency on old version of client

* Update yaml template

* Add sleep to test to deal with race

* fix merge conflict

* Update vendor modules
2019-08-15 18:09:08 -07:00
Naomi Seyfer 17df8c0dbb Bool flags in the paired `--foo` and `--no-foo` format (#346)
* Allow boolean flags in the matched `--foo` and `--no-foo` format.

* test for it

* Godoc for new functions

* Copyright date update

* Disallow user from setting either flag to false explicitly. Moar tests, for this & other cases

* Apply suggestions from code review

Co-Authored-By: Roland Huß <rhuss@redhat.com>

* Fixup
2019-08-14 11:40:08 -07:00
Naomi Seyfer 260411724c Wrap flag usage to terminal size (#351)
* Wrap flag usage to terminal size

* Revert downgraded deps

* New vendored files I missed before
2019-08-10 01:47:05 -07:00
Doug Davis 284238d4f6 Fix index out of range error (#352)
Fixed:
```
$ ./kn plugin list --lookup-plugins-in-path
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/knative/client/pkg/kn/core.extractKnPluginFlags(0xc00003c0c0, 0x4, 0x4, 0xc0002be280, 0xc000000180, 0xc0002ba180, 0xc0000de670, 0xc000117f68)
        /root/go/src/knative.dev/client/pkg/kn/core/root.go:222 +0x666
github.com/knative/client/pkg/kn/core.NewDefaultKnCommand(0xc000000000)
        /root/go/src/knative.dev/client/pkg/kn/core/root.go:46 +0x79
main.main()
        /root/go/src/knative.dev/client/cmd/kn/main.go:33 +0x46
```

While in there I fixed it so that we only look for --flag at the start
of the arg, and handle the --flag, --flag=, and --flag=xxx cases.
If there's --flagX we skip it because it's some other flag and not one
of interest to us.

Also, fixed some error processing that seemed a bit off.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-08-09 09:53:05 -07:00
Naomi Seyfer d30beba541 Add --log-http option (#326)
* Add --log-http option

* Oh yeah build it and change docs and stuff

* And some test

* Actually test the thing I meant to

* There was a way to remove the downcast

* Test for http transport

* Some deps

* Elide sensitive headers from logging

* Test for eliding errors

* Feedback from CL
2019-08-05 23:49:55 -07:00
dr.max 32470ac256 fix(bug) correct response for unknown command or plugin fixes(#309) (#322)
```bash
➜  client git:(issue309) ✗ ./kn lol
Manage your Knative building blocks:
* Serving: Manage your services and release new software to them.
* Eventing: Manage event subscriptions and channels. Connect up event sources.

Usage:
...
Use "kn [command] --help" for more information about a command.

unknown sub-command or plugin "lol" for "kn"
```
2019-08-05 01:44:55 -07:00
dr.max 59b2855d04 Implements Kn plugins re-using some code from kubectl plugins. (#249)
This version contains the following:

1. wraps the main root Kn command to support plugin
2. plugins are any executable in kn's config new pluginDir
   variable which defaults to $PATH
3. plugins must have name kn-*
4. 'kn plugin list' sub-command to list found kn plugins
5. skips any kn plugins found with name that match core
   commands, e.g., kn-service would be ignored
6. can execute any valid kn plugins found, e.g.,
   `kn valid` where the plugin file `kn-valid` is in path
   specified in 2.
7. unit tests (using gotest.tools)

And is missing:

1. integration tests
2. plugin install command
3. plugin repository command
4. plugin / Knative server version negotiation
5. anything else we agree on in plugin req doc

I plan to create issues for the things missing so we don't
end up with an even bigger PR. It's already big as is but is a
good MVP as per plugins requirement doc.
2019-07-26 13:29:48 -07:00
Roland Huß 9f62341dcf fix: Update root docs for removing Build reference. (#244) 2019-07-10 10:48:14 -07:00
Roland Huß 98184eafbc refactor(serving): KnClient interface for single point of cluster access (#134)
* fix(serving): Remove hardcoded GVK and look it up from schema

Fixes #133.

* chore(serving): Add test for "WaitForService()"

* refactor(service): Add listRoutes() to client + generic way for list options

* chore(serving): Fixing rebase conflicts
2019-07-08 10:08:34 -07:00
dr.max 500b7d1371 fixes(issue #111) generically for all command groups (#218)
Explores all sub-commands from root and adds a RunE for all
commands that are groups with child commands and without a RunE.
The added RunE will return the correct errors when the command
is called with empty sub-command or with an unknown sub-command.
It will also print the command help message first.

Added a gotest.tools test for root.go.
2019-07-02 23:50:32 -07:00
Navid Shaikh aac0ec265e Adds kn route list command (#202)
- Accepts an argument name for listing particular route
- Enables the machine readable output flags
- Updates docs for kn route command group
- Adds unit tests for route command group and route list
- Adds integration tests for route list in basic workflow test
- Updates tests and getting namespace
- Adds more unit tests for code in pkg/kn/commands/route/list_flags.go
- Adds route list command in smoke tests
- Updates vendor/modules.txt
- Clean up imports
- Addresses review comments
 - replaces knative to Knative
 - uses reflect.DeepEqual for slice comparison
 - removes few code comments
 - removes irrelevant tests modifications from the PR
2019-07-02 11:25:32 -07:00
Kenjiro Nakayama 13ff277095 Set current namespace from kubeconfig by default (#172)
* Set current namespace from kubeconfig by default

Currently kn command does not pick up namespace from kubeconfig but
hardcorded default namespace.

This patch fixes to get namespace from kubeconfig.

Fixes https://github.com/knative/client/issues/7

* Use NamespaceFactory to get current namespace

* Update unit tests

* Add nil check for ClientConfig
2019-06-24 11:23:05 -07:00
Naomi Seyfer 32ccc334e3 Revert #173 and #139, reinstating having a config file. (#193)
* Revert #173 and #139

* Change default layout to have a hidden kn dir

* Update deps
2019-06-19 18:12:58 -07:00
Kenjiro Nakayama 1b471d587f Remove unused `--config` option (#139)
* Remove unused `--config` option

Currently `--config` option in kn command is not used from anywhere.
This patch removes the option from the command.

* update auto gen files

* Update deps by hack/update-deps.sh
2019-06-08 09:03:41 -07:00
dr.max 0800d7c4d3 Regroups code to use subpackages. Finishes issue #66 (#145)
Creates four subpackages for now:

1. kn/commands - inludes types.go for common
   struct and other common files and misc commands
2. kn/commands/service - all 'kn service *' commands
3. kn/commands/revision - all 'kn revision *' commands
4. kn/core - contains the root.go and other top level
   for code and testing
5. refactors:
   a. split .../commons/human_readable_flags.go into three
   b. modifies the HumanReadableFlags.ToPrinter to get pass
      a function that sets the columns and fields

Had to refactor all tests to avoid cycles.
2019-06-05 16:30:38 -07:00