@@ -394,6 +394,9 @@ func (c ServiceClientImpl) ResourceTree(ctxt context.Context, query *application
394
394
if app != nil {
395
395
appResp , err := app .Recv ()
396
396
if err == nil {
397
+ // https://github.com/argoproj/argo-cd/issues/11234 workaround
398
+ c .updateNodeHealthStatus (resp , appResp )
399
+
397
400
status = string (appResp .Application .Status .Health .Status )
398
401
hash = appResp .Application .Status .Sync .Revision
399
402
conditions = appResp .Application .Status .Conditions
@@ -410,6 +413,36 @@ func (c ServiceClientImpl) ResourceTree(ctxt context.Context, query *application
410
413
return & ResourceTreeResponse {resp , newReplicaSets , status , hash , podMetadata , conditions }, err
411
414
}
412
415
416
+ // fill the health status in node from app resources
417
+ func (c ServiceClientImpl ) updateNodeHealthStatus (resp * v1alpha1.ApplicationTree , appResp * v1alpha1.ApplicationWatchEvent ) {
418
+ if resp == nil || len (resp .Nodes ) == 0 || appResp == nil || len (appResp .Application .Status .Resources ) == 0 {
419
+ return
420
+ }
421
+
422
+ for index , node := range resp .Nodes {
423
+ if node .Health != nil {
424
+ continue
425
+ }
426
+ for _ , resource := range appResp .Application .Status .Resources {
427
+ if node .Group != resource .Group || node .Version != resource .Version || node .Kind != resource .Kind ||
428
+ node .Name != resource .Name || node .Namespace != resource .Namespace {
429
+ continue
430
+ }
431
+ resourceHealth := resource .Health
432
+ if resourceHealth != nil {
433
+ node .Health = & v1alpha1.HealthStatus {
434
+ Message : resourceHealth .Message ,
435
+ Status : resourceHealth .Status ,
436
+ }
437
+ // updating the element in slice
438
+ // https://medium.com/@xcoulon/3-ways-to-update-elements-in-a-slice-d5df54c9b2f8
439
+ resp .Nodes [index ] = node
440
+ }
441
+ break
442
+ }
443
+ }
444
+ }
445
+
413
446
func (c ServiceClientImpl ) buildPodMetadata (resp * v1alpha1.ApplicationTree , responses []* Result ) (podMetaData []* PodMetadata , newReplicaSets []string ) {
414
447
rolloutManifests := make ([]map [string ]interface {}, 0 )
415
448
statefulSetManifest := make (map [string ]interface {})
0 commit comments