Skip to content

Commit

Permalink
feat: Added healthcheck for ArgoEvents EventBus CRD. argoproj#12395 (a…
Browse files Browse the repository at this point in the history
…rgoproj#12401)

* Added Healthcheck for ArgoEvent Eventbus CRD
fixes argoproj#12395

Signed-off-by: lucostus <constantin.winkler@gepardec.com>

* Added Test for EventBus CRD healthcheck
Feat. argoproj#12395

Signed-off-by: sgartner03 <simon.gartner@gepardec.com>

* changed i to _ for idiomatic lua

Signed-off-by: Constantin <41841989+Lucostus@users.noreply.github.com>

---------

Signed-off-by: lucostus <constantin.winkler@gepardec.com>
Signed-off-by: sgartner03 <simon.gartner@gepardec.com>
Signed-off-by: Constantin <41841989+Lucostus@users.noreply.github.com>
Co-authored-by: lucostus <constantin.winkler@gepardec.com>
Co-authored-by: Constantin <41841989+Lucostus@users.noreply.github.com>
  • Loading branch information
3 people authored and xiaowu.zhu committed Aug 9, 2023
1 parent 3193565 commit d9f9e48
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions resource_customizations/argoproj.io/EventBus/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
hs={ status = "Progressing", message = "Waiting for initialization" }

if obj.status ~= nil then
if obj.status.conditions ~= nil then
for _, condition in ipairs(obj.status.conditions) do
if condition.type == "Deployed" and condition.status == "False" then
hs.status = "Degraded"
hs.message = condition.message or condition.reason
return hs
end
if condition.type == "Deployed" and condition.status == "True" then
hs.status = "Healthy"
hs.message = condition.message or condition.reason
return hs
end
end
end
end


return hs
9 changes: 9 additions & 0 deletions resource_customizations/argoproj.io/EventBus/health_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests:
- healthStatus:
status: Healthy
message: "JetStream is deployed"
inputPath: testdata/healthy.yaml
- healthStatus:
status: Degraded
message: 'failed to get jetstream version, err: unsupported version "iwillfail", supported versions: "2.9.5,latest"'
inputPath: testdata/degraded.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: EventBus
metadata:
name: test
namespace: eventbus-test
spec:
jetstream:
replicas: 3
version: iwillfail
status:
conditions:
- lastTransitionTime: null
status: 'True'
type: Configured
- lastTransitionTime: null
message: >-
failed to get jetstream version, err: unsupported version "iwillfail",
supported versions: "2.9.5,latest"
reason: JetStreamStatefulSetFailed
status: 'False'
type: Deployed
19 changes: 19 additions & 0 deletions resource_customizations/argoproj.io/EventBus/testdata/healthy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: argoproj.io/v1alpha1
kind: EventBus
metadata:
name: test
namespace: eventbus-test
spec:
jetstream:
replicas: 3
version: latest
status:
conditions:
- lastTransitionTime: '2022-12-30T11:44:15Z'
status: 'True'
type: Configured
- lastTransitionTime: '2022-12-30T11:44:15Z'
message: JetStream is deployed
reason: Succeeded
status: 'True'
type: Deployed

0 comments on commit d9f9e48

Please sign in to comment.