Commit Graph

23 Commits

Author SHA1 Message Date
Chris Suszynski c9f128423b
💝 Extract reusable part of sink flag (#1968)
* Extract reuseable part of sink flag

* Return nil on empty sink

* Extract kube params

* Compute with default mappings

* Allow to change the default log level

* Publicate Zap based logger, and allow custom loggers to be used.
2024-09-25 10:46:31 +00:00
David Simansky 3a7d8c18ad
Add support for Eventing/v1beta2 EventTypes (#1831)
* Add support for Eventing/v1beta2 EventTypes

* Skip e2e tests on missing API

* Shortne the sink help message

* Reword the help by the review recommendation

* Reflect review feedback
2023-07-26 10:42:40 +00:00
Amir Alavi 0382c171d7
cli options to enable user, uid, and group impersonation (#1745)
* cli options to enable kubernetes user and group impersonation

Signed-off-by: Amir Alavi <amiralavi7@gmail.com>

* cli option to enable uid impersonation

Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
2022-10-13 13:11:53 +00:00
David Simansky e5b19e12ab
Update Eventing Sources API to v1 (#1299)
* Update Eventing Sources API to v1

* Update vendor dir

* Fix imports formatting

* Move PingSource client to v1beta2

* Fix sink resolve

* Fix serving version string

* Use Eventing version 0.22.1 in e2e tests
2021-05-03 03:12:58 -07:00
Navid Shaikh 885f2a9bc9
Update --sink flag description (#1271)
for referring to a Knative service in another namespace by
 'ksvc' prefix explicitly, for e.g. 'ksvc:name:namespace'
 xref: https://github.com/knative/client/pull/1264
2021-03-30 01:23:20 -07:00
Kaustubh Pande 431637a1d9
add support for namespace for all commands that takes --sink option (#1264) 2021-03-18 06:41:54 -07:00
David Simansky 671ee229f3
feat: Add `--context` flag to choose specific context from kubeconfig (#1234)
* feat: Add  flag to choose specific context from kubeconfig

* chore: Generate docs

* chore: Add changelog entry

* fix: Review feedback

Co-authored-by: Roland Huß <rhuss@redhat.com>

* chore: Add --cluster flag to specify cluster from kubeconfig

* chore: Generate docs

* chore: Update changelog

Co-authored-by: Roland Huß <rhuss@redhat.com>
2021-02-23 00:54:46 -08:00
Markus Thömmes d647e44938
Upgrade a few assorted dependencies (#1220)
* Update spf13 deps

* Upgrade gotest.tools and correctly use versioned module

* Regenerate docs
2021-02-12 05:55:50 -08:00
Navid Shaikh 26867f154d
feat: Add channel sink prefix (#1092)
* Add channel sink prefix

* Add unit and e2e tests

* Add CHANGELOG

* Fix e2e tests
2020-11-09 01:49:09 -08:00
Navid Shaikh ce519b520b
feat: Subscription CRUD (#1013)
* feat: Add subscription CRUD

 - Add kn subscription command group and CRUDL sub-commands
 - create/update uses following flag names for better alignment:
  - --sink for subscriber
  - --sink-reply for reply
  - --sink-dead-letter for dead-letter-sink
 - Add 'subscriptions' and 'sub' aliases
 - Introduce shared library `knative.dev/client/lib/printing`
   to print Sink object in describe output

* Set default channel type messaging.knative.dev/v1beta1:Channel

 i.e. if no prefix is given to `--channel`, consider it of `Channel` type

* Update e2e tests

* Update channel flag description
2020-10-01 09:44:29 -07:00
Navid Shaikh 2e1a863815
Revisit sink prefixes: Support only 'ksvc' prefix and drop 'svc', 'service' support for knative service (#896)
* Update description for sink flag

 - Add examples for broker, service and URI
 - Add note about default prefix and service alias

* Update the sink flag description

* Update cli conventions doc

* Update the sink prefixes mapping

 - 'ksvc' prefix for knative services
 -  Remove 'svc' or 'service' prefixes mapping for knative services

* Hint in err msg to use 'ksvc' if used prefixes 'svc' or 'service'

* Update CHANGELOG

* Update source list e2e tests to refer ksvc prefix

* Update sink flag description
2020-07-14 00:46:18 -07:00
Roland Huß b916a5b3ed
Add grouping for help message + streamlined help messages (#887)
* Add grouping for help message + streamlined help messages

The top-level looks like

kn is the command line interface for managing Knative Serving and Eventing objects

 Find more information about Knative at: https://knative.dev

Serving Commands:
  service     Manage Knative services
  revision    Manage service revisions
  route       List and show service routes

Eventing Commands:
  source      Manage event sources
  trigger     Manage event triggers

Other Commands:
  plugin      Manage kn plugins
  completion  Output shell completion code
  version     Show the version of this client

Use "kn <command> --help" for more information about a given command.
Use "kn options" for a list of global command-line options (applies to all commands).

The following changes have been applied:

* Add CommandGroups for grouping commands together
* Add flexible templating for the help messages
* Moved global options to an own command ('kn options', much like 'kubectl options')
* Aligned wording and typography of help messages

These features has been highly inspired by kubectl grouping & help templating but has been considerably been stripped down to the needs of kn.

Signed-off-by: Roland Huß <roland@ro14nd.de>

* chore: Add missing file

* Update pkg/templates/command_groups.go

Co-authored-by: Matt Moore <mattmoor@vmware.com>

* chore: Add some test for error messages

* fix formatting

* chore: Add test

* moar tests

* Update pkg/kn/commands/completion/completion.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/source/apiserver/delete.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/service/list.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/route/route.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/revision/delete.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/plugin/plugin.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/service/delete.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/revision/delete.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/commands/service/delete.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* regen docs

* chore: Update conventions doc

* Move some direct configuration of rootcmd to NewRootCommand()

* Moved CaptureOutput to "test" package for reuse

Co-authored-by: Matt Moore <mattmoor@vmware.com>
Co-authored-by: Navid Shaikh <nshaikh@redhat.com>
2020-06-18 00:06:25 -07:00
Roland Huß c7426459be
Refactor main flow and introduce explicit plugin and config handling (#877)
* Refactor main flow, plugin and configuration handling

* The plugin handling has been moved out of the `KnDefaultCommand` constructor where it was executed as a side-effect. The original code from `kubectl` suffers from the same issue that plugin handling is not a top-level concern but was very likely introduced as an after-thought. Instead, the plugin handling is done now by a `PluginManager` which is explicitly called in `main()`.
* Configuration and bootstrap option handling is centralized in the package `option`. After the bootstrap happened, the content of the configuration file, as well as any other global configuration, can be obtained from methods on  `config.GlobalConfig`. Also, all flag handling is delegated to cobra so that no own parsing is needed.
* Many of the logic in `pkg/kn/commands/plugin` for plugin management has been moved up to `pkg/kn/plugin` as this code is not only relevant for `plugin list` but also for the bootstrap process.

* fix: invalid subcommands will lead to a proper error message

* Update pkg/kn/config/types.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update pkg/kn/plugin/manager.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update hack/generate-docs.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* Update hack/generate-docs.go

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>

* chore: Add missing links

* chore: recert to shas in links in developer guide for now.

Co-authored-by: Navid Shaikh <nshaikh@redhat.com>
2020-06-15 09:15:24 -07:00
Navid Shaikh c1de0add97
Add --ce-override flag for apiserver and ping sources (#865)
* SinkBinding: Support update and remove of cloud events extensions

 - Add unit tests
 - Update flag description
 - Update parsing utilities for map

* APIServer: Add, update and remove cloud events extensions

 - Add --ce-override flag
 - Add unit tests

* PingSource: Add, update and remove cloud events extensions

  - Add --ce-override flag
  - Add unit tests

* Update CHANGELOG

* Update binding builder method name to CloudEventOverrides

* Fix lint warnings

* Add ceoverrides to unit test objects

* Update PR number in CHANGELOG

* Show ce-override extensions in describe output
2020-06-01 02:39:03 -07:00
Ying Chun Guo a730e98802
completed remove isController from apiserver source command group (#817) 2020-04-21 08:43:08 -07:00
Roland Huß df9278743b
chore: Update to Knative serving/eventing 0.14.0 (#810)
* chore: Update to Knative serving/eventing 0.14.0

and also move ApiServerSource to v1alpha2, adapting the option
(from "controller" to "labelSelector")

* fix go.sum

* chore: Update and fix tests

* chore: fix go.sum
2020-04-16 14:27:48 -07:00
Navid Shaikh 21ce981963
fix(docs): Revert markdown changes for cobra's auto-docs (#715)
Revert sub-set of changes from https://github.com/knative/client/pull/710 which
 are auto-generated by cobra.
2020-03-09 09:58:29 -07:00
Matt Moore f9ccf36518
Format markdown (#710)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign maximilien rhuss
/cc maximilien rhuss
2020-03-09 09:19:28 -07: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 00da0064a0 Improve 'source apiserver update --resource' (#590)
* improve 'source apiserver update --resource' to follow the common update semantics

* add more tests and update based on comments

* rebase
2020-01-28 06:49:26 -08:00
Roland Huß b10580ff72 chore(trigger): Cleanup Trigger create API (#561)
* further updates

* chore: Fix calls to apiserver create

* fix namespace issue

* fix
2019-12-17 13:39:04 -08:00
Navid Shaikh 6380fc5eaf Add cronjob and apiserver source list commands (#559)
* Add kn source cronjob list command

* Add kn source apiserver list command
2019-12-17 08:29:04 -08:00
Navid Shaikh 6ac25cdc00 Add ApiServer source update and describe commands (#556)
* Dont return created ApiServer source object but only error

 - After ApiServer source object is created, we don't need it to pass
   around in caller function.

* Align creating ApiServer source client, removes unit tests

* Add ApiServer source update command

* Rename TestMockKnClient to TestMockKnCronJobSourceClient

* Add mock client for ApiServer Source and its tests

* Add mock unit tests for create, delete and update

* Add e2e tests for apiserver source update

 - Add a test for apiserver source sink update
 - Verify the updated sink name after the apiserver source is created
 - Update resource names in existing tests

* Uses builder pattern for ApiServer source create command

* Update ApiServer source create/update flags and required config

* Uses builder pattern for ApiServer source update command

* Align create/update/delete description and error messages

* Add unit tests for get/create/update/delete in apiserver_client.go

* Update e2e tests expected output per change in commands output

* Golint fixes, Api -> API and add exported method docs

* Rename a test method and source update command description

* Add ApiServer source describe command

 - Add command and unit tests
 - TODO for later: Add 'Controller Selector' section for --verbose
2019-12-16 09:42:01 -08:00