Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --requests and --limits resource flags #859

Merged
merged 13 commits into from
May 28, 2020

Conversation

navidshaikh
Copy link
Collaborator

Description

  • Add --requests and --limits flags for service create and update
  • Deprecate --requests-cpu, --requests-memory, --limits-cpu and --limits-memory flags

Changes

  • Add service create example for using memory, CPU, GPU resources
  • Add error message if new and deprecated, requests and limits flags are used together
  • Add warning message if deprecated flags are used
  • Add unit and e2e tests, update existing unit tests

Reference

Fixes #490

/lint

Example:

GPU resource

$ kn service create hello-gpu-2 --image docker.io/mvinkler/hellocuda-go --limits nvidia.com/gpu=1
Creating service 'hello-gpu-2' in namespace 'default':
  5.175s Configuration "hello-gpu-2" is waiting for a Revision to become ready.
  5.299s Ingress has not yet been reconciled.
  5.635s Ready to serve.
Service 'hello-gpu-2' created to latest revision 'hello-gpu-2-qrcqg-1' is available at URL:
http://hello-gpu-2-default.OOO

$ curl http://hello-gpu-2-default.OOO
cuda-vector-add output:  [Vector addition of 50000 elements]
Copy input data from the host memory to the CUDA device
CUDA kernel launch with 196 blocks of 256 threads
Copy output data from the CUDA device to the host memory
Test PASSED
Done

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 26, 2020
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navidshaikh: 1 warning.

In response to this:

Description

  • Add --requests and --limits flags for service create and update
  • Deprecate --requests-cpu, --requests-memory, --limits-cpu and --limits-memory flags

Changes

  • Add service create example for using memory, CPU, GPU resources
  • Add error message if new and deprecated, requests and limits flags are used together
  • Add warning message if deprecated flags are used
  • Add unit and e2e tests, update existing unit tests

Reference

Fixes #490

/lint

Example:

GPU resource

$ kn service create hello-gpu-2 --image docker.io/mvinkler/hellocuda-go --limits nvidia.com/gpu=1
Creating service 'hello-gpu-2' in namespace 'default':
 5.175s Configuration "hello-gpu-2" is waiting for a Revision to become ready.
 5.299s Ingress has not yet been reconciled.
 5.635s Ready to serve.
Service 'hello-gpu-2' created to latest revision 'hello-gpu-2-qrcqg-1' is available at URL:
http://hello-gpu-2-default.OOO

$ curl http://hello-gpu-2-default.OOO
cuda-vector-add output:  [Vector addition of 50000 elements]
Copy input data from the host memory to the CUDA device
CUDA kernel launch with 196 blocks of 256 threads
Copy output data from the CUDA device to the host memory
Test PASSED
Done

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

pkg/kn/flags/resources.go Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 26, 2020
@lgtm-com
Copy link

lgtm-com bot commented May 26, 2020

This pull request introduces 1 alert when merging f1a41f8 into 4ba1cca - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@navidshaikh
Copy link
Collaborator Author

/lint

Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navidshaikh: 0 warnings.

In response to this:

/lint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 26, 2020
Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

pkg/kn/commands/service/create.go Outdated Show resolved Hide resolved
pkg/kn/commands/service/create_mock_test.go Outdated Show resolved Hide resolved
pkg/kn/commands/service/create_mock_test.go Show resolved Hide resolved
pkg/kn/flags/resources_test.go Show resolved Hide resolved
@rhuss
Copy link
Contributor

rhuss commented May 27, 2020

/retest

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good from my side.

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/service/configuration_edit_flags.go 84.7% 84.6% -0.1
pkg/kn/flags/resources.go Do not exist 100.0%
pkg/serving/config_changes.go 79.6% 76.7% -2.9

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks !

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 28, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, rhuss

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit cdf6f29 into knative:master May 28, 2020
dsimansk added a commit to dsimansk/client that referenced this pull request Nov 9, 2021
knative#859)

* Remove python http server from artifact image

* Fix duplicate package install

Co-authored-by: David Simansky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for requesting GPU resources
6 participants