Commit Graph

194 Commits

Author SHA1 Message Date
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
Naomi Seyfer 4874b9a384 Human-readable revision describe (#475)
* Revision describe rebaseable

* Fix up for rebase

* Some tests

* moretests

* Forgot part of the refactor!

* Fix unit tests

* Change e2e tests and respond to feedback
2019-11-05 17:43:02 -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ß 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
dr.max d543b0e5a3 fixes(#414): change plugins config to use - instead of camel case (#428)
This solves 414 by adopting new format for config keys and thereby
bypassing the need for case sensitivity in Viper. Also changed
`lookupPluginsInPath` key to `lookup-plugins` and also same for the
persistent flag. The PATH part is implied and can be read from
help.
2019-10-04 00:48:08 -07:00
Naomi Seyfer b27e366dcb Service describe: information about revision status, tags, latest [created, ready] revisions, and latest traffic (#379)
* Change symbols, add latest and latest ready

* More info on what is latest and tags. Filter annotations and labels.

* Make current tests pass

* More tests

* No longer require Annotations in test

* Add error

* Adjust tests to match adjusted output

* Respond to review comments

* one more

* Fix double printing of revisions + test for it

* Differentiate between latest traffic and latest ready w/o that being reason for traffic

* Re-build with go 1.12

* Rebased

* Limit non-verbose output to error and image

* Fix tests for new format
2019-10-03 11:33:08 -07:00
Joan Edwards ffbf6841c2 Restructure Docs (#421) 2019-09-30 07:33:45 -07:00
Ying Chun Guo 7a813be35e update the description of flag namespace (#419) 2019-09-30 01:12:51 -07:00
Ingwon Song 14ec594e56 Add --service-account-name flag (#401)
* Add --service-account-name flag

* Change the flag --service-account-name to --service-account, and change its default value from "-" to an empty string. In addition, CHANGELOG.adoc is changed.

* Update docs with ./hack/build.sh
2019-09-23 04:45:13 -07:00
Komal Dhull 679096194a Added --no-headers flag for resource listing (#262) 2019-09-03 00:31:00 -07:00
Naomi Seyfer 0ff537ad98 By default, set `Image` to the image of the prev. revision by digest (#373)
* Option to freeze revision to digest

* Tests pass. Checkpoint.

* Tests for env now check pinning to digest

* Bool flag using convention. Tweak usage.

* Describing the image carefully using the annotation and digest

* lint

* Test matrix of locking to digest behaviors

* Expose both flags, and rewrite help text again

* Unit tests.

* Removed unsed method

* Add tests for getting base revision

* Make tests actually test stuff better

* Make tests actually test stuff better

* A mergeout killed a returning of error. Restore it

* Help text again
2019-08-27 11:42:40 -07:00
Navid Shaikh 746dacc47c feature(service): Implements traffic splitting and tagging targets (#345)
- Add e2e tests
 - Use '=' for traffic and tag assignment instead of ':'
 - Use --tag and --untag flags for tagging traffic targets
 - Use --traffic flag for setting traffic portions
 - Allow --traffic portion to either take revisionName or tagName
 - Uses @latest identifier for referencing latest revision of service
 - Dont throw error if requested revision=tag pair is same
 - Support having multiple tags for a revision
	 - creates a new target in traffic block if revision present in traffic block with new tag requested
	 - creates N new targets in traffic block if revision absent in traffic block with Nxnew tags requested
 - Ensure updating tag of @latest requires --untag flag
	 - streamline updating tag for latestReadyRevision
	 - adds respective tests
	 - adds tests for ensuring given traffic sum to 100 on CLI and fail fast
 - Add note about preference of order in case where tagOfOneRevision == revisionOfAnother,
   first tags are checked and assigned traffic if any, as tags are supposed to be
   unique in traffic block and should be referenced in such scenario.
 - Remove the examples from flag description, moves it to service update command example section
 - Pass only traffic block to compute trffic, makes it better to consume.
 - Cover more error cases for invalid value format for assignments, covers a=b=c, a=, =b, or variants of them
 - Separate and improves the error messages
 - Add unit tests for traffic computing
 - Add sanity checks in dedicated function verifyInputSanity
 	  - traffic perents should sum to 100
          - individual percent should be in 0-100
          - repetition of @latest or tagName or revisionRef is disallowed
 - Verify traffic percents sum to 100 on client side and fail fast
 - Add e2e tests for traffic splitting
	 - create and update service, assign tags and set traffic to make an existing state
	 - run the scenario on existing state of service
	 - form the desired state traffic block
	 - extract the traffic block and form the traffic block struct actual state
	 - assert.DeepEqual actual and desired traffic blocks
 - Use logic to generate service name in the same way as namespace, use different service name per test case
 - Run e2e test for traffic splitting in parallel
 - Use timeout duration of 30m for e2e tests, use timeout parameter for go_test_e2e library function
 - Use tagName in flag description of --untag, avoiding conflict with --tag flag
 - Update CHANGELOG
2019-08-15 10:56:08 -07:00
Naomi Seyfer ffe80b9f87 Specify names on service update and generate names client-side. (#282)
* Groundwork for naming revisions automatically and deliberately

* Tests for name updates

* Add godoc comments

* Changelog entry for naming flags

* Error when trying to BYO revision name to an old-format service

* fix tests again

* Template the names

* Polsh, remove unused flags, generate helptext, add better helptext

* Decapitalize error msg

* Respond to Roland comments

* Forgot to add test file

* Be a good citizen, add more tests, try to get coverage happy.

* true dat

* Re-add implicit service prefix if one was not added.
2019-08-14 15:31:07 -07:00
Aaron Lerner 27d8f4330a Service and Revision labels (#342)
* Add support for service labels with --label or -l

* Add tests

* Fix typo

* Move MapToArray helper method to separate file

* Allow unsetting labels by passing empty value

* Fix test

* Add test case for label removal

* Wrap error message with flag

* Update docs to include --label

* Update labels on both services and revisions

* Add some test cases around weirder user input

* Change unset behavior and allow setting empty env and label

* Update docs for new unset behavior

* Make single keys to map to empty values

* Move helper to util

* Use assert.DeepEqual

* Use new mock test + check both service and revision

* Use new method and correct year
2019-08-13 17:07:06 -07:00
Doug Davis 74b3e10f76 Add support for -A variant of --all-namespaces (#356)
* Add support for -A variant of --all-namespaces

-A is my newest favorite kubectl flag, it's so much easier/faster to type
than --all-namespaces. kn users should benefit from it too!

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

* tweak tests

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-08-09 07:01:05 -07:00
Roland Huß 3594b39659 refactor(plugins): Improved and simplified verifier and plugin list (#313)
* refactor(plugins): Improved and simplified verifier and plugin list

* Added proper executable check for current user
* Refactor plugin_list to make it more straightforward
* Seperate errors and warnings
* Don't return an error when no plugin is installed and `plugin list` is called
* Simplified tests
* Check assumption that a prefix is given in verify()

* fix(plugins): Fixed broken homedir expansion

* fix(plugin): Adapted to proper permission handling

E.g. if u-x, g+x and the user has the group of the file, but is also owner of the file then he is not allowed to execute the file.

* test(plugins): Added checks for the execution check for plugins

* chore(plugins): optimized tests to reflect the real unix behaviour

* chore(plugins): Moved plugin seenMap to top-level verify method.

Also, allow symlinks without warnings.

* refactor(plugins): Split up some methods in plugin_verifier to make them shorter

* fix: Tuned `plugin list` for better handling when no plugin directory exists
2019-08-08 14:30:59 -07:00
Roland Huß b4b254f64c feature(service describe): Output of service details (#252)
* feature(service describe): Output of service details

`kn service show` mimics `kubectl describe <sth>` as that it output detail information in human readable output.

A future extension should add machine readable output with `-o` to export
a single object in json/yaml (that is missing from `kn service list`)

This command shows information about the service itself, but also a summary about the associated revisions.

It also knows about scaling and concurrency options.

Options:

`--details`    : Print more information. By default only are shorter summary is shown

* chore: Cleanup up and refreshed dependencies

* fix(service describe): Integration test fix (revert "show" to "describe")

* fix: go.sum

* fix go.sum

* feature(service describe): Add printing of resources (requests/limits) + machine readable output with -o

* chore(service describe): Simplified digest handling

* chore(service describe): Sort maps by key when printed

* chore: Adapt mock framework

* chore(service describe): Test fixes

* chore: Added some tests

* more tests

* test: Moar tests

* chore: Even moar tests

* more, more tests

* changelog update

* fix(service describe): golint fixes
2019-08-08 08:23:56 -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 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ß 875e8da2a5 feature(service): Wait on update for service to become ready. (#271)
* feature(service): Wait on update for service to become ready.

The behaviour is now the same as for `kn service create`. This should also fix some flakiness in the tests again.

* chore: Fixed changelog

* chore(service): Adapt help message for update

* fix(test): Updated renamed method
2019-07-22 10:52:35 -07:00
Roland Huß 55073029b4 fix(build): Minor build optimizations (#265)
* Check that every generated file has been regenerated for CI
* No color when not on a tty which is useful for build logs
* Always do updates when called without args
* Removed -u option and added -c for codegen only (dep update, docs gen, formatting, license check)
2019-07-15 13:21:27 -07:00
Jordan 385f848cbc add route describe feature and test (#251) 2019-07-12 05:06:37 -07:00
Roland Huß 9fb6a436e8 chore(wait): Fixes for Smoke Tests + help messages (#250)
* Increase wait timeout to 240s (to avoid test failures like in https://storage.googleapis.com/knative-prow/pr-logs/pull/knative_client/244/pull-knative-client-integration-tests-latest-release/1148472118510358531/build-log.txt)
* Fixed duplicate default help message for `kn service create --help`
2019-07-10 13:36:12 -07:00
Roland Huß 9f62341dcf fix: Update root docs for removing Build reference. (#244) 2019-07-10 10:48:14 -07:00
savitaashture 3eb6e41751 get a particular service and revision based on name parameter (#150) 2019-07-10 02:39:05 -07:00
Roland Huß 2ae037f3be refactor(service): Removed io.writer from of KnClient.WaitForService() (#248)
This puts all the console output to the command, where it belongs too.
One could add a ProgressHandler for more fine granular feedback (like suggested in #234) but for now this is not needed.
2019-07-08 11:57:34 -07:00
Joan Edwards 0cbc4e1b18 Bulleted components in kn.md (#243) 2019-07-08 03:25:33 -07:00
Navid Shaikh fc9b24c1e5 Add custom comparison for checking multiple substrings (#227)
* Adds custom comparison for checking multiple substrings

 This changeset introduces custom comparison for checking if a target
 string has given multiple substrings, namely `ContainsMultipleSubstrings`.

 Also removes `commands.TestContains` function and replaces all references
 of `commands.TestContains` with `gotest.tools/assert.Check` function and
 uses `ContainsMultipleSubstrings` as comparison function.

* Renames and makes the compare function variadic

 New name: ContainsAll
 New location: pkg/util/compare.go
 Also the function now takes target string as first arg,
 and accepts any number of substrings to check.
 Removed the message arg, the compare function composes the error message.
 For eg:
```
        Actual output: foo-abcd   foo       <unknown>   0 OK / 0     <unknown>   <unknown>
        Missing strings: foo-abcd1, foo1
```

* Adds tests for compare utility ContainsAll

* Update vendor/modules.txt
2019-07-05 10:07:32 -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
dr.max 43b37a6747 Fixes `limits-memory` and `requests-memory` descriptions (#198)
Erroneously showed ‘CPU’ for ‘memory’ in description strings
2019-06-28 12:04:08 -07:00
savitaashture 4cc5c84264 Added changes to support container port information while creating/updating service (#191) 2019-06-28 10:48:08 -07:00
Navid Shaikh 65f1c081ee Add kn revision delete command (#207)
* Adds kn revision delete command

* Adds unit tests for revision delete command

* Adds integration tests for revision delete command

 Added revision delete command tests in new workflow namely
 TestRevisionWorkflow.

* Removes extra line and renames an import alias

* Adds 10 seconds sleep between service create and revision delete

 Also adds check for 'No resources found' while grabbing revision name.

* Clean up imports

* Removes the pause after service create

* Updates testing output strings in unit and e2e

* Updates post goimports on hack and test dirs
2019-06-28 10:21:08 -07:00
Roland Huß a7d1bc9dc0 feat(service create): Wait for a service to be ready when its created (#156)
* feat(service create): Added --no-wait and --wait-timeout

By default, `kn service create` blocks until the service is either
created or an error occured during service creation.

With the option --no-wait the behaviour can be switched to an
async mode so that that kn returns immediately after the service is
created without waiting for a successful Ready status condition.

The timeout for how long to wait can be configured with --wait-timeout
If a timeout occur, that doesn't mean that the service is not created,
but the wait just returns. The default value is 60 seconds.

In wait mode, print out the service URL as a last line (so that it can be used together with `tail -1`) to extract the service URL after the service is created.

Fixes #54

* chore(service create): Tolerate if obeservedGeneration has not been set yet during startup

* chore(service create): Refactored based on review comments

* Introduced an --async flag (replacing --wait and --no-wait)
* Added proper retry handling on the list watch
* Updated help message

* chore(service wait): Added a new test for sync behaviour
2019-06-28 05:57:06 -07:00
Navid Shaikh 9c865a6115 List revisions for a given service (#194)
* Lists revisions for a given service

 Fixes #127

* Adds unit tests for listing revisions of a service

* Adds integration tests for listing revisions of a service

* Updates docs for listing revisions of a service

* Updates vendor/modules.txt
2019-06-20 13:29:00 -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
Navid Shaikh 5d26faa4ff Renames revision 'get' to 'list' (#180)
* Renames revision 'get' to 'list'

 As per title.

* Renames revision get references to revision list in docs
2019-06-13 13:56:51 -07:00
Navid Shaikh d25ea5f1e7 Renames service 'get' to 'list' (#179)
* Renames service 'get' to 'list'

 As per title.

* Renames get references to list in e2e tests

* Replaces get to list in docs
2019-06-13 13:56:43 -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
Roland Huß b885e41974 feat(service create/update): Add support of minScale/maxScale/concurrency-target/concurrency-limit (#157)
Autoscaler concurrency annotations are added to the revision template if
--min-scale / --max-scale / --concurrency-target/--concurrency-limit
are provided to `kn service create` and `kn service update`

Fixes #151
2019-06-08 08:27:40 -07:00
Roland Huß c10092ffae fix: Update cli-runtime to include fix for cli options help (#137)
The update to kubernetes-1.13.5 for cli-runtime introduces a fix for #135 (i.e. sorting the keys for the options)
2019-05-21 09:54:27 -07:00
dr.max 3189c30275 Adds Zsh completion (finishes issue #130) (#132) 2019-05-20 08:54:29 -07:00
Naomi Seyfer a4242b3bb5 Copy-edit documentation, and make user guide start with installation. (#125)
* Copy edit docs and add getting-started section.

* Remove hash

* list to get

* list to get
2019-05-17 16:22:16 -07:00
dr.max d8e710f389 Updates generated Cobra docs for commands and ... (#108)
Also:

1. New docs for commands
* service get
* revision get

2. Removes auto generated docs tags

3. Auto run generated docs when building to pick up any command changes
2019-05-15 15:00:32 -07:00
dr.max 95808278d4 Adds Cobra generated docs and means to generate them and first cut of other docs (#93)
* Added Cobra generated docs and ways to generate them

* Adds docs/README.md and first user's guide for Kn
2019-05-06 17:39:36 -07:00