Commit Graph

1302 Commits

Author SHA1 Message Date
Navid Shaikh e73a1c0348 fix(docs): Fixes kn nightly build link for Mac OS X (#427)
Fixes #425
 - Updates the link to https://storage.googleapis.com/knative-nightly/client/latest/kn-darwin-amd64
2019-10-01 07:11:08 -07:00
dr.max dba0d11320 Fixes issue #338 by adding documentation for the Kn config (#411) 2019-10-01 02:44: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
Roland Huß 6ffef8dd88 refactor(knclient): Moved KnClient -> KnServingClient (#420)
This is in preparation of introducting eventing and makes sense anyway.
Also, the GVK update handling has been moved to "util" so that it then
can be also reused by eventing.
2019-09-28 09:21:45 -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
Toshinori Sugita 43f8386b82 fix analyzer warnings (#412)
* remove unused codes (structcheck)(varcheck)

* add error handling (errcheck)

* add error handling (ineffassign)

* fix lint errors (golint)
2019-09-23 03:03:12 -07:00
Tsubasa Nagasawa 94bb1cf8db Use sets utility for saving updated env vars (#409) 2019-09-17 07:53:46 -07:00
Tsubasa Nagasawa b1f5e7d6fe Update release note section in PR template (#410)
Remove unused release note section in PR template and add instruction for updating CHANGELOG.
2019-09-16 06:18:40 -07:00
Roland Huß 34fcd89bcd chore(build): Tuned cross compiling a bit (#405)
* Renamed to --build-cross to --all (as we are not building a cross but all binaries. Could be renamed to --all-bin to be more clear)
* Fixed inclusion of external build-flags.sh script (which was broken when used build.sh with a symbolic label)
* Moved cross compiling to the end (to not interfer with --fast or --codegen)
* Aligned labels (to be short and concise)
2019-09-12 07:39:32 -07:00
Tsubasa Nagasawa 9b52fc8345 Update EnvVars in alphabetical order of Env key name (#389) 2019-09-12 01:12:32 -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
Gong Zhang b649b72694 Fill up test cases for files with low coverage (#399)
To get the test pass for https://github.com/knative/client/pull/245,
need to fill up test cases for files with low code coverage
2019-09-05 03:33:04 -07:00
Navid Shaikh 2985e550cd docs: Adds documentation for traffic splitting support in kn (#331)
- Add summary about operations, their usage and examples
 - Flags precendence explained
 - Summary column explaining if repetition is allowed or not
 - Example of different scenarios
 - Add case where tagOfOneTarget==revisionOfAnotherTarget, prefrence goes to tagOfOneTarget
   as Tags are unique while revions in a traffic block aren't.
 - Updating tag requires using `--untag` flag
 - Update doc to mention the tag update operation and example
 - Add notes about
	- assigning multiple tags for same revision
        - creating a new target in traffic if same revision is tagged with new tag
 - Update CHANGELOG
 - Add an example per sub-section of flag description
2019-09-03 13:40:01 -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 10f981ccaa Ensures kn cross platform build works in presubmit tests (#385)
Fixes #364

 - Ensure kn cross platform build works in pre-submit tests
 - Run ./hack/build.sh -x after running existing pre-submit tests
 - defines a function post_build_tests to invoke cross platform builds
 - post_build_tests will be run by test-infra after build tests are compelete
2019-08-26 10:59:17 -07:00
Toshinori Sugita 699ac5e7cb fix lint errors (#388)
* fix typo (misspell)

* ineffectual assignment to err (ineffassign)

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

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

* struct field LogHttp should be LogHTTP (golint)

* fix last typo
2019-08-24 22:46:13 -07:00
makocchi 04a55b27f2 Remove namespace from args (#386) 2019-08-22 18:00:12 -07:00
Roland Huß 9625b5f4c5 chore(plugins, services, routes): Aligned "Not found" messages (#359)
For the sake of consistency with out own service commands and for kubectl,

`kn plugin list` should print:

```
No plugins found.
```

`kn service list` should print:

```
No services found.
```

and not `No resources found.` like it does now.

Same for `kn routes list`.
2019-08-22 00:23:32 -07:00
Tsubasa Nagasawa d0dc3b75f3 feature(service list): Print NAMESPACE column as the first column when --all-namespaces is specified (#366)
* Make `kn service list --all-namespace` print namespace column

`kn service list` should print NAMESPACE column when specifying `--all-namespace` option, which follows the kubectl convention.

* Put services in default namespace at the top of the list

* Switch output of column definitions by priority field

A priority field is handled as follows:
- priority 0: print namespace column
- priority 1: print default columns
- priority 2: print additional columns for wide option

* Don't use AddFlags to bind all namespaces flag

* Update CHANGELOG

* Remove commented codes

* Fix import path

* Clean up

* Remove unnecessary return

* Swap the order of records
2019-08-21 23:57:33 -07:00
Navid Shaikh d6c798ad65 Adds option in hack/build.sh to build cross platform binaries (#371)
- Use `./hack/build.sh -x` or `./hack/build.sh --build-cross`
 - Doesn't touch any of the existing flow, providing these options will build binaries and exit
2019-08-21 16:16:33 -07:00
Naomi Seyfer 223ff5316a Pass on args to e2e tests for local script (#382) 2019-08-21 15:46:33 -07:00
Adam Harwayne 40631a6e97 Retain the request body when logging HTTP. (#378)
* Retain the request body when logging HTTP.

* hack/build.sh -u

* Add a unit test.

* Unit test redacted headers.
2019-08-21 12:23:33 -07:00
Leonardo Rossetti f97f305fed check if status detail is nil (#380) 2019-08-20 02:24:06 -07:00
Naomi Seyfer 7b90959033 Fix json path to latest revision in e2e tests to something reliable (#376) 2019-08-19 22:31:04 -07:00
Navid Shaikh dccaf36611 kn version command to list supported serving versions and APIs (#370)
Fixes #369

 - Replace `Dependencies:` with `Support:`
 - Add list of supported Serving versions kn can work with
 - Add list of supported Serving APIs kn can work with

 ```
 ✗ ./kn version
Version:      v20190816-local-e36089f-dirty
Build Date:   2019-08-16 13:08:26
Git Revision: e36089f
Support:
- Serving: v0.8.0  v0.7.1
- API(s):  v1alpha1

 ```
2019-08-19 15:25:59 -07:00
dr.max e36089f260 Add reference to plugin in README.md (#363)
* Add reference to plugin in README.md

Working on various plugins docs. This is first of three PRs.

* typo and clarification

* fix links
2019-08-15 23:16:09 -07:00
Naomi Seyfer 25c726453e Update serving dependency to 0.8; change all import paths (#368)
* Update serving to 0.8. Try building.

* Find the right serving version

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

* Remove dependency on old version of client

* Update yaml template

* Add sleep to test to deal with race

* fix merge conflict

* Update vendor modules
2019-08-15 18:09:08 -07:00
Naomi Seyfer b707702973 Always create in new format rather than old (#361)
* Always create in new format rather than old

* Rejigger tests and make them independent of filesytem

* Fix test on mergeout
2019-08-15 16:01:07 -07:00
Navid Shaikh 54d024f1bd Portable plugin executable check for Windows platform (#367)
* Portable plugin executable check for Windows platform

 builds Windows and non-Windows platform plugin verifier separately

* Removes redundant build tag and file suffix, uses file suffix

  As we'll need either to mention, which file compiles for which
  platform.
2019-08-15 15:28:07 -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
Leonardo Rossetti c4e8d5a964 improved create service error message (#312)
* improved create service error message

* error pkg

* revisions error handling

* adding license

* project rebuild

* unit test improvements

* build updates
2019-08-14 17:10: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
Naomi Seyfer dbb63d4542 Clean up bool flags a little (#362) 2019-08-14 13:02:08 -07:00
Naomi Seyfer 17df8c0dbb Bool flags in the paired `--foo` and `--no-foo` format (#346)
* Allow boolean flags in the matched `--foo` and `--no-foo` format.

* test for it

* Godoc for new functions

* Copyright date update

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

* Apply suggestions from code review

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

* Fixup
2019-08-14 11:40:08 -07:00
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
Naomi Seyfer 260411724c Wrap flag usage to terminal size (#351)
* Wrap flag usage to terminal size

* Revert downgraded deps

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

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

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

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

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-08-09 09:53:05 -07:00
Navid Shaikh c213fec7f0 docs: References golang 1.12 or later in docs (#355)
Fix #353

As we require minimum 1.12.x for building  kn
2019-08-09 08:35:05 -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
Ying Chun Guo 8c362f0363 list services sorted by alphabetical order (#330) 2019-08-09 01:00:04 -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ß f7bec15480 fix(test): Give the namespace some time setup (#348)
Supposed to fix #329
2019-08-08 12:10:57 -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
Aaron Lerner 3d3eac1dff Only test in watch mode if passed test flag (#343) 2019-08-07 01:26:55 -07:00
Doug Davis 6af3edb789 Add 'creator' annotation on create --force (#341)
Closes #340

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-08-06 13:25:55 -07:00
Tsubasa Nagasawa 8e5302c741 List revisions sorted by configuration generation (#332)
* List revisions sorted by generation order

We use a configuration generation as a sort key, which is obtained from a label on configuration resource.

* Change column name from order to generation

* Fix revision sorting issue

* Fix revision e2e test

* Just sort by name if invalid type of generation found

* Update CHANGELOG
2019-08-06 03:13:54 -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
Doug Davis 5744df3164 Update dev docs for some missing bits (#316)
Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-08-05 02:37:54 -07:00