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

Update flag names to --request and --limit #872

Conversation

navidshaikh
Copy link
Collaborator

Description

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

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 3, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh

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 added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 3, 2020
 - Use singular flag names and support comma separated or repeated flag values
 - Update tests and docs
@navidshaikh navidshaikh force-pushed the pr/singular-resource-flag-master branch 2 times, most recently from 82eff15 to 8556521 Compare June 3, 2020 10:04
@navidshaikh navidshaikh force-pushed the pr/singular-resource-flag-master branch from 8556521 to 6f403b4 Compare June 3, 2020 10:05
@navidshaikh navidshaikh added the backport/candidate Consider this PR to be backported to the release branch label Jun 3, 2020
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, but I'm a bit puzzled why the type in the help doc for labels and requests/limits is different (stringArray vs string).

Do you know what the difference is ?

CHANGELOG.adoc Outdated
| Update flag names to --request and --limit
| https://github.com/knative/client/pull/872[#872]
|===

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove the v0.15.0 header as this version has never been officially released.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup, fixed.

--limits string The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'.
--limits-cpu string DEPRECATED: please use --limits instead. The limits on the requested CPU (e.g., 1000m).
--limits-memory string DEPRECATED: please use --limits instead. The limits on the requested memory (e.g., 1024Mi).
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'.
Copy link
Contributor

@rhuss rhuss Jun 3, 2020

Choose a reason for hiding this comment

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

why is the type here still string and not stringArray as for label ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if we use StringSliceVar type flags, we get strings (see traffic flags) and
if we use StringArrayVar type flags, we get stringArray

@rhuss
Copy link
Contributor

rhuss commented Jun 3, 2020

It's possible that labels use an array whereas limits/requests use a slice.

I think we should later adapt labels etc. you slices, too. + we should think about how we can share code better to avoid that kind of differences in the future.

@navidshaikh
Copy link
Collaborator Author

It's possible that labels use an array whereas limits/requests use a slice.

Yes (see traffic flags)

I think we should later adapt labels etc. you slices, too. + we should think about how we can share code better to avoid that kind of differences in the future.

Yes, we'd need to fix this for rest of the flags to work as mentioned in the examples of convention at https://github.com/knative/client/blob/master/conventions/cli.md#maps

@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/flags/resources.go 100.0% 96.6% -3.4
pkg/serving/config_changes.go 76.7% 75.8% -0.9

@navidshaikh navidshaikh removed the backport/candidate Consider this PR to be backported to the release branch label Jun 3, 2020
@rhuss
Copy link
Contributor

rhuss commented Jun 3, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 3, 2020
@knative-prow-robot knative-prow-robot merged commit c1ab4ae into knative:master Jun 3, 2020
navidshaikh added a commit to navidshaikh/client that referenced this pull request Jun 3, 2020
* 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
}
for _, c := range cases {
options := &ResourceOptions{}
options.Requests = c.requests
options.Limits = c.limits
err := options.Validate()
reqToRemove, limToRemove, err := options.Validate()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe don't call it validate as the main purpose is no to extract the values. What's about options.Extract() or options.Parse() (or options.ParseAndValidate()) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, will update the name when we unify the other similar flags.

knative-prow-robot pushed a commit that referenced this pull request Jun 3, 2020
* 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
@navidshaikh navidshaikh deleted the pr/singular-resource-flag-master branch June 3, 2020 13:19
dsimansk added a commit to dsimansk/client that referenced this pull request Nov 16, 2021
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants