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

Minimize number of unnecessary logs #298

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

Edwinhr716
Copy link
Contributor

What type of PR is this?

What this PR does / why we need it

Minimize the number of unnecessary logs that get emitted

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Does this PR introduce a user-facing change?


@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 3, 2025
@k8s-ci-robot k8s-ci-robot requested a review from ahg-g January 3, 2025 17:23
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 3, 2025
@Edwinhr716 Edwinhr716 changed the title better error handling and switched to patch for update to emit less logs Minimize number of unnecessary logs Jan 3, 2025
@@ -476,8 +479,16 @@ func (r *LeaderWorkerSetReconciler) updateStatus(ctx context.Context, lws *leade
if err != nil {
return false, err
}
// Get the most up to date lws object to merge the status with
Copy link
Contributor

Choose a reason for hiding this comment

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

This is forcing an update, I think this is dangerous to do.

A better option is to check if the error is a conflict, in which case we requeue the key and return without printing an error, we should do that here:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So switch it back to status().Update()?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, and return ctrl.Result{Requeue: true}, nil when the error is a conflict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Will also change it so that it doesn't log the error if there is a conflict

@ahg-g ahg-g added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 3, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Jan 3, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 3, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, Edwinhr716

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 3, 2025
@k8s-ci-robot k8s-ci-robot merged commit dffdb5b into kubernetes-sigs:main Jan 3, 2025
8 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants