Skip to content

Commit 385f8d7

Browse files
committed
resource tree change
1 parent ab58689 commit 385f8d7

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

pkg/appStore/installedApp/service/FullMode/resource/ResourceTreeService.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import (
4141
bean3 "github.com/devtron-labs/devtron/pkg/argoApplication/bean"
4242
"github.com/devtron-labs/devtron/pkg/deployment/common"
4343
bean2 "github.com/devtron-labs/devtron/pkg/deployment/common/bean"
44+
"github.com/devtron-labs/devtron/pkg/fluxApplication"
45+
bean5 "github.com/devtron-labs/devtron/pkg/fluxApplication/bean"
4446
"github.com/devtron-labs/devtron/pkg/k8s"
4547
application3 "github.com/devtron-labs/devtron/pkg/k8s/application"
4648
util3 "github.com/devtron-labs/devtron/pkg/util"
@@ -77,6 +79,7 @@ type InstalledAppResourceServiceImpl struct {
7779
deploymentConfigurationService common.DeploymentConfigService
7880
OCIRegistryConfigRepository repository2.OCIRegistryConfigRepository
7981
argoApplicationService argoApplication.ArgoApplicationService
82+
fluxApplicationService fluxApplication.FluxApplicationService
8083
}
8184

8285
func NewInstalledAppResourceServiceImpl(logger *zap.SugaredLogger,
@@ -91,7 +94,8 @@ func NewInstalledAppResourceServiceImpl(logger *zap.SugaredLogger,
9194
k8sCommonService k8s.K8sCommonService, k8sApplicationService application3.K8sApplicationService, K8sUtil k8s2.K8sService,
9295
deploymentConfigurationService common.DeploymentConfigService,
9396
OCIRegistryConfigRepository repository2.OCIRegistryConfigRepository,
94-
argoApplicationService argoApplication.ArgoApplicationService) *InstalledAppResourceServiceImpl {
97+
argoApplicationService argoApplication.ArgoApplicationService,
98+
fluxApplicationService fluxApplication.FluxApplicationService) *InstalledAppResourceServiceImpl {
9599
return &InstalledAppResourceServiceImpl{
96100
logger: logger,
97101
installedAppRepository: installedAppRepository,
@@ -108,6 +112,7 @@ func NewInstalledAppResourceServiceImpl(logger *zap.SugaredLogger,
108112
deploymentConfigurationService: deploymentConfigurationService,
109113
OCIRegistryConfigRepository: OCIRegistryConfigRepository,
110114
argoApplicationService: argoApplicationService,
115+
fluxApplicationService: fluxApplicationService,
111116
}
112117
}
113118

@@ -171,6 +176,26 @@ func (impl *InstalledAppResourceServiceImpl) FetchResourceTree(rctx context.Cont
171176
releaseStatusMap := util2.InterfaceToMapAdapter(releaseStatus)
172177
appDetailsContainer.ReleaseStatus = releaseStatusMap
173178
}
179+
} else if util.IsFluxApp(deploymentConfig.DeploymentAppType) {
180+
req := &bean5.FluxAppIdentifier{
181+
ClusterId: installedApp.Environment.ClusterId,
182+
Namespace: installedApp.Environment.Namespace,
183+
Name: deploymentAppName,
184+
IsKustomizeApp: false,
185+
}
186+
detail, err := impl.fluxApplicationService.GetFluxAppDetail(rctx, req)
187+
if err != nil {
188+
impl.logger.Errorw("error in fetching app detail", "payload", req, "err", err)
189+
}
190+
if detail != nil {
191+
resourceTree = util2.InterfaceToMapAdapter(detail.ResourceTreeResponse)
192+
applicationStatus := detail.AppHealthStatus
193+
if detail.ResourceTreeResponse != nil && len(detail.ResourceTreeResponse.Nodes) == 0 {
194+
resourceTree["status"] = commonBean.HealthStatusUnknown
195+
} else {
196+
resourceTree["status"] = applicationStatus
197+
}
198+
}
174199
}
175200
if resourceTree != nil {
176201
version, err := impl.k8sCommonService.GetK8sServerVersion(installedApp.Environment.ClusterId)

wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)