diff --git a/util/health/health.go b/util/health/health.go index 15e8300d78..6c0341d334 100644 --- a/util/health/health.go +++ b/util/health/health.go @@ -65,7 +65,7 @@ func ignoreLiveObjectHealth(liveObj *unstructured.Unstructured, resHealth appv1. return true } gvk := liveObj.GroupVersionKind() - if gvk.Group == "argoproj.io" && gvk.Kind == "Application" && resHealth.Status == appv1.HealthStatusMissing { + if gvk.Group == "argoproj.io" && gvk.Kind == "Application" && (resHealth.Status == appv1.HealthStatusMissing || resHealth.Status == appv1.HealthStatusUnknown) { // 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 diff --git a/util/health/health_test.go b/util/health/health_test.go index 1be32fdb73..892ee6feb8 100644 --- a/util/health/health_test.go +++ b/util/health/health_test.go @@ -115,6 +115,7 @@ func TestAppOfAppsHealth(t *testing.T) { } missingApp, missingStatus := newAppLiveObj("foo", appv1.HealthStatusMissing) + unknownApp, unknownStatus := newAppLiveObj("fooz", appv1.HealthStatusUnknown) healthyApp, healthyStatus := newAppLiveObj("bar", appv1.HealthStatusHealthy) degradedApp, degradedStatus := newAppLiveObj("baz", appv1.HealthStatusDegraded) @@ -127,6 +128,15 @@ func TestAppOfAppsHealth(t *testing.T) { assert.Equal(t, appv1.HealthStatusHealthy, healthStatus.Status) } + // verify unknown child app does not affect app health + { + unknownAndHealthyStatuses := []appv1.ResourceStatus{unknownStatus, healthyStatus} + unknownAndHealthyLiveObjects := []*unstructured.Unstructured{unknownApp, healthyApp} + healthStatus, err := SetApplicationHealth(unknownAndHealthyStatuses, unknownAndHealthyLiveObjects, nil, noFilter) + assert.NoError(t, err) + assert.Equal(t, appv1.HealthStatusHealthy, healthStatus.Status) + } + // verify degraded does affect { degradedAndHealthyStatuses := []appv1.ResourceStatus{degradedStatus, healthyStatus}