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

Adding retry loop to update #1441

Merged
merged 13 commits into from
Sep 13, 2021
Merged

Adding retry loop to update #1441

merged 13 commits into from
Sep 13, 2021

Conversation

vyasgun
Copy link
Contributor

@vyasgun vyasgun commented Aug 30, 2021

Description

Added retry loop from client go to service and source update commands.

Changes

  • Added retry loop from client go to service update command.
  • Added a retry updated method to ping source APIs.

Reference

Fixes #1102

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 30, 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: 0 warnings.

In response to this:

Description

Added retry loop from client go to service update command.

Changes

  • Added retry loop from client go to service update command.

Reference

Fixes #1102

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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 30, 2021
@codecov
Copy link

codecov bot commented Aug 30, 2021

Codecov Report

Merging #1441 (91b6848) into main (e570844) will increase coverage by 0.27%.
The diff coverage is 89.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1441      +/-   ##
==========================================
+ Coverage   78.70%   78.98%   +0.27%     
==========================================
  Files         162      162              
  Lines        8368     8416      +48     
==========================================
+ Hits         6586     6647      +61     
+ Misses       1098     1088      -10     
+ Partials      684      681       -3     
Impacted Files Coverage Δ
pkg/kn/commands/source/ping/ping.go 54.16% <ø> (ø)
pkg/kn/commands/domain/update.go 65.71% <45.45%> (-1.86%) ⬇️
pkg/kn/commands/subscription/update.go 68.88% <60.00%> (+2.93%) ⬆️
pkg/kn/commands/trigger/update.go 77.19% <71.42%> (+4.46%) ⬆️
pkg/kn/commands/source/ping/update.go 84.61% <91.66%> (-0.30%) ⬇️
pkg/eventing/v1/client.go 87.32% <100.00%> (+4.64%) ⬆️
pkg/eventing/v1/client_mock.go 91.89% <100.00%> (+0.22%) ⬆️
pkg/kn/commands/source/container/update.go 90.47% <100.00%> (+3.51%) ⬆️
pkg/serving/v1/client.go 82.77% <100.00%> (-0.09%) ⬇️
pkg/serving/v1alpha1/client.go 86.76% <100.00%> (+4.07%) ⬆️
... and 6 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 e570844...91b6848. Read the comment docs.

@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 Aug 30, 2021
@vyasgun
Copy link
Contributor Author

vyasgun commented Aug 31, 2021

/retest

1 similar comment
@vyasgun
Copy link
Contributor Author

vyasgun commented Aug 31, 2021

/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 to me, thanks @vyasgun for jumping on this.

I have some proposals and questions as comments, but I think we are then still missing a bunch of update operations.

ls docs/cmd/*update* | cat -

docs/cmd/kn_domain_update.md
docs/cmd/kn_service_update.md
docs/cmd/kn_source_apiserver_update.md
docs/cmd/kn_source_binding_update.md
docs/cmd/kn_source_container_update.md
docs/cmd/kn_source_ping_update.md
docs/cmd/kn_subscription_update.md
docs/cmd/kn_trigger_update.md

Also, I would change our own update mechanism in kn service update to reuse the tool-based version.

Finally, don't forget to update the CHANGELOG ;-)

@@ -19,10 +19,14 @@ import (
"fmt"

"github.com/spf13/cobra"
"k8s.io/client-go/util/retry"
"knative.dev/client/pkg/kn/commands/service"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this dependency ? Normally commands should stay independent and don't refer to each other to avoid cyclic dependency and allow them easily to be refactored/moved.

If there is some code that can be reused, I'd propose to move it to a shared package and use it from there in service and here.

Copy link
Contributor Author

@vyasgun vyasgun Sep 1, 2021

Choose a reason for hiding this comment

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

This is because I imported the MaxUpdateRetries from service package. I will change this and create a variable in the same package.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks !

pkg/eventing/v1/client.go Outdated Show resolved Hide resolved
@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 Sep 2, 2021
@dsimansk
Copy link
Contributor

dsimansk commented Sep 7, 2021

@vyasgun is the PR complete? Or are you still looking into some leftover update functions to add retry loop?

@vyasgun
Copy link
Contributor Author

vyasgun commented Sep 7, 2021

@dsimansk I pushed a few more commits. It's done now and once reviewed we can merge.

@dsimansk
Copy link
Contributor

dsimansk commented Sep 9, 2021

There's one more comment, but that's not super important. In addition there're several codecov warnings, but those can be addressed as part of improving coverage story.

IMO it looks very good, nice work!
/lgtm

@rhuss if you can make another please.

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

rhuss commented Sep 9, 2021

not sure that I can make it today, but will review it early (European) morning at last.

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 a lot. I have a minor suggestion to simplify the call to a function (avoiding one unnecessary inner function) and some other minor comments.

Overall looks very good and I think we are close to merge it.

pkg/eventing/v1/client.go Outdated Show resolved Hide resolved
pkg/eventing/v1/client.go Outdated Show resolved Hide resolved
pkg/eventing/v1/client_mock_test.go Outdated Show resolved Hide resolved
pkg/eventing/v1/client_test.go Outdated Show resolved Hide resolved
newTrigger := a.(client_testing.UpdateAction).GetObject()
name := newTrigger.(metav1.Object).GetName()

if name == "testTrigger" && attemptCount > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

very nice test for checking the retry.

pkg/messaging/v1/subscriptions_client.go Show resolved Hide resolved
pkg/messaging/v1/subscriptions_client.go Show resolved Hide resolved
pkg/serving/v1alpha1/client.go Show resolved Hide resolved
pkg/sources/v1beta2/ping_client.go Show resolved Hide resolved
@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/eventing/v1/client.go 88.3% 92.6% 4.3
pkg/eventing/v1/client_mock.go 94.1% 94.3% 0.2
pkg/kn/commands/domain/update.go 81.2% 80.6% -0.6
pkg/kn/commands/source/container/update.go 91.9% 94.1% 2.2
pkg/kn/commands/subscription/update.go 80.0% 82.1% 2.1
pkg/kn/commands/trigger/update.go 81.1% 86.4% 5.2
pkg/serving/v1/client.go 91.0% 90.9% -0.1
pkg/serving/v1alpha1/client.go 89.4% 91.9% 2.6
pkg/serving/v1alpha1/client_mock.go 90.9% 91.3% 0.4
pkg/sources/v1/container_client.go 89.5% 92.5% 3.0
pkg/sources/v1/container_client_mock.go 90.9% 91.3% 0.4
pkg/sources/v1beta2/ping_client.go 87.1% 89.6% 2.5
pkg/sources/v1beta2/ping_client_mock.go 77.3% 78.3% 1.0

@rhuss
Copy link
Contributor

rhuss commented Sep 13, 2021

thanks a lot !

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhuss, 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2021
@knative-prow-robot knative-prow-robot merged commit 94c8d33 into knative:main Sep 13, 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/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.

Reuse conflict retry loop from client-go/util/retry
5 participants