Skip to content

Conversation

@zhiweiyin318
Copy link
Member

Summary

  1. add new addonHealthCheck func to check all filed results
  2. support wildcard in the ProbeField

Related issue(s)

#288
#287
Fixes #

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhiweiyin318

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

@zhiweiyin318
Copy link
Member Author

/assign @qiujian16
/assign @zhujian7

@zhiweiyin318 zhiweiyin318 changed the title ✨ add new addonHealthCheck func to check all fileds and support wildcard ✨ add new addonHealthCheck func to check all fields and support wildcard Nov 25, 2024
@qiujian16
Copy link
Member

/lgtm
/hold

JoaoBraveCoding added a commit to JoaoBraveCoding/multicluster-observability-addon that referenced this pull request Nov 25, 2024
healthChecker was introduced in open-cluster-management-io/addon-framework#289
and it allow us to define a list of ProbeFields as before but it also
allows us to define HealthChecker. HealthChecker has the ability to go
through all the resultFields and decide which resources are mandatory
and should trigger
unheathly probes and which resources are optional
JoaoBraveCoding added a commit to JoaoBraveCoding/multicluster-observability-addon that referenced this pull request Nov 25, 2024
healthChecker was introduced in open-cluster-management-io/addon-framework#289
and it allow us to define a list of ProbeFields as before but it also
allows us to define HealthChecker. HealthChecker has the ability to go
through all the resultFields and decide which resources are mandatory
and should trigger
unheathly probes and which resources are optional
JoaoBraveCoding added a commit to JoaoBraveCoding/multicluster-observability-addon that referenced this pull request Nov 25, 2024
healthChecker was introduced in open-cluster-management-io/addon-framework#289
and it allow us to define a list of ProbeFields as before but it also
allows us to define HealthChecker. HealthChecker has the ability to go
through all the resultFields and decide which resources are mandatory
and should trigger
unheathly probes and which resources are optional
}

type AddonHealthCheckFunc func(workapiv1.ResourceIdentifier, workapiv1.StatusFeedbackResult) error
type AddonHealthCheckerFunc func([]ResultField) error
Copy link
Member

Choose a reason for hiding this comment

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

Is the managedclusteraddon or managedcluster also required in some cases?
I remember someone raised a similar demand during our offline discussion?

Copy link
Member Author

Choose a reason for hiding this comment

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

@qiujian16 looks like it makes sense to input cluster and mca. WDYT?

}

probeFields, healthChecker, err := s.analyzeWorkProber(s.agentAddon, cluster, addon)
probeFields, healthChecker, healthAllChecker, err := s.analyzeWorkProber(s.agentAddon, cluster, addon)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think healthAllChecker is a proper name here. seems no meaning for All?

Copy link
Member Author

Choose a reason for hiding this comment

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

re-named


var resultFields []agent.ResultField

for _, field := range probeFields {
Copy link
Member

Choose a reason for hiding this comment

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

can we separate the healthChecker(Deprecated one) and healthAllChecker logic into two different functions, so it is clear and easy to deprecate in the future?

Copy link
Member Author

@zhiweiyin318 zhiweiyin318 Nov 26, 2024

Choose a reason for hiding this comment

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

Add a TODO here, will follow up to refactor this part


return &status.StatusFeedbacks
// compare two string, target may include *
func wildcardMatch(resource, target string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

These seem to be duplicates of the ocm/work code?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. only this two parts use it

@openshift-ci openshift-ci bot removed the lgtm label Nov 26, 2024
@zhujian7
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 26, 2024
@zhiweiyin318
Copy link
Member Author

/unhold

@openshift-merge-bot openshift-merge-bot bot merged commit 81a5903 into open-cluster-management-io:main Nov 26, 2024
13 checks passed
@zhiweiyin318 zhiweiyin318 deleted the support-probefileds branch November 26, 2024 09:52
@zhiweiyin318 zhiweiyin318 restored the support-probefileds branch November 26, 2024 09:52
@zhiweiyin318 zhiweiyin318 deleted the support-probefileds branch November 27, 2024 06:15
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.

3 participants