diff --git a/util/health/health.go b/util/health/health.go index c69a5fee4daf7..865f60b84c8a5 100644 --- a/util/health/health.go +++ b/util/health/health.go @@ -48,10 +48,11 @@ func ignoreLiveObjectHealth(liveObj *unstructured.Unstructured, resHealth appv1. return true } gvk := liveObj.GroupVersionKind() - if gvk.Group == "argoproj.io" && gvk.Kind == "Application" && (resHealth.Status == health.HealthStatusMissing || resHealth.Status == health.HealthStatusUnknown) { + if gvk.Group == "argoproj.io" && gvk.Kind == "Application" && (resHealth.Status == health.HealthStatusMissing || resHealth.Status == health.HealthStatusUnknown || resHealth.Status == health.HealthStatusDegraded) { // Covers the app-of-apps corner case where child app is deployed but that app itself // has a status of 'Missing', which we don't want to cause the parent's health status - // to also be Missing + // to also be Missing. Default changed so that if a child app has a degraded health status, + // it will not affect the parent's health status. return true } } diff --git a/util/health/health_test.go b/util/health/health_test.go index 221793ac3f3c7..8ff361cdb133c 100644 --- a/util/health/health_test.go +++ b/util/health/health_test.go @@ -105,13 +105,13 @@ func TestAppOfAppsHealth(t *testing.T) { assert.Equal(t, health.HealthStatusHealthy, healthStatus.Status) } - // verify degraded does affect + // verify degraded does not affect app health { degradedAndHealthyStatuses := []*appv1.ResourceStatus{degradedStatus, healthyStatus} degradedAndHealthyLiveObjects := []*unstructured.Unstructured{degradedApp, healthyApp} healthStatus, err := SetApplicationHealth(degradedAndHealthyStatuses, degradedAndHealthyLiveObjects, nil, noFilter) assert.NoError(t, err) - assert.Equal(t, health.HealthStatusDegraded, healthStatus.Status) + assert.Equal(t, health.HealthStatusHealthy, healthStatus.Status) } }