Skip to content

Commit 8f1f5c7

Browse files
feat(health): add Logstash resource customization (#22028)
Signed-off-by: Francis Provencher <[email protected]>
1 parent 6174b94 commit 8f1f5c7

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local hs = {}
2+
if obj.status ~= nil and obj.status.health ~= nil then
3+
if obj.status.health == "green" then
4+
hs.status = "Healthy"
5+
hs.message = "Logstash status is Green"
6+
return hs
7+
elseif obj.status.health == "yellow" then
8+
hs.status = "Progressing"
9+
hs.message = "Logstash status is Yellow"
10+
return hs
11+
elseif obj.status.health == "red" then
12+
hs.status = "Degraded"
13+
hs.message = "Logstash status is Red"
14+
return hs
15+
end
16+
end
17+
18+
hs.status = "Progressing"
19+
hs.message = "Waiting for Logstash"
20+
return hs
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tests:
2+
- healthStatus:
3+
status: Healthy
4+
message: "Logstash status is Green"
5+
inputPath: testdata/green.yaml
6+
- healthStatus:
7+
status: Progressing
8+
message: "Logstash status is Yellow"
9+
inputPath: testdata/yellow.yaml
10+
- healthStatus:
11+
status: Degraded
12+
message: "Logstash status is Red"
13+
inputPath: testdata/red.yaml
14+
- healthStatus:
15+
status: Progressing
16+
message: "Waiting for Logstash"
17+
inputPath: testdata/unknown.yaml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: logstash.k8s.elastic.co/v1alpha1
2+
kind: Logstash
3+
metadata:
4+
name: quickstart
5+
status:
6+
health: green
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: logstash.k8s.elastic.co/v1alpha1
2+
kind: Logstash
3+
metadata:
4+
name: quickstart
5+
status:
6+
health: red
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: logstash.k8s.elastic.co/v1alpha1
2+
kind: Logstash
3+
metadata:
4+
name: quickstart
5+
status: {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: logstash.k8s.elastic.co/v1alpha1
2+
kind: Logstash
3+
metadata:
4+
name: quickstart
5+
status:
6+
health: yellow

0 commit comments

Comments
 (0)