Commit Graph

27 Commits

Author SHA1 Message Date
Roland Huß 98184eafbc refactor(serving): KnClient interface for single point of cluster access (#134)
* fix(serving): Remove hardcoded GVK and look it up from schema

Fixes #133.

* chore(serving): Add test for "WaitForService()"

* refactor(service): Add listRoutes() to client + generic way for list options

* chore(serving): Fixing rebase conflicts
2019-07-08 10:08:34 -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
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
Chi Zhang 483979bba4 Fix the periodic CI flow error in client (#200)
* hack the emitmetrics flag

* update test-infra
2019-06-27 09:53:07 -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
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
dr.max 0800d7c4d3 Regroups code to use subpackages. Finishes issue #66 (#145)
Creates four subpackages for now:

1. kn/commands - inludes types.go for common
   struct and other common files and misc commands
2. kn/commands/service - all 'kn service *' commands
3. kn/commands/revision - all 'kn revision *' commands
4. kn/core - contains the root.go and other top level
   for code and testing
5. refactors:
   a. split .../commons/human_readable_flags.go into three
   b. modifies the HumanReadableFlags.ToPrinter to get pass
      a function that sets the columns and fields

Had to refactor all tests to avoid cycles.
2019-06-05 16:30:38 -07:00
Joyce Liu 43061af74a Update test-infra to the latest version (#154) 2019-05-31 17:41:33 -07:00
Joyce Liu cf41ab2b73 update test-infra in vendor (#148) 2019-05-29 11:46:31 -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
Roland Huß 52b6b236fe Update to serving 0.6.0 (#129)
* chore: Update to 0.6.0

* chore: Fix test

* chore: Update modules.txt
2019-05-20 10:41:27 -07:00
Adriano Cunha 8bb85c6aed Fix auto releases of Knative Client (#124)
This requires updating test-infra to deal with a repo that has no releases yet.

Also use hash and dates from the helper, to keep the binary and the GCS dirs in sync.
2019-05-17 14:40:16 -07:00
Adriano Cunha 9ec9671b2e Setup release infrastructure for Knative Client (#115)
Just like the other Knative modules, and ready for automation.

Requires updating test-infra to the latest version.
2019-05-16 10:51:17 -07:00
Navid Shaikh 39034a73f9 Adds revision get command (#97)
* Renames test names for service get command

 also removes unnecessary commented imports

* Adds revision get command

 renames `revision list` ==> `revision get`

* Adds tests for revision get command

* Updates the vendors/modules.txt

* Removes revision list command
2019-05-13 13:21:39 -07:00
Navid Shaikh bd7d57fa09 Adds service get command (#90)
* Adds service get command

 replaces service list command

* Updates go.mod and vendors/*

* Adds message if no services found in requested namespace

* Adds tests for service get
2019-05-13 10:56:40 -07:00
Navid Shaikh b6d1bb47e7 Adds human-friendly table printing for resource listing (#85)
* Adds human-friendly printer

 All the credits goes to authors of https://github.com/kubernetes/kubernetes/tree/master/pkg/printers

* Updates the vendor/modules.txt

 As its updated after running hack/verify-codegen.sh

* Removes WithKind and WithNamespace printing options

 Lets start with bare minimum printer

* Adds licenses

 and references the original implementation file link.

 Removes pkg/printers/printers.go

* Removes unused imports
2019-05-09 16:27:38 -07:00
Adriano Cunha c33b1de89a License checking works now, enable it (#98)
* License checking now works, enable it

* Update test-infra

* Update vendored test-infra
2019-05-09 14:51:38 -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
Roland Huß 18ae474c77 chore: Update dependencies (#68)
* chore: Update dependency to knative-serving 0.5.1

* chore: Changed deps to released versions where possible

Rebuilt mod deps and vendor dir based on this dependency list

github.com/knative/serving v0.5.
github.com/knative/pkg v0.0.0-20190330001454-aad7a9ad4639
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.3.1
k8s.io/api kubernetes-1.14.1
k8s.io/apimachinery kubernetes-1.14.1
k8s.io/cli-runtime kubernetes-1.14.1
k8s.io/client-go v11.0.0
sigs.k8s.io/yaml v1.1.0

Not sure if all dependencies are required (e.g. is k8s.io/api required
to be specified explicitely or shouldn't we rely on k8s.io/client-go
to bring it this as a transitive dependency which maches always
the cli-runtime's version.

* chore: Update .gitignore to *not* ignore certain vendor files

* chore: Aligned with k8s version from serving 0.5.2

* chore: Run `go mod tidy`

* chore(modules): Update dependencies
2019-04-30 09:48:33 -07:00
dr.max dd4e2a917b Added support for limits and requests of CPU and memory (#78)
* Added support for limits and requests of CPU and memory. Examples:
1. kn service create mysvc --image dev.local/ns/image:latest --request-cpu 100m --requests-memory 64Mi
2. kn service create mysvc --image dev.local/ns/image:latest --limits-cpu 1000m --limits-memory 1024Mi

You can also include and/or omit the requests and limits. So the following should also work:
kn service create mysvc --image dev.local/ns/image:latest  --request-cpu 1000m --limits-memory 1024Mi

* Addressed comments about maintaining existing requests and limits and added more tests
* TestServiceCreateWithRequests
* TestServiceCreateWithLimits
* TestServiceCreateRequestsLimitsCPU
* TestServiceCreateRequestsLimitsMemory
* TestServiceCreateRequestsLimitsCPUMemory

* updating dependencies and formatting tests code
2019-04-25 20:20:29 -07:00
Ben Browning 585fe80099 Stub in an integration test (#55)
* Stub in an integration test

This just calls `kn service list` and verifies it doesn't have a
non-zero exit status.

* Build the client in pre_integration_tests

* Need to explicitly build the `kn` client

As opposed to just building the entire repo. That didn't actually
stick a `kn` binary in the root.

* Address code review feedback

Build the client in e2e-tests.sh instead of presubmit-tests.sh, fix a
couple copy/paste places that referred to eventing, remove unnecessary
knative_teardown function.

* Don't attempt to build kn twice

* Turns out pre_integration_tests() is the easiest way to build kn

We don't have any other good hooks at the moment to do something in
`e2e-tests.sh` that runs only once before the test cluster gets setup.

* Update test-infra to use the new cluster_setup function

This updates the version of test-infra to use the new cluster_setup
function added in https://github.com/knative/test-infra/pull/667

It simplifies our e2e setup logic into one place instead of being
split over presubmit-tests.sh and e2e-tests.sh

* Update vendored test-infra as well

* We have to explicitly tell CI to use the vendored modules

* Be a bit more descriptive in the stubbed out integration test
2019-04-08 10:50:58 -07:00
Naomi Seyfer fb587184c4 Actually, vendor everything (#59)
* Actually, vendor everything

* Verifier and update deps

* Dont verify codegen; we cant
2019-04-05 04:08:57 -07:00
Naomi Seyfer b5b02f64f3
Incorporate reference to knative/test-infra for setting up automated tests. (#34)
* Set up some test infra

* fix gitignore

* More mod gitignore

* Add dummy file that depends on stuff
2019-03-05 16:31:05 -08:00