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 --tag flag to service create and allow traffic split <100 when @latest is specified #1514

Merged
merged 10 commits into from
Nov 29, 2021

Conversation

vyasgun
Copy link
Contributor

@vyasgun vyasgun commented Nov 8, 2021

Description

Add --tag flag to service create and interpret just value arguments to the flag as @latest=value
When @latest is specified as argument to --traffic and sum < 100, calculate the remaining revision

Changes

  • The arguments that don't follow key=value format and just value format will be treated as @latest=value
  • service create will have a --tag flag so revision is created with a tag
  • Updating traffic split for a service when @latest is specified and the total sum is less than 100 for a service with N revisions will work as follows:
    • If the update leads to a new revision creation, total N key=value arguments need to be specified for --traffic
    • If the update does not create a new revision, total N-1 key=value arguments need to be specified for --traffic

Reference

Fixes #

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 8, 2021
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.

@vyasgun: 3 warnings.

In response to this:

Description

Add --tag flag to service create and interpret just value arguments to the flag as @latest=value

Changes

  • The arguments that don't follow key=value format and just value format will be treated as @latest=value
  • service create will have a --tag flag so revision is created with a tag

Reference

Fixes #

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/commands/flags/traffic.go Show resolved Hide resolved
pkg/kn/commands/flags/traffic.go Show resolved Hide resolved
pkg/kn/commands/flags/traffic.go Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 8, 2021
@codecov
Copy link

codecov bot commented Nov 8, 2021

Codecov Report

Merging #1514 (1b44096) into main (09d48d5) will increase coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1514      +/-   ##
==========================================
+ Coverage   79.34%   79.52%   +0.18%     
==========================================
  Files         162      162              
  Lines        8502     8553      +51     
==========================================
+ Hits         6746     6802      +56     
+ Misses       1075     1073       -2     
+ Partials      681      678       -3     
Impacted Files Coverage Δ
pkg/kn/commands/flags/traffic.go 100.00% <100.00%> (ø)
pkg/kn/commands/service/create.go 80.59% <100.00%> (+1.23%) ⬆️
pkg/kn/commands/service/update.go 81.42% <100.00%> (ø)
pkg/kn/traffic/compute.go 100.00% <100.00%> (ø)
pkg/kn/commands/container/add.go 94.87% <0.00%> (+0.13%) ⬆️
pkg/kn/commands/source/container/update.go 90.69% <0.00%> (+0.22%) ⬆️
pkg/kn/commands/source/container/create.go 90.24% <0.00%> (+0.24%) ⬆️
...kg/kn/commands/service/configuration_edit_flags.go 83.53% <0.00%> (+0.83%) ⬆️
pkg/kn/commands/revision/describe.go 51.51% <0.00%> (+0.89%) ⬆️
pkg/kn/config/config.go 54.25% <0.00%> (+1.31%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09d48d5...1b44096. Read the comment docs.

@maximilien maximilien self-assigned this Nov 22, 2021
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.

Thanks for contribution. Left one comment

pkg/kn/commands/service/create_test.go Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 22, 2021
@vyasgun vyasgun changed the title Add --tag flag to service create Add --tag flag to service create and allow traffic split when @latest is specified Nov 22, 2021
@vyasgun vyasgun changed the title Add --tag flag to service create and allow traffic split when @latest is specified Add --tag flag to service create and allow traffic split <100 when @latest is specified Nov 22, 2021
@vyasgun vyasgun force-pushed the pr/traffic-split-tags branch 2 times, most recently from c9b5111 to 4a4b92a Compare November 22, 2021 17:50
@vyasgun vyasgun force-pushed the pr/traffic-split-tags branch from 4a4b92a to 7006a88 Compare November 23, 2021 10:00
Copy link
Contributor

@dsimansk dsimansk left a comment

Choose a reason for hiding this comment

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

Thanks @vyasgun! I can say that the code finally settled with me and I understand the motivation and changes. :)

/approve

@rhuss: Would you have time to take a look?

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 26, 2021
@vyasgun vyasgun force-pushed the pr/traffic-split-tags branch 3 times, most recently from da88cf5 to 42ca9ea Compare November 29, 2021 12:20
@vyasgun vyasgun force-pushed the pr/traffic-split-tags branch from 42ca9ea to 1b44096 Compare November 29, 2021 12:32
@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/create.go 87.9% 88.7% 0.8

Copy link
Contributor

@dsimansk dsimansk left a comment

Choose a reason for hiding this comment

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

Thanks!

/approve
/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 29, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk, vyasgun

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 8fd19e6 into knative:main Nov 29, 2021
@rhuss
Copy link
Contributor

rhuss commented Dec 2, 2021

Sorry for being so late. I will give the whole traffic refactorings a spin today (or early next week).

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.

6 participants