* 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
* 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
* 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
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>
* 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>
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.
* 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>
* 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>
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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.
* 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
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.
* 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
* 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
* 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
- 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
* 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.
* 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
* 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>
* 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
* 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
* 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
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.
* 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
* 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)
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.
* 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.
- 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(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
* 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
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