-
Notifications
You must be signed in to change notification settings - Fork 184
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
chore: merge same events for kbagent #8445
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8445 +/- ##
==========================================
+ Coverage 60.34% 62.64% +2.30%
==========================================
Files 357 378 +21
Lines 42589 48004 +5415
==========================================
+ Hits 25699 30073 +4374
- Misses 14566 15335 +769
- Partials 2324 2596 +272
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
pkg/kbagent/util/event.go
Outdated
eventsClient := clientSet.CoreV1().Events(namespace()) | ||
|
||
eventName := generateEventName(reason, message) | ||
event, err := eventsClient.Get(context.Background(), eventName, metav1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Get() call should be part of the retry logic. For example, the call may fail due to temporary network failures, retry can help in this case.
I must say I prefer the previous implementation, which packages the get and create/update operations together as a single retry unit, rather than retrying them separately. Update conflicts are a common type of error in the Kubernetes world, and re-getting the latest version of the data and then updating is the standard pattern for resolving such issues. |
So actually, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strategy by which kbagent sends events has changed, so the event handling should also be adjusted accordingly.
The code logic has been adjusted based on whether synchronous event sending is needed. |
"time" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/pkg/errors" | ||
corev1 "k8s.io/api/core/v1" | ||
k8serrors "k8s.io/apimachinery/pkg/api/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k8serrors -> apierrors
/cherry-pick release-1.0-beta |
🤖 says: cherry pick action finished successfully 🎉! |
(cherry picked from commit d9fda81)
Current issues [solved]
Expectation
47s (x12 over 47s) => 47s (x12 over xxx not 47 s)
Should not be displayed as two identical times, because each time newEvent is executed.
Reason
event_controller.go