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

Check hook additional changes #1719

Merged
merged 7 commits into from
Dec 17, 2024
Merged

Conversation

asn1809
Copy link
Member

@asn1809 asn1809 commented Dec 11, 2024

Fixes #1697

@asn1809 asn1809 marked this pull request as ready for review December 11, 2024 14:38

if err != nil {
log.Info("error executing check hook", "for", hook.Name, "with error", err)
errOut = err
Copy link
Member

@ELENAGER ELENAGER Dec 15, 2024

Choose a reason for hiding this comment

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

@asn1809 , when we have real failure here, I mean not res = false, but err is not empty, do we need to proceed in this loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @ELENAGER, the reason is to fail the hook if any of the checks fail. For example, suppose a labelSelector or nameSelector returns 2 Deployments, and check hook passes for one and fails for other, then overall check hook should be marked as failed. Let me know if you see any issues.

Copy link
Member

@ELENAGER ELENAGER Dec 17, 2024

Choose a reason for hiding this comment

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

@Annaraya-Narasagond , exactly, maybe just
return false, err
in line 83?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

For check hooks to be executed for the resource type pod, deployment or
statefulset, either nameSelector or labelSelector are mandatory.
nameSelector can be:
1. Distinct name which will match with exact name of the resource.
2. Regex, which may match with multiple resources.

labelSelector spec is according to meta/v1.

If multiple resources are found, then check hook will be executed on all
the resources and res will be logged for each of the resource.

Signed-off-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Annaraya Narasagond <[email protected]>
@raghavendra-talur raghavendra-talur merged commit 8f2da93 into RamenDR:main Dec 17, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when using check hooks with labelSelector and nameSelector
3 participants