Skip to content

Conversation

fprovencherdrw
Copy link
Contributor

@fprovencherdrw fprovencherdrw commented Feb 26, 2025

Adding custom health check logic for logstash.k8s.elastic.co/Logstash objects.

This is based on the health output that is defined here:
https://github.com/elastic/cloud-on-k8s/blob/872ca20e68404e740c879edced3933995e202316/pkg/controller/logstash/health.go#L13

Which is called from:
https://github.com/elastic/cloud-on-k8s/blob/872ca20e68404e740c879edced3933995e202316/pkg/controller/agent/reconcile.go#L217

I didn't want to reproduce the logic from the app (which could change), which is why I kept it simple.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Signed-off-by: Francis Provencher <fprovencher@drw.com>
@fprovencherdrw fprovencherdrw requested a review from a team as a code owner February 26, 2025 13:17
Copy link

bunnyshell bot commented Feb 26, 2025

❗ Preview Environment undeploy from Bunnyshell failed

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to try again to remove the environment

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.01%. Comparing base (610523b) to head (e942a73).
Report is 197 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22028      +/-   ##
==========================================
- Coverage   60.03%   60.01%   -0.03%     
==========================================
  Files         344      344              
  Lines       57781    57787       +6     
==========================================
- Hits        34689    34680       -9     
- Misses      20333    20341       +8     
- Partials     2759     2766       +7     

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

@@ -0,0 +1,22 @@
local hs = {}
if obj.status ~= nil then
if obj.status.health ~= nil then
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you consolidate in one if using and?

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.

end

hs.status = "Unknown"
hs.message = "Logstash status is unknown. Ensure your ArgoCD is current and then check for/file a bug report: https://github.com/argoproj/argo-cd/issues"
Copy link
Member

@agaudreault agaudreault May 9, 2025

Choose a reason for hiding this comment

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

Usually, if the resource does not have the status populated yet, the default behavior is to be progressing and waiting for the controller to populate it.

I think you could have an unknown status if obj.status.health is of an unknown colour. Then the message can say which colour it is.

hs.status = "Progressing"
hs.message = "Waiting for Logstash"

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.

As per the source of Logstash, if health exist, then a colour will be defined, so I left the rest of the code as-is.

@crenshaw-dev crenshaw-dev added this to the v3.1 milestone May 21, 2025
@crenshaw-dev
Copy link
Member

@agaudreault any remaining concerns, or good to go?

@agaudreault agaudreault merged commit 8f1f5c7 into argoproj:master Jun 13, 2025
27 checks passed
dsuhinin pushed a commit to dsuhinin/argo-cd that referenced this pull request Jun 16, 2025
Signed-off-by: Francis Provencher <fprovencher@drw.com>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
jcogilvie pushed a commit to Sanyaku/argo-cd that referenced this pull request Jun 16, 2025
Signed-off-by: Francis Provencher <fprovencher@drw.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
enneitex pushed a commit to enneitex/argo-cd that referenced this pull request Aug 24, 2025
Signed-off-by: Francis Provencher <fprovencher@drw.com>
Signed-off-by: enneitex <etienne.divet@gmail.com>
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.

5 participants