@@ -94,6 +94,8 @@ type HelmAppService interface {
94
94
GetRevisionHistoryMaxValue (appType bean.SourceAppType ) int32
95
95
GetResourceTreeForExternalResources (ctx context.Context , clusterId int , clusterConfig * gRPC.ClusterConfig , resources []* gRPC.ExternalResourceDetail ) (* gRPC.ResourceTreeResponse , error )
96
96
CheckIfNsExistsForClusterIds (clusterIdToNsMap map [int ]string ) error
97
+
98
+ GetAppStatusV2 (ctx context.Context , req * gRPC.AppDetailRequest , clusterId int ) (* gRPC.AppStatus , error )
97
99
}
98
100
99
101
type HelmAppServiceImpl struct {
@@ -175,7 +177,7 @@ func (impl *HelmAppServiceImpl) ListHelmApplications(ctx context.Context, cluste
175
177
http .StatusInternalServerError )
176
178
return
177
179
}
178
-
180
+
179
181
// get helm apps which are created using cd_pipelines
180
182
newCtx , span := otel .Tracer ("pipelineRepository" ).Start (ctx , "GetAppAndEnvDetailsForDeploymentAppTypePipeline" )
181
183
start = time .Now ()
@@ -244,18 +246,18 @@ func (impl *HelmAppServiceImpl) UnHibernateApplication(ctx context.Context, app
244
246
}
245
247
246
248
func (impl * HelmAppServiceImpl ) GetApplicationDetail (ctx context.Context , app * helmBean.AppIdentifier ) (* gRPC.AppDetail , error ) {
247
- return impl .getApplicationDetail (ctx , app , nil )
249
+ return impl .getApplicationDetailWithInstallerStatus (ctx , app , nil )
248
250
}
249
251
250
252
func (impl * HelmAppServiceImpl ) GetApplicationAndReleaseStatus (ctx context.Context , app * helmBean.AppIdentifier ) (* gRPC.AppStatus , error ) {
251
253
return impl .getApplicationAndReleaseStatus (ctx , app )
252
254
}
253
255
254
256
func (impl * HelmAppServiceImpl ) GetApplicationDetailWithFilter (ctx context.Context , app * helmBean.AppIdentifier , resourceTreeFilter * gRPC.ResourceTreeFilter ) (* gRPC.AppDetail , error ) {
255
- return impl .getApplicationDetail (ctx , app , resourceTreeFilter )
257
+ return impl .getApplicationDetailWithInstallerStatus (ctx , app , resourceTreeFilter )
256
258
}
257
259
258
- func (impl * HelmAppServiceImpl ) getApplicationDetail (ctx context.Context , app * helmBean.AppIdentifier , resourceTreeFilter * gRPC.ResourceTreeFilter ) (* gRPC.AppDetail , error ) {
260
+ func (impl * HelmAppServiceImpl ) getApplicationDetailWithInstallerStatus (ctx context.Context , app * helmBean.AppIdentifier , resourceTreeFilter * gRPC.ResourceTreeFilter ) (* gRPC.AppDetail , error ) {
259
261
config , err := impl .helmAppReadService .GetClusterConf (app .ClusterId )
260
262
if err != nil {
261
263
impl .logger .Errorw ("error in fetching cluster detail" , "err" , err )
@@ -267,7 +269,7 @@ func (impl *HelmAppServiceImpl) getApplicationDetail(ctx context.Context, app *h
267
269
ReleaseName : app .ReleaseName ,
268
270
ResourceTreeFilter : resourceTreeFilter ,
269
271
}
270
- appdetail , err := impl .helmAppClient . GetAppDetail (ctx , req )
272
+ appDetail , err := impl .getAppDetail (ctx , req )
271
273
if err != nil {
272
274
impl .logger .Errorw ("error in fetching app detail" , "err" , err )
273
275
return nil , err
@@ -281,14 +283,24 @@ func (impl *HelmAppServiceImpl) getApplicationDetail(ctx context.Context, app *h
281
283
impl .serverDataStore .InstallerCrdObjectExists {
282
284
if impl .serverDataStore .InstallerCrdObjectStatus != serverBean .InstallerCrdObjectStatusApplied {
283
285
// if timeout
284
- if time .Now ().After (appdetail .GetLastDeployed ().AsTime ().Add (1 * time .Hour )) {
285
- appdetail .ApplicationStatus = serverBean .AppHealthStatusDegraded
286
+ if time .Now ().After (appDetail .GetLastDeployed ().AsTime ().Add (1 * time .Hour )) {
287
+ appDetail .ApplicationStatus = serverBean .AppHealthStatusDegraded
286
288
} else {
287
- appdetail .ApplicationStatus = serverBean .AppHealthStatusProgressing
289
+ appDetail .ApplicationStatus = serverBean .AppHealthStatusProgressing
288
290
}
289
291
}
290
292
}
291
- return appdetail , err
293
+ return appDetail , err
294
+ }
295
+
296
+ func (impl * HelmAppServiceImpl ) getAppDetail (ctx context.Context , req * gRPC.AppDetailRequest ) (* gRPC.AppDetail , error ) {
297
+ impl .updateAppDetailRequestWithCacheConfig (req )
298
+ appDetail , err := impl .helmAppClient .GetAppDetail (ctx , req )
299
+ if err != nil {
300
+ impl .logger .Errorw ("error in fetching app detail" , "payload" , req , "err" , err )
301
+ return nil , err
302
+ }
303
+ return appDetail , nil
292
304
}
293
305
294
306
func (impl * HelmAppServiceImpl ) GetResourceTreeForExternalResources (ctx context.Context , clusterId int ,
@@ -308,6 +320,7 @@ func (impl *HelmAppServiceImpl) GetResourceTreeForExternalResources(ctx context.
308
320
ClusterConfig : config ,
309
321
ExternalResourceDetail : resources ,
310
322
}
323
+ impl .updateExternalResTreeRequestWithCacheConfig (clusterId , req )
311
324
return impl .helmAppClient .GetResourceTreeForExternalResources (ctx , req )
312
325
}
313
326
0 commit comments