Skip to content

Commit

Permalink
fix: Child apps should not affect parent app's health by default (arg…
Browse files Browse the repository at this point in the history
…oproj#153)

Signed-off-by: Keith Chong <kykchong@redhat.com>
  • Loading branch information
keithchong authored Oct 3, 2020
1 parent d25b8fd commit 3a3f6a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions pkg/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ 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 Expand Up @@ -257,12 +255,6 @@ func init() {
_ = apiregistrationv1beta1.SchemeBuilder.AddToScheme(scheme.Scheme)
}

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}
}

func getDaemonSetHealth(obj *unstructured.Unstructured) (*HealthStatus, error) {
daemon := &appsv1.DaemonSet{}
err := scheme.Scheme.Convert(obj, daemon, nil)
Expand Down
4 changes: 2 additions & 2 deletions pkg/health/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func TestPod(t *testing.T) {
}

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

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

0 comments on commit 3a3f6a3

Please sign in to comment.