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

misc bug fix in manage controller #1121

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

hzxuzhonghu
Copy link
Member

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This is motivated by @bitcoffeeiux refereencing this controller. I found there are something not perfect here.

  1. We donot need shared informer factory here.
  2. The controller Run() method cannot be stopped
  3. We can reuse the handlePodUpdate function to process add event

Others are mostly clean code

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 58.33333% with 25 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@04a5dcd). Learn more about missing BASE report.
Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/manage/manage_controller.go 58.33% 24 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
pkg/controller/manage/manage_controller.go 54.94% <58.33%> (ø)

Continue to review full report in Codecov by Sentry.

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

if apierrors.IsNotFound(err) {
return nil
}
log.Errorf("failed to get pod %s/%s: %v", key.podNs, key.podName, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This error message is presented on line L290. My suggestion is to delete the log here and put the message in the err return value.

Suggested change
log.Errorf("failed to get pod %s/%s: %v", key.podNs, key.podName, err)
return fmt.Errorf("failed to get pod %s/%s: %v", key.podNs, key.podName, err)

Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
}
namespace, err := c.namespaceLister.Get(pod.Namespace)
if err != nil {
if !apierrors.IsNotFound(err) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !apierrors.IsNotFound(err) {
if apierrors.IsNotFound(err) {

?

@LiZhenCheng9527
Copy link
Collaborator

/lgtm
/approve

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LiZhenCheng9527

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

@kmesh-bot kmesh-bot merged commit f92af83 into kmesh-net:main Dec 23, 2024
12 checks passed
@hzxuzhonghu hzxuzhonghu deleted the manager-controller branch December 23, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants