Commit Graph

24 Commits

Author SHA1 Message Date
Gunjan Vyas d8d0ee1e6e
Calculate traffic split when N-1 revisions are specified (#1483)
* Calculate traffic split when N-1 revisions are specified

* Added test cases for traffic split

* enhanced error messages and added example

* added e2e test

* refactored verifyInput function

* Update docs/cmd/kn_service_update.md

Co-authored-by: Navid Shaikh <shaikhnavid14@gmail.com>

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

Co-authored-by: Navid Shaikh <shaikhnavid14@gmail.com>

* added unit test for revision list error

Co-authored-by: Navid Shaikh <shaikhnavid14@gmail.com>
2021-10-29 13:24:59 -07:00
Gunjan Vyas 2a182cc7c7
Changing the Default retry value (#1463)
* Changing the Default retry value

* Moved default retry variable to pkg/config

* Removing MaxRetries constants

* Use UpdateServiceWithRetry function during service create

* remove all instances of MaxUpdateRetries
2021-10-01 07:56:07 -07:00
Roland Huß a252d9b38d
Add an update timestamp to trigger the creation of a revision when needed. (#1364)
* Add a update timestamp anytime a new revision should be triggered. Previously client side revision names was this trigger but since we switched to server-side revision naming by default that didn't work anymore (and hasn't worked with server-side revision naming before, too).

Fixes #1318.

* fix e2e test

* add some unit tests

* Update error handling + added some tests

* fixed compile error in test

* lint fixes
2021-07-26 12:17:16 -07:00
Matej Vasek c62842355a
Use context.Context in API methods (#1274)
* Refactor: add ctx param to KnServingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to ServingV1Interface

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Making wait function cancellable

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Handling SIGINT and SIGTERM

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnEventingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup style

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Removing unnecessary dependency

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnChannelsClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnSubscriptionsClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from subscriptionsClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnSinkBindingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knBindingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnDynamicClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knDynamicClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnAPIServerSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from APIServerSourcesRecorder to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnContainerSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from containerSourcesClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnPingSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from pingSourcesClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Removing ctx param from RawClient()

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* ctx for watch/polling

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix per review request

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: extract ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: Namespace not requiring ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Revert "Handling SIGINT and SIGTERM"

This reverts commit 9598646fda.

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Update CHANGELOG

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Add test for Wait()

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Add test for Wait()

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-26 09:23:20 -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
Markus Thömmes b099555c78
Enable unparam linter and fix issues (#1224) 2021-02-16 00:14:35 -08:00
Markus Thömmes 9667e4551a
Enable errorlint and fix all issues (#1223)
* Correctly wrap errors everywhere

* Use errors.As and errors.Is for safe checks and casts

* Fix condition
2021-02-12 18:27:38 -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
Navid Shaikh 45ffadecec
Drop deprecated --async flag support (#1094)
in the favor of --no-wait flag
2020-11-09 01:49:17 -08: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
Daniel Helfand 3f146b14db
Return Error Message from Using --untag with Nonexistent Tag (#880)
* return error message from using --untag with nonexistent tag

* improve err message for --untag and add e2e test

* change untagRevision to return bool and add traffic e2e tests

* update changelog
2020-06-10 23:22:23 -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 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
dr.max 70f96a102c
fix(issue #762): correct error message when updating service (#778)
* fix(issue #762): correct error message when updating service

* correct message when updating service and passing many names
* fix issue with TestServiceUpdateWithMultipleImages running create vs update

* * added TestServiceDescribeWithMultipleNames
* added TestServiceCreateWithMultipleNames
* fix error message for service delete since many names can be passed
2020-04-07 12:55:00 -07: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
Roland Huß 06d4dffd1e
feature(service update): Add generic mechanism to include retries on conflicts (#660)
* feature(service update): Add generic mechanism to include retries on conflicts

Move the retry logic for retrying in case of a resource conflict into the KnClient.

* chore: Update unit tests
2020-02-15 10:24:40 -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
Roland Huß 1b9a76bc31
feature(serving): Update API to serving.knative.dev/v1 (#640)
* feature(serving): Update API to serving.knative.dev/v1

Due to an issue with 0.12.0 (a missing constant) the update also includes an update
to the latest knative-serving  and knative-eventing dependencies from master
(as reflected in version.go)

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

* fix(serving): Bogus import removed

* fix(serving): Add missing go.sum entry
2020-02-07 02:03:14 -08:00
Navid Shaikh 5deba393cb Explicit name for serving client (#537)
* Explicit name for serving client

 - Renames NewClient to NewServingClient, since now we're adding more clients

* Add cover.html in gitignore
2019-12-08 23:42:44 -08:00
Roland Huß 6328a73c98 fix(service): Set default timeout for update to the same value as for create (#446)
Also, added accidentally removed seperator lines during create/update
2019-10-16 04:51:15 -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
Roland Huß a2d1ef7d83 chore(service): Improvements for waiting on service readiness (#431)
* Increased default timeout to 600s. This timeout will be triggered
  only when the Ready condition stays in UNKNOWN for that long. If its
  True or False then the command will return anyway sooner.
  So it makes sense to go for a much longer timeout than 60s
* Enhanced output to indicate the progress

This change needs some updates to the API and introduces a 'MessageCallback'
type which is calle for each intermediate event with the "Ready" condition message.
2019-10-10 06:06:06 -07:00
Navid Shaikh 2f7fa6a7c2 feat(annotations): Adds annotation flag for service create and update (#422)
* feat(annotations): Adds annotation flag for service create and update

  - Adds specified annotations to service object meta and revision template meta
  - Adds --annotation / -a flag to service create and update options
  - User can specify '-' at the end of the annotation key to remove an annotation
  - Adds unit and e2e tests
  - Updates docs and changelog accordingly

* Adds example for service create with annotation

* Adds mock unit tests for service update with annotations

* Removes the short hand -a for annotation flag
2019-10-04 06:40:05 -07:00
Gong Zhang a607b16b0c Rename go files under command group dir (#245)
- Files under service dir
- Files under revision dir
- Files under plugin dir

[issue 229](https://github.com/knative/client/issues/229)
2019-09-06 00:13:03 -07:00