* 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
(and gofmt if goimports isn't available)
- Runs goimports on all packages except vendor dir and filter on only *.go files
- Runs gofmt on all dirs except vendor and filters on *.go files, also writes the results instead of printing diff
- Fixes typo s/insteat/insead
- Adds the changes after adding simply code step in hack/build.sh
- Uses source_dir var specifying the dirs to work on
- Combines gofmt commands into single command
* 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
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.
* fix(servicing): Fix logic 'service create --force' and some bogus tests
Now a more meaningful error is returned when the user tries to create
a service that already exists. Until know the service is tried
to be created even if the client already knows that it exists.
Also some broken (broken in the sense that the test was nonsense) tests has been fixed.
* chore(serving): Use constant instead of string lateral in test
- 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
* 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
* feat(build.sh): Enable goimports for cleanup imports + cleanup imports
Much like 'go fmt' for cleaning up go source, 'goimports' can help
in properly formatting and grouping imports. See https://goinbigdata.com/goimports-vs-gofmt/
for a quick overview.
This commit also cleansup imports on existing files.
* fix(build): Add missing space for output on iterm
* chore(build): Merged gofmt and goimports
And changed order so that formatting and import reordering comes
before compiling and testing
* 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
* Set current namespace from kubeconfig by default
Currently kn command does not pick up namespace from kubeconfig but
hardcorded default namespace.
This patch fixes to get namespace from kubeconfig.
Fixes https://github.com/knative/client/issues/7
* Use NamespaceFactory to get current namespace
* Update unit tests
* Add nil check for ClientConfig
* 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
* 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
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
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.
* fix(service update): Only update fields which have been sent by server.
This reflects the lemonade process step1. Tests have been adapted to
verify this behaviours.
The only situation when we update field coming from the server is for
"kn service update" for envs, image and requests/limits.
All other operation are either create (here, we always have to send the
old fields), or read (get/describe).
Fixes#144.
* chore: typo fix
* refactor(service update/create): Moved from Configuration to RevisionTemplateSpec
In order to proper handling the v1alpha1 -> v1beta1 migration methods has been updated to get rid fo Configuration within the service as this
is completely inlined in v1beta1.
The helper methods have been also updated accordingly.
I think we are good now.
* chore: Streamlined build.sh
* Merged generate-docs.sh into build.sh
* Split up into smaller functions
* Added serving dependency version to 'kn version' command
Not sure whether the latter is really useful (showing the serving dependency)
as this is might get confused with the knative version
installed on the cluster.
* chore: Fixed indentation
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
* Adds --force flag to service create command / service replace
Fixes#13
* Keeps the resourceVersion of service with --force flag
* Updates the tests
* Removes unnecessary comments
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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.
`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
* 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
* 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