-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(health): add Logstash resource customization #22028
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
Merged
agaudreault
merged 10 commits into
argoproj:master
from
fprovencherdrw:add_logstash_health
Jun 13, 2025
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8b310d3
Add health status for Logstash
fprovencherdrw 6c675ce
Merge branch 'master' into add_logstash_health
fprovencherdrw 46b6194
Merge branch 'master' into add_logstash_health
fprovencherdrw 13c23f8
Reducing nested ifs
fprovencherdrw 3aa40c8
Merge branch 'master' into add_logstash_health
fprovencherdrw 5e4b870
Merge branch 'master' into add_logstash_health
fprovencherdrw 871a3e5
Merge branch 'master' into add_logstash_health
fprovencherdrw 1b0543d
Merge branch 'master' into add_logstash_health
fprovencherdrw 21c212a
Merge branch 'master' into add_logstash_health
fprovencherdrw e942a73
Making status progressing when we don't have any health as per requested
fprovencherdrw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
resource_customizations/logstash.k8s.elastic.co/Logstash/health.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| local hs = {} | ||
| if obj.status ~= nil and obj.status.health ~= nil then | ||
| if obj.status.health == "green" then | ||
| hs.status = "Healthy" | ||
| hs.message = "Logstash status is Green" | ||
| return hs | ||
| elseif obj.status.health == "yellow" then | ||
| hs.status = "Progressing" | ||
| hs.message = "Logstash status is Yellow" | ||
| return hs | ||
| elseif obj.status.health == "red" then | ||
| hs.status = "Degraded" | ||
| hs.message = "Logstash status is Red" | ||
| return hs | ||
| end | ||
| 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" | ||
| return hs | ||
17 changes: 17 additions & 0 deletions
17
resource_customizations/logstash.k8s.elastic.co/Logstash/health_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| tests: | ||
| - healthStatus: | ||
| status: Healthy | ||
| message: "Logstash status is Green" | ||
| inputPath: testdata/green.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: "Logstash status is Yellow" | ||
| inputPath: testdata/yellow.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Logstash status is Red" | ||
| inputPath: testdata/red.yaml | ||
| - healthStatus: | ||
| status: Unknown | ||
| 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" | ||
| inputPath: testdata/unknown.yaml |
6 changes: 6 additions & 0 deletions
6
resource_customizations/logstash.k8s.elastic.co/Logstash/testdata/green.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: logstash.k8s.elastic.co/v1alpha1 | ||
| kind: Logstash | ||
| metadata: | ||
| name: quickstart | ||
| status: | ||
| health: green |
6 changes: 6 additions & 0 deletions
6
resource_customizations/logstash.k8s.elastic.co/Logstash/testdata/red.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: logstash.k8s.elastic.co/v1alpha1 | ||
| kind: Logstash | ||
| metadata: | ||
| name: quickstart | ||
| status: | ||
| health: red |
5 changes: 5 additions & 0 deletions
5
resource_customizations/logstash.k8s.elastic.co/Logstash/testdata/unknown.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| apiVersion: logstash.k8s.elastic.co/v1alpha1 | ||
| kind: Logstash | ||
| metadata: | ||
| name: quickstart | ||
| status: {} |
6 changes: 6 additions & 0 deletions
6
resource_customizations/logstash.k8s.elastic.co/Logstash/testdata/yellow.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: logstash.k8s.elastic.co/v1alpha1 | ||
| kind: Logstash | ||
| metadata: | ||
| name: quickstart | ||
| status: | ||
| health: yellow |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.healthis of an unknown colour. Then the message can say which colour it is.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.
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.