-
Notifications
You must be signed in to change notification settings - Fork 176
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
feat: introduce the available probe and condition for component #8212
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8212 +/- ##
==========================================
- Coverage 61.25% 61.23% -0.02%
==========================================
Files 350 351 +1
Lines 41256 41777 +521
==========================================
+ Hits 25270 25583 +313
- Misses 13705 13891 +186
- Partials 2281 2303 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7df4c0f
to
c7faf48
Compare
c7faf48
to
173961c
Compare
break | ||
} | ||
} | ||
if idx >= 0 && h.condEqual(comp.Status.Conditions[idx], newCond) { |
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.
can use helpers functions from https://github.com/kubernetes/apimachinery/blob/master/pkg/api/meta/conditions.go .
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.
Done
1f6a406
to
41a0e44
Compare
70aa5b9
to
4339fe6
Compare
for _, podEvents := range events { | ||
if len(podEvents) > 1 { | ||
slices.SortFunc(podEvents, func(evt1, evt2 probeEvent) int { | ||
switch { |
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.
This may help.
https://pkg.go.dev/time#Time.Compare
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.
It doesn't need to sort the whole slice if it only needs the latest one.
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.
Done
return true | ||
} | ||
|
||
func (h *AvailableEventHandler) evaluateConditionX(cond appsv1.ComponentAvailableConditionX, replicas int32, events []probeEvent) (bool, string, error) { |
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 last two returned values are always empty, maybe just remove them.
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 returned error has been deleted, and the message is retained to convey detailed information when it is unavailable. It will be added later.
// This field is immutable once set. | ||
// | ||
// +optional | ||
TimeWindow *int32 `json:"timeWindow,omitempty"` |
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.
Declare the unit of the field.
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.
Done
/approve |
/approve |
13c7103
to
2e2d1f9
Compare
2e2d1f9
to
a2c9f00
Compare
/approve |
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.
LGTM
@@ -283,7 +271,7 @@ func (h *AvailableEventHandler) getCachedEvents(comp *appsv1.Component) ([]probe | |||
} | |||
|
|||
func (h *AvailableEventHandler) updateCachedEvents(comp *appsv1.Component, events []probeEvent) error { | |||
if comp.Annotations == nil && len(events) == 0 { | |||
if comp.Status.Message == nil && len(events) == 0 { |
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.
unnecessary to check comp.Status.Message == nil
?
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.
It needs to delete expired events.
/cherry-pick release-1.0-beta |
🤖 says: cherry pick action finished successfully 🎉! |
(cherry picked from commit c3968ca)
No description provided.