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

WaitAPIServiceReady use watch #3415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

helen-frank
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
Avoid too many logs
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 17, 2023
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign prodanlabs after the PR has been reviewed.
You can assign the PR to them by writing /assign @prodanlabs in a comment when ready.

The full list of commands accepted by this bot can be found 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

@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 17, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3415 (978486b) into master (4552a19) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3415      +/-   ##
==========================================
- Coverage   51.79%   51.75%   -0.05%     
==========================================
  Files         210      210              
  Lines       18926    18938      +12     
==========================================
- Hits         9803     9801       -2     
- Misses       8581     8595      +14     
  Partials      542      542              
Flag Coverage Δ
unittests 51.75% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/karmadactl/cmdinit/karmada/check.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@helen-frank helen-frank force-pushed the feature/WaitAPIServiceReadyUseWatch branch from 978486b to 153aeec Compare April 17, 2023 10:28
@helen-frank
Copy link
Contributor Author

/retest

@helen-frank helen-frank force-pushed the feature/WaitAPIServiceReadyUseWatch branch 3 times, most recently from 40143d5 to 9b523b0 Compare April 17, 2023 15:17

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: helen <[email protected]>
@helen-frank helen-frank force-pushed the feature/WaitAPIServiceReadyUseWatch branch from 9b523b0 to ae1f3d8 Compare April 17, 2023 15:26
@RainbowMango
Copy link
Member

How many logs avoided by this patch?

@helen-frank
Copy link
Contributor Author

How many logs avoided by this patch?

The new cluster installed karmada, and measured the init before and after the change, the measured log volume dropped from 77 to 18

@RainbowMango
Copy link
Member

the measured log volume dropped from 77 to 18

What kind of log is avoided?
I believe you have tested it before sending the PR, it'd be helpful if you can give more details.

@helen-frank
Copy link
Contributor Author

the measured log volume dropped from 77 to 18

What kind of log is avoided? I believe you have tested it before sending the PR, it'd be helpful if you can give more details.

The original code will print this log every 1s.

I0418 06:33:32.788899  375506 check.go:26] Waiting for APIService(v1alpha1.cluster.karmada.io) condition(Available), will try

@helen-frank
Copy link
Contributor Author

@RainbowMango @lonelyCZ hi, After troubleshooting errors for #3418, I think it is necessary to reduce the useless duplicate logs of WaitAPIServiceReady and request merge.

@RainbowMango
Copy link
Member

Do you mean #3418 rely on this PR?

Comment on lines +18 to +21
apiService, err := c.ApiregistrationV1().APIServices().Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

What if the APIService not exist at that time?

Copy link
Contributor Author

@helen-frank helen-frank Jun 5, 2023

Choose a reason for hiding this comment

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

I think when this situation occurs, the normal error can be thrown, WaitAPIServiceReady premise is that there is already APIService

Copy link
Member

Choose a reason for hiding this comment

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

Please @lonelyCZ check if the behavior change is acceptable.

Copy link
Member

Choose a reason for hiding this comment

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

Before executing WaitAPIServiceReady, we firstly CreateOrUpdateAPIService in general.

if err = util.CreateOrUpdateAPIService(apiRegistrationClient, aaAPIService); err != nil {
return err
}
if err := WaitAPIServiceReady(apiRegistrationClient, aaAPIServiceObjName, 120*time.Second); err != nil {
return err
}

@helen-frank
Copy link
Contributor Author

Do you mean #3418 rely on this PR?

Not interdependent, just found useful when troubleshooting errors and reducing duplicate error logs

}

if apiregistrationv1helper.IsAPIServiceConditionTrue(updatedAPIService, apiregistrationv1.Available) {
return nil
}

klog.Infof("Waiting for APIService(%s) condition(%s), will try", name, apiregistrationv1.Available)
Copy link
Member

Choose a reason for hiding this comment

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

Here will dump info logs, does it seems too verbose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The length looks ok, for example I0601 05:59:14.497568 20024 check.go:26] Waiting for APIService(v1alpha1.cluster.karmada.io) condition(Available), will try

Maybe we shouldn't print this log, it just tells the user that karmadactl is executing and the current shell is not disconnected, so it's not really that useful

PS: I prefer to use kwokctl circle waiting method, but this seems to be a bit of a big change, I don't know what you think about the evolution of karmadactl later

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we shouldn't print this log, it just tells the user that karmadactl is executing and the current shell is not disconnected, so it's not really that useful

Yes, I think that is one of the benefits that keep telling users that karmadactl isn't hanging there. :)

PS: I prefer to use kwokctl circle waiting method, but this seems to be a bit of a big change, I don't know what you think about the evolution of karmadactl later

Don't know about kwokctl circle.

Copy link
Member

Choose a reason for hiding this comment

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

The kworkctl circle is cool, many project CLI use this way, like subctl of submariner that are interesting and clear. I think we also use this way in the future.

image

@helen-frank
Copy link
Contributor Author

/cc @lonelyCZ

@karmada-bot karmada-bot requested a review from lonelyCZ June 9, 2023 08:11
@lonelyCZ
Copy link
Member

lonelyCZ commented Jun 9, 2023

Thanks @helen-frank , I will look it ASAP

/assign

@lonelyCZ
Copy link
Member

Hi, @helen-frank , Could you paste your test result, how many logs do we reduce?

@helen-frank
Copy link
Contributor Author

helen-frank commented Jun 12, 2023

Hi, @helen-frank , Could you paste your test result, how many logs do we reduce?

The log volume was reduced from 77 to 18 when karmada-aggregated-apiserver failed to start properly
(Maybe we can no longer output this log

@helen-frank
Copy link
Contributor Author

ping @lonelyCZ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants