@@ -34,6 +34,14 @@ const (
34
34
defaultRef = "HEAD"
35
35
defaultArgoCDInstance = "openshift-gitops"
36
36
defaultArgocdNamespace = "openshift-gitops"
37
+ kindService = "Service"
38
+ kindDeployment = "Deployment"
39
+ kindSecret = "Secret"
40
+ kindSealedSecret = "SealedSecret"
41
+ kindRoute = "Route"
42
+ kindRoleBinding = "RoleBinding"
43
+ kindClusterRole = "ClusterRole"
44
+ kindClusterRoleBinding = "ClusterRoleBinding"
37
45
)
38
46
39
47
var baseURL = fmt .Sprintf ("https://%s-server.%s.svc.cluster.local" , defaultArgoCDInstance , defaultArgocdNamespace )
@@ -286,13 +294,70 @@ func (a *APIRouter) GetApplicationDetails(w http.ResponseWriter, r *http.Request
286
294
Message : commitInfo ["message" ],
287
295
Revision : revision ,
288
296
}
289
-
297
+ var envResources = make (map [string ][]envHealthResource )
298
+ envResources [kindService ] = make ([]envHealthResource , 0 )
299
+ envResources [kindDeployment ] = make ([]envHealthResource , 0 )
300
+ envResources [kindSecret ] = make ([]envHealthResource , 0 )
301
+ envResources [kindRoute ] = make ([]envHealthResource , 0 )
302
+ envResources [kindRoleBinding ] = make ([]envHealthResource , 0 )
303
+ envResources [kindClusterRole ] = make ([]envHealthResource , 0 )
304
+ envResources [kindClusterRoleBinding ] = make ([]envHealthResource , 0 )
305
+
306
+ for _ , aResource := range app .Status .Resources {
307
+ switch aResource .Kind {
308
+ case kindService :
309
+ envResources [kindService ] = append (envResources [kindService ], envHealthResource {
310
+ Name : aResource .Name ,
311
+ Health : string (aResource .Health .Status ),
312
+ Status : string (aResource .Status ),
313
+ })
314
+ case kindDeployment :
315
+ envResources [kindDeployment ] = append (envResources [kindDeployment ], envHealthResource {
316
+ Name : aResource .Name ,
317
+ Health : string (aResource .Health .Status ),
318
+ Status : string (aResource .Status ),
319
+ })
320
+ case kindSecret , kindSealedSecret :
321
+ envResources [kindSecret ] = append (envResources [kindSecret ], envHealthResource {
322
+ Name : aResource .Name ,
323
+ Health : string (aResource .Health .Status ),
324
+ Status : string (aResource .Status ),
325
+ })
326
+ case kindRoute :
327
+ envResources [kindRoute ] = append (envResources [kindRoute ], envHealthResource {
328
+ Name : aResource .Name ,
329
+ Status : string (aResource .Status ),
330
+ })
331
+ case kindRoleBinding :
332
+ envResources [kindRoleBinding ] = append (envResources [kindRoleBinding ], envHealthResource {
333
+ Name : aResource .Name ,
334
+ Status : string (aResource .Status ),
335
+ })
336
+ case kindClusterRole :
337
+ envResources [kindClusterRole ] = append (envResources [kindClusterRole ], envHealthResource {
338
+ Name : aResource .Name ,
339
+ Status : string (aResource .Status ),
340
+ })
341
+ case kindClusterRoleBinding :
342
+ envResources [kindClusterRoleBinding ] = append (envResources [kindClusterRoleBinding ], envHealthResource {
343
+ Name : aResource .Name ,
344
+ Status : string (aResource .Status ),
345
+ })
346
+ }
347
+ }
290
348
appEnv := map [string ]interface {}{
291
- "environment" : app .Spec .Destination .Namespace ,
292
- "cluster" : app .Spec .Destination .Server ,
293
- "lastDeployed" : lastDeployed ,
294
- "status" : app .Status .Sync .Status ,
295
- "revision" : revisionMeta ,
349
+ "environment" : app .Spec .Destination .Namespace ,
350
+ "cluster" : app .Spec .Destination .Server ,
351
+ "lastDeployed" : lastDeployed ,
352
+ "status" : app .Status .Sync .Status ,
353
+ "revision" : revisionMeta ,
354
+ "services" : envResources [kindService ],
355
+ "secrets" : envResources [kindSecret ],
356
+ "deployments" : envResources [kindDeployment ],
357
+ "routes" : envResources [kindRoute ],
358
+ "roleBindings" : envResources [kindRoleBinding ],
359
+ "clusterRoles" : envResources [kindClusterRole ],
360
+ "clusterRoleBindings" : envResources [kindClusterRoleBinding ],
296
361
}
297
362
298
363
marshalResponse (w , appEnv )
0 commit comments