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

feat: introduce the available probe and condition for component #8212

Merged
merged 23 commits into from
Nov 1, 2024

Conversation

leon-inf
Copy link
Contributor

No description provided.

@leon-inf leon-inf requested review from Y-Rookie and a team as code owners September 26, 2024 07:00
@github-actions github-actions bot added the size/XL Denotes a PR that changes 500-999 lines. label Sep 26, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 50.26738% with 279 lines in your changes missing coverage. Please review.

Project coverage is 61.23%. Comparing base (528f5ab) to head (6f6ab9d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/component/available.go 51.00% 176 Missing and 20 partials ⚠️
pkg/kbagent/service/probe.go 1.61% 61 Missing ⚠️
pkg/controller/component/kbagent.go 37.50% 9 Missing and 1 partial ⚠️
controllers/apps/transformer_component_status.go 78.78% 5 Missing and 2 partials ⚠️
controllers/apps/componentdefinition_controller.go 93.33% 2 Missing and 1 partial ⚠️
pkg/controller/component/workload_utils.go 33.33% 2 Missing ⚠️
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     
Flag Coverage Δ
unittests 61.23% <50.26%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch from 7df4c0f to c7faf48 Compare September 26, 2024 08:25
@leon-inf leon-inf marked this pull request as draft September 26, 2024 08:29
@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch from c7faf48 to 173961c Compare September 26, 2024 10:07
@github-actions github-actions bot added size/XXL Denotes a PR that changes 1000+ lines. and removed size/XL Denotes a PR that changes 500-999 lines. labels Sep 26, 2024
break
}
}
if idx >= 0 && h.condEqual(comp.Status.Conditions[idx], newCond) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pkg/kbagent/service/probe.go Show resolved Hide resolved
@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch from 1f6a406 to 41a0e44 Compare October 8, 2024 01:44
@leon-inf leon-inf changed the title feat: introduce the available probe and condition feat: introduce the available probe and condition for component Oct 28, 2024
@leon-inf leon-inf marked this pull request as ready for review October 28, 2024 03:14
@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch from 70aa5b9 to 4339fe6 Compare October 28, 2024 03:25
for _, podEvents := range events {
if len(podEvents) > 1 {
slices.SortFunc(podEvents, func(evt1, evt2 probeEvent) int {
switch {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

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 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"`
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@apecloud-bot apecloud-bot removed the approved PR Approved Test label Oct 29, 2024
@leon-inf
Copy link
Contributor Author

/approve

@apecloud-bot apecloud-bot added the approved PR Approved Test label Oct 29, 2024
@apecloud-bot apecloud-bot removed the approved PR Approved Test label Oct 30, 2024
@leon-inf
Copy link
Contributor Author

/approve

@apecloud-bot apecloud-bot added approved PR Approved Test and removed approved PR Approved Test labels Oct 31, 2024
@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch 2 times, most recently from 13c7103 to 2e2d1f9 Compare October 31, 2024 07:15
@leon-inf leon-inf force-pushed the feature/available-probe-and-conditions branch from 2e2d1f9 to a2c9f00 Compare October 31, 2024 07:17
@leon-inf leon-inf added this to the Release 1.0.0 milestone Oct 31, 2024
@leon-inf
Copy link
Contributor Author

leon-inf commented Nov 1, 2024

/approve

@apecloud-bot apecloud-bot added the approved PR Approved Test label Nov 1, 2024
@apecloud-bot apecloud-bot removed the approved PR Approved Test label Nov 1, 2024
Copy link
Contributor

@zjx20 zjx20 left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@apecloud-bot apecloud-bot added the approved PR Approved Test label Nov 1, 2024
@leon-inf leon-inf merged commit c3968ca into main Nov 1, 2024
36 checks passed
@leon-inf leon-inf deleted the feature/available-probe-and-conditions branch November 1, 2024 05:47
@leon-inf
Copy link
Contributor Author

leon-inf commented Nov 1, 2024

/cherry-pick release-1.0-beta

Copy link

github-actions bot commented Nov 1, 2024

🤖 says: cherry pick action finished successfully 🎉!
See: https://github.com/apecloud/kubeblocks/actions/runs/11625004010

github-actions bot pushed a commit that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved PR Approved Test size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants