forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added healthcheck for ArgoEvents EventBus CRD. argoproj#12395 (a…
…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
1 parent
3193565
commit d9f9e48
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,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
9
resource_customizations/argoproj.io/EventBus/health_test.yaml
This file contains 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,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 |
21 changes: 21 additions & 0 deletions
21
resource_customizations/argoproj.io/EventBus/testdata/degraded.yaml
This file contains 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,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
19
resource_customizations/argoproj.io/EventBus/testdata/healthy.yaml
This file contains 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,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 |