* 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
- 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
* 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