Commit Graph

41 Commits

Author SHA1 Message Date
Zhimin Xiang 9b210e3be1
[Release-0.18] Pin knative deps to release-0.18 (#1025)
* Pin pkg to release-0.18 version

* ./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh

* bump k8s version to 1.18.8

* Fix the brokerage of importing latest serving

* exclude script/test-infra md from md check
2020-09-23 11:58:41 -07:00
David Simansky 719269e891
fix: Fix autoscaling annotations in Service metadata (#1021)
* fix: Fix autoscaling annotations in Service metadata

* chore: Add test cases

* fix: Rerun codegen

* chore: Split UpdateAnnotations to dedicated functions
2020-09-22 00:06:37 -07:00
Himanshu Ranjan 6c7fc7ca70
Add changes for --scale-init support (#990)
* Add changes for --scale-init support

* Added test cases

* Add test case in e2e tests

* minor fix

* Test case failure fix

* Incorporated review comments

* Add service update test cases

* Incorporate review comments
2020-09-15 02:51:41 -07:00
Ying Chun Guo 786ccf5d0e
Separate PodSpec flags from Service flags (#943)
* seperate PodSpec from Service flags

* loop over flag names

* remove NamePrefix and commented code, add changelog

* update pr number in changelog.adoc
2020-08-04 09:09:29 -07:00
Mike Petersen 4a3cf24550
Deprecates --max-scale/--min-scale for more consistent naming (#958)
* Depreciates --max-scale/--min-scale for more consistent naming

* Added back old flags and marked hidden
2020-08-03 16:58:27 -07:00
David Simansky 879e5bd356
feat: Add support to combine service create --filename with other options (#937)
* feat: Add support to combine service create --filename with other options

* fix: Fix spelling in usage message

* fix: Fix usage message

* fix: Add test to cover errors

* fix: Usage message wording

Co-authored-by: Roland Huß <rhuss@redhat.com>

* fix: Update codegen

* chore: Add changelog entry

* fix: Fix changelog formatting

Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-07-21 06:05:35 -07:00
Mike Petersen e1c48e6f7a
Added the option to use --scale for setting MinScale and MaxScale to the same value (#914)
* Added the option to use --scale for setting MinScale and MaxScale to the
same value

* Updated service create/update to resolve test issues

* Removed scale from the annotation section - there isn't a scale
annotation

* Renamed test service name so that it doesn't match a previous test

* Addressed most issues/changes

* Added tests for multiple flags being used at the same time

* Cleaned up the update tests

* Added negative value tests and cleaned up tests in create_test.go
2020-07-11 02:33:37 -07:00
David Simansky 41e49b98c5
feat: Add --filename flag to service create command (#913)
* feat: Add --file flag to service create cmd

* fix: Fix linter warnings

* fix: Remove unecessary changes

* fix: Reflect review feedback

* fix: Change flag --file to -f,--filename

* fix: Reflect review feedback

* fix: Move test cleanup to correct place

* fix: Refactor name param restrictions

* fix: Fix flag name string in func
2020-07-11 02:03:37 -07:00
Murugappan Chetty b04d115db9
add port name (#915)
* add port name

* add port name

* review comments

* review comments

* add unit tests for port changes

* review comments for port spec changes
2020-07-10 07:53:18 -07:00
Navid Shaikh c1ab4ae863
Update flag names to --request and --limit (#872)
* Update flag names to --request and --limit

 - Use singular flag names and support comma separated or repeated flag values
 - Update tests and docs

* Update CHANGELOG

* Update the flag description and examples

* Remove release 0.15.0 header from CHANGELOG
2020-06-03 04:04:18 -07:00
Navid Shaikh cdf6f29880
Add --requests and --limits resource flags (#859)
* Add --requests and --limits resource flags

  Fixes #490

  - Add deprecation message for --requests-cpu, --requests-memory,
  --limits-cpu and --limits-memory flag usage.

  - Add error message if new and deprecated, requests and limits flags
    are used together.

* Add resources requests and limits example for service create

* Add mock style unit tests

* Update existing unit tests for deprecated flags

* Add integration tests

* Add CHANGELOG entry

* Fix lint warnings

* Add unit tests for resource flags

* Fix typo for service name in e2e tests

* Refactor resource validation utility into test lib

* Remove commented out code

* Add references about managing resources and GPU in example

* Update image references in examples
2020-05-28 01:45:59 -07:00
Markus Thömmes 739e63f835
Replace pkg/errors with stdlib errors. (#853)
* Replace pkg/errors with stdlib errors.

* Add changelog entry.

* Fix changelog.
2020-05-25 08:10:47 -07:00
Doug Davis 030279be38
Add -a flag as alias for --annotations (#782)
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>
2020-04-10 04:45:05 -07:00
Lv Jiawei deb96303dd
Add "--target-utilization" to manage "autoscaling.knative.dev/targetUtilizationPercentage" annotation (#788)
* Support setting "autoscaling.knative.dev/targetUtilizationPercentage" annotation.
2020-04-09 03:49:03 -07:00
Doug Davis a69daf4f8f
missing paren (#735)
Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-03-11 00:03:28 -07:00
dr.max 2b9377d195
fixes(#606): adds --cluster-local / --no-cluster-local flags (#629)
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.
2020-03-10 14:24:29 -07:00
Shashwathi 81c1d9ce03
Add option for adding labels only to service and/or template (#703)
* 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>
2020-03-09 14:02:28 -07:00
Murugappan Chetty 66173059fc
Add --user flag for service create and update (#679)
* 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
2020-02-28 03:55:51 -08:00
David Simansky dd2dc97f92
Fix --image flag to only allow single occurence (#647)
* Fix --image flag to only allow single occurence

* Fix changelog link

* Reflect feedback in error message and type name

* Add unit tests

* Reflect unit tests improvement from feedback

* Fix unit tests due to changes in master
2020-02-12 03:11:21 -08:00
David Simansky 50ae82b0cc Fix capitalization of generated flags (#638)
Co-authored-by: Roland Huß <rhuss@redhat.com>
2020-02-08 06:48:14 -08:00
Roland Huß 1b9a76bc31
feature(serving): Update API to serving.knative.dev/v1 (#640)
* feature(serving): Update API to serving.knative.dev/v1

Due to an issue with 0.12.0 (a missing constant) the update also includes an update
to the latest knative-serving  and knative-eventing dependencies from master
(as reflected in version.go)

Signed-off-by: Roland Huß <roland@ro14nd.de>

* fix(serving): Bogus import removed

* fix(serving): Add missing go.sum entry
2020-02-07 02:03:14 -08:00
David Simansky ffdeafe33e
Add support for command and args in service create (#635)
* Add support for command and args in service create

* Add tests for new update functions
2020-02-04 08:45:31 -08:00
Navid Shaikh ff7dffc0a3 Add --pull-secret flag (#617)
* 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
2020-01-22 06:57:25 -08:00
Roland Huß 5001dcdc16 feature(serving): Add --autoscale-window (#614)
* feature(serving): Add --autoscale-window

Fixes #613

* chore: Update help-text for --autoscale-window

* chore: Add missing generated files
2020-01-22 00:18:23 -08:00
Lv Jiawei 99d8b2269b Handling map like options in a same way (#592)
Fixes #577
2020-01-01 22:57:41 -08:00
Doug Davis 39b7313fb0 Improve error message (#486)
While testing I specified this on the `kn` command line:

```
./kn service create echo --concurrency-limit=1 --concurrency-target=1 --env foo=bar --limits-cpu=1000m --limits-memory=1024m --max-scale=1 --min-scale=1 --port=9999 --requests-cpu=250m --requests-memory=64mi --image duglin/echo
```
and it returned:
```
unable to parse quantity's suffix
```

I had no idea which value it didn't like. So this PR makes it so the output
is now this:
```
Error parsing "64mi": unable to parse quantity's suffix
```

Still not perfect since I still had to think way too hard to realize that it
didn't like the lower-case `m`, but that's a different issue.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2019-11-06 13:21:03 -08:00
Ingwon Song 9d759ca6e4 Add support for envFrom and volumeMounts (#393)
* 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
2019-11-06 04:15:03 -08:00
Navid Shaikh a32f5666b5 Vendors serving v0.9.0 (#458)
* Vendors serving v0.9.0

* Updates references per serving v0.9.0 vendoring

 - Updates code and tests to refer the required data structure and method/function calls
 - duckv1beta1 -> duckv1 conditions
 - traffic percent value is now *int64
 - containerConcurrency validation method relocation

* fix(golint): exported function should have comment

 for NonReadyConditionReason function

* Updates check for removing null targets

 fixes the pointer value check

* Updates per review comments
2019-10-27 22:22:36 -07:00
Navid Shaikh 2f7fa6a7c2 feat(annotations): Adds annotation flag for service create and update (#422)
* 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
2019-10-04 06:40:05 -07:00
Ingwon Song 14ec594e56 Add --service-account-name flag (#401)
* 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
2019-09-23 04:45:13 -07:00
Tsubasa Nagasawa 9b52fc8345 Update EnvVars in alphabetical order of Env key name (#389) 2019-09-12 01:12:32 -07:00
Naomi Seyfer 0ff537ad98 By default, set `Image` to the image of the prev. revision by digest (#373)
* 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
2019-08-27 11:42:40 -07:00
Naomi Seyfer 25c726453e Update serving dependency to 0.8; change all import paths (#368)
* Update serving to 0.8. Try building.

* Find the right serving version

* Change our own import path to knative.dev to match

* Remove dependency on old version of client

* Update yaml template

* Add sleep to test to deal with race

* fix merge conflict

* Update vendor modules
2019-08-15 18:09:08 -07:00
Naomi Seyfer ffe80b9f87 Specify names on service update and generate names client-side. (#282)
* 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.
2019-08-14 15:31:07 -07:00
Aaron Lerner 27d8f4330a Service and Revision labels (#342)
* 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
2019-08-13 17:07:06 -07:00
Tsubasa Nagasawa b7808b0fa2 Validate scale and container concurrency options when updating configuration resource (#279)
* Validate invalid container concurrency options

* Use assert package

* Use FlagSet.Changed and don't care about default values

* Update dependency

* Follow e2e test changes

* Return error if invalid value is specified by users

* Fix broken e2e test

* Add more unit tests

* Fix error message

* Fix comment statement

* Revert back unrelated changes

* Fix typo
2019-07-25 02:57:35 -07:00
Naomi Seyfer 8d7d227785 Rename accessors to be less like methods that get from the server (#275) 2019-07-18 23:19:28 -07:00
dr.max 43b37a6747 Fixes `limits-memory` and `requests-memory` descriptions (#198)
Erroneously showed ‘CPU’ for ‘memory’ in description strings
2019-06-28 12:04:08 -07:00
savitaashture 4cc5c84264 Added changes to support container port information while creating/updating service (#191) 2019-06-28 10:48:08 -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