Commit Graph

195 Commits

Author SHA1 Message Date
David Simansky 10ea0df157
Add DomainMapping CRUD commands (#1267)
* Add DomainMapping CRUD commands

* fix: Reflect review feedback

* fix: Fix prealloc lint error

* fix: Add specific reference resolution

* fix: Remove Kubernetes support in ref

* chore: Add context param to client functions
2021-04-01 08:53:23 -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
Kaustubh Pande 2ad8dfe483
add --prune & --prune-all options to delete all the unreferenced revisions (#1217) 2021-03-15 02:26:00 -07:00
Roland Huß 5f68d61295
update: Change default to server-side generated revision names (extended) (#1240)
* update: Change default to server-side generated revision names

Fixes #1144

* update: Fix wait loop for synthetic events for which the generations are already in sync

* fix assertion as a service label change does not create a new revision

* fix: --cluster-local does not create a new revision but just changes a service's label

* chore: Fixed formatting

* update: Check generation in update already before doing a watch

* fixed lint issue

* fix test assertions
2021-02-23 23:16:46 -08: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
Ville Aikas f15f2755d8
update to k8s 0.19.7, go v1.15, fix gnostic (#1206)
* update to k8s 0.19.7, go v1.15, fix gnostic

* oops, did not run ./hack/build.sh

* Fix unit tests that broke because of k8s 1.19 update

* Update asserting in test to adapt to new jsonpath output behaviour

Looks like that strings are quoted now in arrays.

* fix one more assert

Co-authored-by: Roland Huß <roland@ro14nd.de>
2021-01-28 04:35:31 -08:00
David Simansky 7eb7ac3acd
chore: Add gitops feature to changelog (#1190) 2021-01-14 06:31:19 -08:00
Murugappan Chetty f5ac4413d0
add git ops options (#1122)
* add git ops options

* add git ops options

* add unit tests

* add unit tests

* add unit tests

* add unit test

* add unit test

* add unit test

* review comments

* review comments

* add single file mode

* add single file mode

* add single file mode

* add single file mode

* review comments
2021-01-14 04:46:31 -08:00
Ying Chun Guo 45162fb5d8
Add command group for ContainerSource (#1016)
* add container source create and delete

* add update and list commands

* add describe command

* add e2e test

* add more tests

* changes to address review comments
2020-12-02 05:56:51 -08:00
kaustubh 4554c7aec8
Add machine readable output (-o flag) to kn source binding describe (#1148) 2020-11-27 05:16:35 -08:00
Arghya Sadhu 394f4be206
Add machine readable output (-o flag) to kn source ping describe (#1150)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
2020-11-27 04:30:35 -08:00
Arghya Sadhu b8bce53452
Add machine readable output (-o flag) to kn source apiserver describe (#1146)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
2020-11-26 08:31:35 -08:00
Mike Petersen ed4fa06e2e
adds --scale range option (#1114)
* adds --scale range option

* added scale range tests with negative values
2020-11-24 11:51:43 -08:00
Arghya Sadhu 0411239e37
machinerealable output for trigger (#1121)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
2020-11-24 11:12:35 -08:00
Arghya Sadhu 33d4dfd468
machine-readable output for broker (#1124)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
2020-11-18 05:11:51 -08:00
Arghya Sadhu 688d9fcab7
add url output for broker and channel (#1118)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
2020-11-17 08:24:52 -08:00
David Simansky 8d3580a4b3
chore: Remove deprecated requests/limits flags (#1110)
* chore: Remove deprecated requests/limits flags

* chore: Add changelog entry
2020-11-11 05:52:59 -08:00
David Simansky b72e4be300
feat: Add service import command (#1065)
* feat: Add service import command

* fix: Fix e2e test

* fix: Add retry when retrieving Configuration

* fix: Reflect review feedback

* fix: Fix error message

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

* fix: Add missing mock tests

* fix: Polish unit test assertions

* fix: Mark import as experimental

* chore: Add changelog entry

* Update CHANGELOG.adoc

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

* fix: Remove deprecated flag

Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-11-09 06:04:09 -08:00
Navid Shaikh 45ffadecec
Drop deprecated --async flag support (#1094)
in the favor of --no-wait flag
2020-11-09 01:49:17 -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
Roland Huß 8ca97c7920
Feature: "kn service apply" (#964)
* feat: "kn service apply"

This commit introduces a client-side apply with a plain JsonPatchMerge. This is more limited than a StrategicPatchMerg as it does not allow to merge lists (they are just overwritten). Also is not a real 3-way merger that would lead to a conflict when both the, the server-side and the provide update overlapp in fields that updated, compared to the shared original configuration. This is a problem of  JsonThreeWayMerger itself, as pointed out in https://github.com/kubernetes/kubernetes/pull/40666#pullrequestreview-502804243.

This limitation is shared with kubectl, which suffers from the same issue if using `kubectl apply` with a custom resource (i.e. with everything that has schema that is not registered within kubectl).

Tests are missing, too, but will come soon

* chore: Add tests for 'kn apply'

* refactor: Removed PatchService from pulic API interface

* fix: Display of service URL at the end, when no changes apply

* chore: Add initial E2E test

* chore: Implemented review suggestions

* More tests
* Example for kn service apply
* Remove commented-out code

* lint fixes

* fix formatting of kn service apply doc

* fixing go.sum

* chore: Update deps
2020-11-02 00:36:35 -08:00
Josh Soref 4939c5ede3
Fix various misspellings and linter items (#1057)
* spelling: additional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bindings

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: blocked

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bootstrap

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: channel

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: channel

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: commands

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: comparison

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: configuration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: controller

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: convert

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: desired

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: entry

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: execute

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: explicit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hardcoded

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: information

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inject

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: item

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubectl

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: latest

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: namespace

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: namespaces

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: output

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overriding

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: revision

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: separated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: separator

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: service

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specifies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: splitting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subscription

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trigger

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unstructured

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: workflow

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* chore: Address golinter complaint for (c *MockKnServingClient) GetBaseRevision

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* chore: update changelog for spelling fixes (#1057)
2020-10-12 21:24:30 -07:00
Navid Shaikh 145c9f0522
fix(docs): Fix message broker doc (#1056) 2020-10-09 04:12:21 -07:00
Daniel Helfand 9931c2d07a
add aliases to help command and remove aliases in short (#1055) 2020-10-09 00:09:21 -07:00
kaustubh d9d52346e7
feat: List available channel types (#1027)
* add channel list-types

* add kn channel list-types doc
2020-10-06 13:17:20 -07:00
Arghya Sadhu 5025137f5a
add alias to commands (#1041) 2020-10-06 03:57:21 -07: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
Arghya Sadhu e8ae0e1537
adding annotation-service and annotation-revision to kn create/update (#1029) 2020-09-30 07:48:29 -07:00
Himanshu Ranjan 6c7fc7ca70
Add changes for --scale-init support (#990)
* Add changes for --scale-init support

* Added test cases

* Add test case in e2e tests

* minor fix

* Test case failure fix

* Incorporated review comments

* Add service update test cases

* Incorporate review comments
2020-09-15 02:51:41 -07:00
David Simansky a1b4f39814
fix: Fix service export example doc (#1006)
* fix: Fix service export example doc

* chore: Update changelog

* fix: Add newline divider
2020-09-11 04:07:00 -07:00
Navid Shaikh 78ef3bb3f0
Fix channel create example with inbuilt alias for imcv1beta1 (#1005)
use `imcv1beta1` alias reference in the example
2020-09-10 02:56:51 -07:00
Navid Shaikh 5ed353d36b
feat(channel): Manage knative eventing channels (#967)
* feat(channel): Manage knative eventing channels

- Support specifying the type of channel to create using --type.
 - Default is to use messaging layer configuration for channels
- Channel type aliases via kn config and alias for InMemoryChannel
 - User can now configure channel type aliases in kn config and specify
   alias to GVK mappings for easy reference on CLI and refer with `--type` flag
 - User can also use inbuilt alias 'imc' for InMemoryChannel

* Let channel reconcile, sleep for 5 secs after creation

* Add imcv1 and imcv1beta1 aliases

* Rename imcv1 alias to imc
2020-08-25 09:25:49 -07:00
Mike Petersen 4a3cf24550
Deprecates --max-scale/--min-scale for more consistent naming (#958)
* Depreciates --max-scale/--min-scale for more consistent naming

* Added back old flags and marked hidden
2020-08-03 16:58:27 -07:00
David Simansky 879e5bd356
feat: Add support to combine service create --filename with other options (#937)
* feat: Add support to combine service create --filename with other options

* fix: Fix spelling in usage message

* fix: Fix usage message

* fix: Add test to cover errors

* fix: Usage message wording

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

* fix: Update codegen

* chore: Add changelog entry

* fix: Fix changelog formatting

Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-07-21 06:05:35 -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
Mike Petersen e1c48e6f7a
Added the option to use --scale for setting MinScale and MaxScale to the same value (#914)
* Added the option to use --scale for setting MinScale and MaxScale to the
same value

* Updated service create/update to resolve test issues

* Removed scale from the annotation section - there isn't a scale
annotation

* Renamed test service name so that it doesn't match a previous test

* Addressed most issues/changes

* Added tests for multiple flags being used at the same time

* Cleaned up the update tests

* Added negative value tests and cleaned up tests in create_test.go
2020-07-11 02:33:37 -07:00
David Simansky 41e49b98c5
feat: Add --filename flag to service create command (#913)
* feat: Add --file flag to service create cmd

* fix: Fix linter warnings

* fix: Remove unecessary changes

* fix: Reflect review feedback

* fix: Change flag --file to -f,--filename

* fix: Reflect review feedback

* fix: Move test cleanup to correct place

* fix: Refactor name param restrictions

* fix: Fix flag name string in func
2020-07-11 02:03:37 -07:00
Murugappan Chetty b04d115db9
add port name (#915)
* add port name

* add port name

* review comments

* review comments

* add unit tests for port changes

* review comments for port spec changes
2020-07-10 07:53:18 -07:00
Himanshu Ranjan e6f125fd4e
Add support for service url in svc describe output (#916)
* Add support for service url in svc describe output

* Add changes in CHANGELOG.adoc

* Update CHANGELOG.adoc

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

* Add url as output format in kn service describe --help command

* Build locally and autogenerated doc

* Change service describe help message for consistency

Co-authored-by: Matt Moore <mattmoor@vmware.com>
2020-07-07 13:44:44 -07:00
David Simansky 1f59f5341c
Add broker create, delete and list cmds (#894)
* Add broker create, delete and list cmds

* fix: Fix copyright headers

* fix: Fix linter warnings

* Update pkg/kn/commands/broker/create.go

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

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

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

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

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

* feat: Add broker describe command

* fix: Fix copyright header

* fix: Fix linter issues

* fix: Fix broker describe test

* fix: Fix order of eventing cmds

* chore: Add e2e tests

* fix: Fix e2e tests annotation

* fix: Reorder e2e tests methods

* feat: Add synchronous broker delete option

* fix: Fix broker describe example

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

* fix: Fix variable name

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

* fix: Fix broker list example formatting

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

* fix: Fix eventing client func name

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

* fix: Reflect changes from PR review suggestions

* fix: Fix formatting of cmd examples

* fix: Fix formatting of cmd examples & trailing spaces

* fix: Polish eventing client docs

* fix: Fix examples alignment

Co-authored-by: Roland Huß <rhuss@redhat.com>
Co-authored-by: Navid Shaikh <nshaikh@redhat.com>
2020-06-23 02:43:26 -07:00
Roland Huß 94e84d4ee0
fix: Add mandatory --sink to ping source command's name (#903) 2020-06-23 00:45:26 -07:00
Murugappan Chetty f869b44d66
add kn export type (#856)
* add kn export type

* add kn export type

* add kn export type

* Update pkg/apis/client/register.go

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

* e2e test for kn export type

* e2e test for kn export type

* add new type for kn export

* rebase

* rebase

Co-authored-by: Roland Huß <rhuss@redhat.com>
Co-authored-by: Matt Moore <mattmoor@vmware.com>
Co-authored-by: Roland Huß <roland@ro14nd.de>
2020-06-18 02:33:25 -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 c1ab4ae863
Update flag names to --request and --limit (#872)
* Update flag names to --request and --limit

 - Use singular flag names and support comma separated or repeated flag values
 - Update tests and docs

* Update CHANGELOG

* Update the flag description and examples

* Remove release 0.15.0 header from CHANGELOG
2020-06-03 04:04:18 -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
Navid Shaikh cdf6f29880
Add --requests and --limits resource flags (#859)
* Add --requests and --limits resource flags

  Fixes #490

  - Add deprecation message for --requests-cpu, --requests-memory,
  --limits-cpu and --limits-memory flag usage.

  - Add error message if new and deprecated, requests and limits flags
    are used together.

* Add resources requests and limits example for service create

* Add mock style unit tests

* Update existing unit tests for deprecated flags

* Add integration tests

* Add CHANGELOG entry

* Fix lint warnings

* Add unit tests for resource flags

* Fix typo for service name in e2e tests

* Refactor resource validation utility into test lib

* Remove commented out code

* Add references about managing resources and GPU in example

* Update image references in examples
2020-05-28 01:45:59 -07:00
Navid Shaikh 8c4a28e466
docs: Update kn service create examples with real image (#862)
Fixes #673
 - uses image: `knativesamples/helloworld`
2020-05-27 17:21:59 -07:00
Brian Tannous c7d28d5401
Update kn_completion for ZSH (#844)
Fixes: https://github.com/knative/client/issues/839
2020-05-19 03:09:56 -07:00
Daniel Helfand 6f615c6595
add kn service delete --all (#836) 2020-05-14 03:51:59 -07:00
Murugappan Chetty 644ecb68e5
refactor kn service export to export revisions (#819)
* refactor kn service export to export revisions

* refactor kn service export to export revisions

* refactor kn service export to export revisions

* refactor kn service export to export revisions

* kn service export refactor

* kn service export refactor

* kn service export refactor

* kn service export refactor

* review changes for #819
2020-05-05 02:19:44 -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 46ecdcc32f
Make wait, no-wait and async flags per bool var CLI convention (#802)
* Make wait, no-wait and async flags per bool var CLI convention

 Fixes #800

 - Deprecated bool vars can be supported for CLI convention
 - Bind --async flag value to --no-wait
 - Only one flag among [wait, no-wait, async] can be provided, else raise an error

* Simplify conditionals

* Add unit tests for deprecated flag async

* Fix a typo
2020-04-14 12:36:16 -07:00
Doug Davis 030279be38
Add -a flag as alias for --annotations (#782)
I find that I'm using annotations more and more and since `-a`
wasn't being used I decided we should save people from typing too much

Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-04-10 04:45:05 -07:00
Lv Jiawei deb96303dd
Add "--target-utilization" to manage "autoscaling.knative.dev/targetUtilizationPercentage" annotation (#788)
* Support setting "autoscaling.knative.dev/targetUtilizationPercentage" annotation.
2020-04-09 03:49:03 -07:00
Doug Davis de1248412f
Remove the delete propagation flag (#770)
* Remove the delete propagation flag

In it's current state it now takes me about 25 seconds for the `kn delete`
to complete. Before https://github.com/knative/client/pull/682 it used to be
almost immediate. This is because we now pass in the
`DeletePropagationBackground` flag. I believe this is a mistake, not only
because of the 20+ seconds of additional time to delete things, but IMO
the CLI should talk to the server in the same way regardless of the --wait
flag. That flag should just be a CLI thing to indicate if the user wants the CLI
to wait for the server to complete but not HOW the server should do the delete.

Signed-off-by: Doug Davis <dug@us.ibm.com>

* try just tweaking the --no-wait flag

Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-04-08 03:35:01 -07:00
Navid Shaikh e88ee59d45
Update sink binding create usage string (#785) 2020-04-07 16:51:00 -07:00
David Simansky 58ee9c4788
fix(trigger): Make --filter flag truly optional (#745)
* fix(trigger): Make --filter flag truly optional

* fix(trigger): Update trigger docs

* chore: Update changelog
2020-03-18 06:39:06 -07:00
Murugappan Chetty a858a25135
e2e for service export (#739)
* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export
2020-03-17 15:29:05 -07:00
Doug Davis a69daf4f8f
missing paren (#735)
Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-03-11 00:03:28 -07:00
dr.max 2b9377d195
fixes(#606): adds --cluster-local / --no-cluster-local flags (#629)
When specified on 'service create' the '--cluster-local' flag will
make the created service 'private' by setting its config visibility
to 'cluster-local'. This is done with label:

serving.knative.dev/visibility: cluster-local

The --no-cluster-local will remove the label.
2020-03-10 14:24:29 -07:00
David Simansky 8dbf4394a1
feat(trigger): add --inject-broker flag to trigger create command (#726)
* feat(trigger): annotate trigger to inject default broker

* chore: update changelog

* fix: reflect review feedback

* fix: code comment wording

* fix: reflect review feedback
2020-03-10 11:32:28 -07:00
Roland Huß a0f13548a6
chore(service export): Rename `--history` to `--with-revisions` (#729) 2020-03-10 10:04:28 -07:00
Murugappan Chetty 5c794d3b04
add "kn service export" (#653) (#669)
* add kn export (#653)

* add kn export (#653)

* review comments for #669

* add kn export command

* add kn export command

* add kn export command

* add kn export command

* add changelog for pr 679

* add changelog

* review comments for pr #669

* review comments for pr #669

* review comments for kn export
2020-03-10 02:53:28 -07:00
Navid Shaikh ba7e14c807
feat(source): Add 'kn source list' (#666)
* feat(source): Add 'kn source list'

 Fixes #480
 - Add 'kn source list' listing the available sources COs
 - Use dynamic client to
       - find out available source types
       - find the COs in given namespace for each source type
 - Add --type flag to filter source list based on source type
 - Add unit tests
 - Add e2e tests
 - Add CHANGELOG entry

* Update group for ApiServerSource in tests

* Add kn duck source type for holding common eventing source fileds

 - Common infromation from sources are extracted into a struct
   for source list command output
 - Printer function picks the information from this struct object
   and doesn't know the details about extracting this info from multiple
   types of sources received
 - Group and Version for list is set to empty string and Kind to 'List',
   if printed a source list with multiple types of sources in machine readable
   format
 - Group, Version and Kind for list are kept intact if printed a source list
   with same type of source objects in machine readable format

* Update go.sum

* Add WithType builder for listing source

 - Separate the flags definition
 - WithType builder can be re-used to filter the source types
 - Add unit tests

* Update ApiServer source group to apiserversources.sources.knative.dev

* Fix typos and align

Co-authored-by: Roland Huß <roland@ro14nd.de>
2020-03-10 00:41:28 -07:00
Shashwathi 81c1d9ce03
Add option for adding labels only to service and/or template (#703)
* Add option for adding labels only to service and/or template

In this PR we are introducing 2 additional flags for setting label for
service(label-service) and revision(label-revision) only.

Signed-off-by: Andrew Su <asu@pivotal.io>

* Update docs

Signed-off-by: Andrew Su <asu@pivotal.io>

* Add changelog entry

Signed-off-by: Andrew Su <asu@pivotal.io>

* Refactor UpdateLabels method to be more generic.

* Refactored labels common code.

Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>

* Pass pointer refernce instead of copy to update labels

Co-authored-by: Roland Huß <roland@ro14nd.de>
Co-authored-by: Andrew Su <asu@pivotal.io>
2020-03-09 14:02:28 -07:00
Navid Shaikh 14a5e83765
feat(version): Add JSON/YAML output formats for version command (#709)
* feat(version): Add JSON/YAML output format for version command

 Fixes #513

* Loop for supported apis in template
2020-03-09 11:11:29 -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
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
Ying Chun Guo e6c7d2859d
Add serviceaccount & resources config to cronjob source (#665)
Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-03-04 00:51:53 -08:00
David Simansky b14dc2dc7f
feat(wait): add sync revision delete operation (#688) 2020-02-29 06:09:51 -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
Murugappan Chetty 66173059fc
Add --user flag for service create and update (#679)
* add run as user flag #678

* add run as user flag #678

* add changelog for pr 679

* review comments  for pr 679

* review comments  for pr 679

* add test for config changes

* add user flag
2020-02-28 03:55:51 -08:00
David Simansky 345653bfe0
feat(wait): add wait for delete operation (#682)
* feat(wait): add wait for delete operation

* feat(wait): refactor initial impl

* fix(lint): add docs to new functions

* fix: reflect code review comments

* feat(wait): add changelog entry

* fix: changelog entry to render correctly

* fix: usage message of wait flag

* feat(wait): set foreground propagationPolicy in sync service delete

* feat(wait): add sync revision delete operation

* Revert "feat(wait): add sync revision delete operation"

This reverts commit 9bb60ac25e.
2020-02-25 02:38:50 -08:00
Navid Shaikh a44833c849
fix typo in source list-types examples (#684)
* Fix typo in kn source list-types example

* Update other list command examples
2020-02-21 03:38:06 -08:00
Navid Shaikh 15dec583ca
Implement human readable output for kn route describe (#643)
* Implement human readable output for kn route describe

 - Keeps the machine readable output
 - Align the command description text, check for single argument, reported error messages and unit tests in service, revision, route, source binding describe commands

* Dont print separate section for owner references

* Print Service heading irrespective of owner.Kind == Service

* Align desc, err msg for trigger, apiserver and cronjob source
2020-02-10 07:46:07 -08:00
David Simansky 50ae82b0cc Fix capitalization of generated flags (#638)
Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-02-08 06:48:14 -08:00
David Simansky 8d2ecca7ae
Rename --async to --no-wait and deprecate it (#639)
* Rename --async to --no-wait and deprecate it

* Polish wording of deprecation warning message
2020-02-08 02:52:14 -08:00
Lv Jiawei 16bbfa37ed
Add E2E test for "kn source binding" commands (#634)
Fixes #631

* Add E2E test for "kn source binding" commands.
* Fix typo.
2020-02-07 14:37:14 -08:00
David Simansky ffdeafe33e
Add support for command and args in service create (#635)
* Add support for command and args in service create

* Add tests for new update functions
2020-02-04 08:45:31 -08:00
Roland Huß 164cb5f362
feature(source binding): Support for Sink Binding as source (#625)
* feature(source binding): Support for Sink Binding as source

Sink bindings are managed like any other source. Sinks are specified as usual (with prefix and name),
'subjects' (the other end of the binding) is managed via a shortcut notation:

* with name: `<kind>:<apiVersion>:<name>`
* with label selector: `<kind>:<apiVersion>:key1=value1,key2=value2`

With `--subject-namespace` and additional namespace can be provided (shoudl be possible for a sink, too but is not yet)

The implementation already uses the new sink binding from the `sources.knative.dev` group
and hence is a bit inconsistent to the still old usage kf `sources.eventing.knative.dev` for apiserver source and cronjob.

However as we will move over to `sources.knative.dev` very soon (right after v0.12.0) release,
this is was more appropriates.

Still WIP, but eventually fixes #624

Task list:

- [X] create
- [] update
- [] delete
- [] describe
- [] list

* fix(source binding): Added missing commands

Also, it looks like that knative eventing 0.12.0 is still on the old api group.
So I need to move this code to use the legacyclient, too, for the sink binding
and only switch over to the new client for 0.13.0

* feature(source binding): Added missing subcommands

* update
* delete
* list
* describe

* fix(source binding): Removed --subject-namespace as this namespace cant b set.

Tuned describe output a bit.

* feat(source binding) add support for CeOverride

* fix: Worked on review comments

* fix: review comments

* fix: names in binding client
2020-01-29 12:08:27 -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
Navid Shaikh ff7dffc0a3 Add --pull-secret flag (#617)
* Add --pull-secrets flag

 Fixes #616

 - Add --pull-secrets flag for service create/update operations
 - Setting empty string to flag clears the pull secrets
 - List ImagePullSecrets for service in `service describe` default output
 - Run e2e tests against latets serving v0.12.0 (ImagePullSecrets introduced in v0.11.1 release)

* Space separated field name for describe and update flag help msg

 - Update the key name in service describe:
  - ImagePullSecrets --> Image Pull Secrets
  - ServiceAccount --> Service Account
 - Update the help message for --service-account and --pull-secrets
2020-01-22 06:57:25 -08:00
Roland Huß 5001dcdc16 feature(serving): Add --autoscale-window (#614)
* feature(serving): Add --autoscale-window

Fixes #613

* chore: Update help-text for --autoscale-window

* chore: Add missing generated files
2020-01-22 00:18:23 -08:00
Ying Chun Guo 71c9238b7e Enable trigger filter to be optional (#603)
* Enable trigger filter to be optional

* remove RemoveFilters from builder
2020-01-13 23:33:04 -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
Ying Chun Guo 8b1434b789 Add trigger update command (#562)
* add trigger update command

* add trigger update test
2019-12-17 07:10:04 -08:00
Ying Chun Guo 60b88017a9 add trigger list (#558) 2019-12-17 01:00:08 -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
Ying Chun Guo 7def9f49eb Add command for creation of a plain trigger (#541) 2019-12-16 07:41:01 -08:00
Roland Huß 0ca6f14d4a feature(source cronjobs): Implementation of CronJobSource management (#542)
* feature(source cronjobs): Implementation of CronJobSource management

Contains create/delete/update/describe but not tests yet.

Still todo:

* Think how to provide a namespace for the sink
* Support for more sinks
* Synchronous mode for create & update
* Add list (or implement "source list")

* chore: Add a mock test for cronjob source

* addd missing license headers

* cosmetic changes

* chore(cronjobsource): Add tests

* fixup

* chore(cronjob source): Improved test coverage

* chore(cronjob source): some review polishing
2019-12-13 01:27:53 -08:00
Navid Shaikh 7dbb5a5bb0 kn source list-types (builtin types) (#536)
* feat: kn source list-types (builtin types)

 - Only lists the builtin source types
 - Uses client-go dynamic client for listing CRDs
 - Adds DyanmicClient interface to KnParams
 - Adds printing options

* chore(lint): Address golint suggestions

* Rebase and update venodr/modules.txt

* Adds unit tests for DynamicClient in types.go

* Add kn source list-types command in smoke tests

* Constants for the CRD GVR and source identifier label key value

 GVR as:
   - Group: apiextensions.k8s.io
   - Version: v1beta1
   - Resource: customresourcedefinitions
 Label as:
   {"duck.knative.dev/source": "true"}

* Add tests for dynamic client

* Add description about SinkBinding source type

  as - "Binding Pattern for ContainerSource"

* Remove unused imports

* Adds unit tests for list-types command processing

* More unit tests for flags

* Adds e2e tests for kn source list-types

  - also test the YAML output

* Sort the source types while listing them

 - Update the unit tests accordingly

* Add examples

* Add unit tests for CreateDynamicTestKnCommand

* Fix typo in unit tests

* golint fixes

* Updates to vendor/modules.txt after rebase

* Remove the extra lines
2019-12-10 11:20:47 -08:00
Ying Chun Guo 003dba3616 Add creating ApiServerSource event source to Client (#415) 2019-12-10 03:52:46 -08:00
Navid Shaikh c4a919718d Add completion to help message (#478)
Fixes #477
2019-11-12 01:32:23 -08:00
Ingwon Song 9d759ca6e4 Add support for envFrom and volumeMounts (#393)
* Add support for envFrom, volumeMounts, serviceAccountName, and imagePullPolicy

* Add comments for added functions

* Add test functions for --env-from

* Add test functions for --volume-mount

* Add test functions for --service-account-name and --image-pull-policy

* Add testing functions to cover the case "service update --env-from"

* Add test functions to cover the case "service update --volume-mount"

* Add missing test functions for config_changes.go

* Add testing functions for pkg/util/parsing_helper.go

* Fix a bug on a test case, caused by ignoring random orderedness of map

* Remove image-pull-policy because it is not supported by Knative

* Fix comments to clarify it as well as to fix a typo

* Remove service-account-name flags in order to submit it as a seperate PR

* Split --volume-mount flag into --volume-mount and --volume flags in order to enable multiple times mounting for the same volume

* Change the name of local variable to simplify

* Update docs

* Change the flag "--volume-mount" into "--mount", and fix it to make volume automatically when the config-map or secret is directley used. In addition, the test cases are changed to new unit test style. To keep the original orderedness given via flags, OrderedMap implementation is added as well

* Fix usage descriptions for the mount flag

* Factor out the name existence checking from createEnvFromSource

* Fix the usage description for --mount

* Sanitize a generated volume name
2019-11-06 04:15:03 -08:00