Commit Graph

1302 Commits

Author SHA1 Message Date
Adriano Cunha d4d135760c Fix command for "kn service" smoke test (#113)
It's now `get`, not `list` anymore.
2019-05-15 14:31:31 -07:00
Naomi Seyfer 5e5b46028f Disable cgo extensions in build-binaries.sh (#106)
Previously, we were running into errors on computers without cross-compilation C
headers. For simplicity of building, and because we don't need superperformant
net libs, disable cgo.
2019-05-14 12:22:31 -07:00
dr.max 570325425f addressing comments on PR #99 (#99) 2019-05-14 11:08:40 -07:00
Navid Shaikh 5b8b9d53bc Adds info message after service create and delete operations (#95)
* Adds info message after service create operation

 Fixes #87

 Aligns the service delete info message with service create too.

* Updates per review comments

 Adds newline after std imports
 Line breaks at proper operator
2019-05-14 10:44:41 -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
Doug Davis 6582e8239a Add a Makefile (#83)
Just to make it a little easier for folks.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-05-10 11:58:38 -07:00
dr.max 47a10c079d Remove fmt.Printf of error since creates double error print to user (#96)
Fixes issue #89
2019-05-10 11:54:38 -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
Navid Shaikh ba59ad8b9a Fix returning the namespace for listing resources (#88)
* Fix returning the namespace for listing resources

 Fixes #86

* Adds license to pkg/kn/commands/namespaced.go

* Adds tests for namespace flags and retrieval

* Renames test function
2019-05-09 15:55: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
dr.max 5dcc0f8641 added tests to `$kn service update ...` and removed required --image (#81)
* added tests for service update with variations of --requests/limits-cpu --requests/limits-memory
* made image optional on service update since that was not the case and image should be optional
2019-05-01 15:36:33 -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
Roland Huß 8caca4589f fix(build.sh): Fix path to built kn when printing out the version (#77)
The final step when printing out the version of the generated kn
binary uses now the proper path, so that this script can be called
from any directory (like when the cwd is hacks/).
2019-04-19 12:47:27 -07:00
Roland Huß 1cbd7138b6 chore(version): Add buildtime and git revision to version command (#76)
* chore(version): Add buildtime and git revision to version command

For that, also updated `hack/build.sh` and `hack/build-binaries.sh` to
set the values from the outside.

The file `hack/NEXT_VERSION` contains the version number of the next
release. A regular build will create version numbers in the format
"0.1.0-20190417" which according to semver.org is a version less
than 0.1.0 (i.e. a pre-release).

A release script should pick up NEXT_VERSION, make the release with
the number found there and then update to the next release, possibly
a minor a release.

* chore(build.sh): Minor cosmetic fixes

* Aligned variable name
* Streamlined console output of build scripts
* Use "2019-04-18 07:40:10" as format for build time as it used as information only

* chore(build.sh): Add GO111MODULE=on

So that the script can be used also when running from within GOPATH

* chore(build.sh): Changed shasum --> sha256sum

... as shasum is not part of coreutils, and sha256sum should be more
generally available. Made the shasum output optional, too.

* chore(build.sh): Changed from BuildTime to BuildDate

... as this better reflects the value, the date when the client was built.

* chore(build.sh): Typo fix
2019-04-18 15:53:26 -07:00
Naomi Seyfer a09bb5201a Basic service update & a test for it. (#74)
* Service update implementation.

* add test

* Update to match new namespace flag handling.
2019-04-15 17:33:00 -07:00
dr.max 7c4f05aa6b adding hack/build* to make life easy and added version command. Getting my feet wet (#69) 2019-04-15 15:51:01 -07:00
Kenjiro Nakayama 871eaadd62 Call GetNamespace to get namespace (#73)
This patch uses GetNamespace() utils in service delete command.

Fixes https://github.com/knative/client/issues/72
2019-04-15 10:56:00 -07:00
Navid Shaikh 9c21b8df24 Adds service delete command (#63)
* Adds service delete command

 This chageset adds `service delete` command, able to delete a service
 at a time.

 Fixes #49

```
kn service delete --help
Delete a service

Usage:
  kn service delete <SERVICE_NAME> [flags]

Aliases:
  delete, del, d

Examples:

  # Delete a service 'svc1' in default namespace
  kn service delete svc1

  # Delete a service 'svc2' in 'ns1' namespace
  kn service delete svc2 -n ns1
```

* Removes aliases, PreRunE and addresses review comments
2019-04-11 16:53:58 -07:00
Kenjiro Nakayama 6b2b7f2cc0 Support --all-namespaces option for service and revision list (#32)
* Support --all-namespaces option for service and revision list

`kn {service, revision} list` does not have the all-namespaces
options. Although it is possible to list them by `kn service list -n
""`(empty string), it is difficult to find such secret trick.

Hence, This patch adds `--all-namespaces` option.

* Add all-namespace option to KnParams

* Add AddNamespaceFlags function

* Add GetNamespace func

* Update help message

* Use GetNamespace util in service create cmmand
2019-04-09 09:09:58 -07:00
Navid Shaikh 8736395bcc Adds example usage in service create command (#62)
* Adds example usage in service create command

 Fixes #61
 Adds two examples to service create command as below

```
Examples:

kn service create mysvc --image dev.local/ns/image:latest

kn service create mysvc --env KEY1=VALUE1 --env KEY2=VALUE2 --image dev.local/ns/image:latest

```

* Adds double spaces in the example text

 Adding double spaces to properly aligns the example
 text while displaying help.
2019-04-08 10:51:03 -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
Kenjiro Nakayama 58e478bba4 Make image flag mandatory for service create command (#60)
`service create` command always requires and specify `--image` to run.

This patch changes:
- Add validation check if image is empty or not.
- Add image to `MarkFlagRequired()`.
- to add `--image IMAGE` in help message
2019-04-08 10:39:58 -07:00
Ben Browning aa11ceab12 Add hack/verify-codegen.sh so CI verifies vendor/ doesn't drift (#64)
Yes, the file is called verify-codegen.sh, and yes in the other
Knative projects it both verifies generated code and verifies vendored
dependencies are up-to-date. For client, it just verifies vendored
dependencies don't drift.

The test-infra scripts specifically look for a file with this name. If
we'd prefer to call this something else, we'll also need to update
test-infra to look for that something else.
2019-04-08 10:28: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 c3772a02ab `service create` beginning implementation (#47)
* Intermediate.

* Basic creation working

* Simplify

* Simple test passes

* Tests for env var updater, fix to bug found where wasnt getting a pointer

* Add some comments

* Fix env var quoting issues

* More comments from cppforlife

* Fix a couple copyrights
2019-04-03 22:33:56 -07:00
Navid Shaikh ae0e97ae3f Adds DEVELOPMENT.md (#39)
* Adds DEVELOPMENT.md

 Fixes #26
 Also adds CONTRIBUTING.md which points to knative/docs.

* Links DEVELOPMENT.md with README.md

 - also removes the build steps as those are now part of DEVELOPMENT.md
 - links the install guide to www.knative.dev/docs/install/
 - removes unnecessary GOPATH setup steps
 - removes CONTRIBUTING.md as its linked from README.md now
 - links all references for contribution guide to https://www.knative.dev/contributing/

* Updates the repo fork step and removes unnecessary heading
2019-04-02 10:36:55 -07:00
Kenjiro Nakayama e8ec699d2c Add SilenceUsage option to cobra command (#43)
* Add SilenceUsage option to cobra command

This patch adds `cmd.SilenceUsage` to command to stop usage output
after command validation.

Fixes https://github.com/knative/client/issues/38

* Set cmd.SilenceUsage to global cmd
2019-03-29 12:07:53 -07:00
Kenjiro Nakayama 72ec64390b Fix flag parse error by calling flag.Parse first (#42)
* Fix flag parse error by calling flag.Parse

Fixes https://github.com/knative/client/issues/37

* Fix workaround for parse error
2019-03-29 04:34:53 -07:00
Sam O'Dell a68d11e9b2 Update README.md (#44) 2019-03-29 04:27:53 -07:00
Naomi Seyfer ebbd659e69 go.mod and go.sum updates (#46)
* go.mod and go.sum updates

* Set GO111MODULE=on
2019-03-26 12:41:51 -07:00
Kenjiro Nakayama c07254c46d Support generating bash completion (#31)
* Support generating bash completion

This patch adds subcommand to generate completion script for bash.

As an knative user, we would like to complete subcommands and
options rather than typing them.

* Adds docs about bash auto completion in README.md

This changeset adds auto-completion section in existing README.md

Suggested-by: Navid Shaikh <nshaikh@redhat.com>
2019-03-18 22:31:05 -07:00
Timur Zununbekov be50567b38 Pickup config path from env (#27) 2019-03-14 13:47:08 -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
Navid Shaikh 139db6c4f9 Fixes typo in the kn help command (#24)
s/blokcs/blocks

 and removes few unneeded dots (.)
2019-02-25 14:49:19 -08:00
Tara Gu e6699b9b54 Add service describe (#18) 2019-02-08 14:43:44 -08:00
Charlie Drage be52528d78 Add building documentaiton (#20)
Adds documentation on how to build the project.
2019-02-07 12:04:08 -08:00
Charlie Drage bbde785a6e Add more .gitignore (#21)
Adds more .gitignore caveats
2019-02-05 14:15:03 -08:00
Scott Andrews 855ea20d40 Generate go.sum with go 1.11.5 (#19)
When building with go 1.11.5 I see a hash mismatch for knative/serving.
The algorithm for computing the hash has changed in recent go releases.

To create this PR I ran:
- `rm go.sum`
- `go test ./pkg/...`
- `go build ./cmd/kn`
- `go mod tidy`

All developers should update their version of go and clean their module
cache to flush downloaded modules with an invalid hash.
2019-02-04 16:19:49 -08:00
Nima Kaviani ad636ad789 add revision describe (#15) (#16)
* put the auth libraries in the root command

* add revision describe (#15)

* print the yaml formatted revision by default
* allow for custom formatting to be passed in
2019-02-01 15:23:13 -08:00
Naomi Seyfer 7cc59481bb
Refactor to allow testing; write first tests. (#10)
* Refactor commands to allow insertion of fakes for testing

* Pin client-go to version that matches signatures other libs use

* Add tests for service list

* actually add test file

* Review comments: Fatal instead of Error/return, Split instead of read to newline
2019-01-29 12:40:22 -08:00
Naomi Seyfer 38932b1d61
Get revision and service listing skeletons in. (#2)
* Get revision and service listing skeletons in.

This adds the kn program, with basic commands for service and revision listing
in.

kn service list
kn revision list

They use the genericclioptions library from kubernetes to support jsonpath,
yaml, and json output. The default is to just list the names of the objects, for
now, until we add in some of the kubectl-based libraries for creating tables in
another commit.

This is deliberately bare-bones; I am looking to get the basic skeletons of how
this repository is laid out down.

No tests yet. Soon.

* Move commands to pkg, so cmd only contains minimalist main.go

* RunE instead of Run. The defaults on Cobra command generation are weird.

* Oops forgot to change types of stuff

* Do not panic on bad config file

* Make commands no longer global

* Make configuration initialization not static in the module, but rather triggered by main.go init
2019-01-22 09:03:58 -08:00
Naomi Seyfer f867eb7006
Improve description in README and link to contribution guidelines (#5) 2019-01-14 12:45:17 -08:00
Naomi Seyfer fe75bdb302
Add emacs and project-specific stuff to .gitignore (#4) 2019-01-11 15:48:17 -08:00
Naomi Seyfer bfe011051b
Add OWNERS file, initially with WG leads + evan and matt (#3) 2019-01-10 17:46:31 -08:00
Mark Chmarny 7d7e3abfd6
Delete feature_request.md 2018-12-12 16:58:47 -08:00
Mark Chmarny 2d0411395f
Will replace with Knative templates 2018-12-12 16:58:30 -08:00
Mark Chmarny ea9b6b3333
Default, will replace with Knative templates 2018-12-12 16:58:07 -08:00