Skip to content

Commit

Permalink
Revert "fix: Child apps should not affect parent app's health by defa…
Browse files Browse the repository at this point in the history
…ult (argoproj#153)"

This reverts commit 3a3f6a3.

Conflicts:
  pkg/health/health.go
  • Loading branch information
trown committed Dec 9, 2020
1 parent a68600f commit 55dec1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func GetResourceHealth(obj *unstructured.Unstructured, healthOverride HealthOver
}
case "argoproj.io":
switch gvk.Kind {
case "Application":
health = getApplicationHealth(obj)
case "Workflow":
health, err = getArgoWorkflowHealth(obj)
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/health/health_argo.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ func getArgoWorkflowHealth(obj *unstructured.Unstructured) (*HealthStatus, error
}
return &HealthStatus{Status: HealthStatusHealthy, Message: wf.Status.Message}, nil
}

func getApplicationHealth(obj *unstructured.Unstructured) *HealthStatus {
status, _, _ := unstructured.NestedString(obj.Object, "status", "health", "status")
message, _, _ := unstructured.NestedString(obj.Object, "status", "health", "message")
return &HealthStatus{Status: HealthStatusCode(status), Message: message}
}
4 changes: 2 additions & 2 deletions pkg/health/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func TestPod(t *testing.T) {
}

func TestApplication(t *testing.T) {
assert.Nil(t, getHealthStatus("./testdata/application-healthy.yaml", t))
assert.Nil(t, getHealthStatus("./testdata/application-degraded.yaml", t))
assertAppHealth(t, "./testdata/application-healthy.yaml", HealthStatusHealthy)
assertAppHealth(t, "./testdata/application-degraded.yaml", HealthStatusDegraded)
}

func TestAPIService(t *testing.T) {
Expand Down

0 comments on commit 55dec1e

Please sign in to comment.