diff --git a/api/cluster/wire_cluster.go b/api/cluster/wire_cluster.go index 2a38444542..bbfa050f87 100644 --- a/api/cluster/wire_cluster.go +++ b/api/cluster/wire_cluster.go @@ -29,6 +29,7 @@ import ( var ClusterWireSet = wire.NewSet( repository.NewClusterRepositoryImpl, wire.Bind(new(repository.ClusterRepository), new(*repository.ClusterRepositoryImpl)), + cluster.NewClusterServiceImpl, cluster.NewClusterServiceImplExtended, wire.Bind(new(cluster.ClusterService), new(*cluster.ClusterServiceImplExtended)), diff --git a/api/k8s/application/k8sApplicationRestHandler.go b/api/k8s/application/k8sApplicationRestHandler.go index b6830b7d0d..d153d84c98 100644 --- a/api/k8s/application/k8sApplicationRestHandler.go +++ b/api/k8s/application/k8sApplicationRestHandler.go @@ -559,6 +559,7 @@ func (handler *K8sApplicationRestHandlerImpl) GetPodLogs(w http.ResponseWriter, common.WriteJsonResp(w, err, nil, http.StatusBadRequest) return } + handler.logger.Infow("get pod logs request", "request", request) handler.requestValidationAndRBAC(w, r, token, request) lastEventId := r.Header.Get(bean2.LastEventID) isReconnect := false diff --git a/api/k8s/wire_k8sApp.go b/api/k8s/wire_k8sApp.go index 0e940ca648..c728d597ef 100644 --- a/api/k8s/wire_k8sApp.go +++ b/api/k8s/wire_k8sApp.go @@ -53,7 +53,4 @@ var K8sApplicationWireSet = wire.NewSet( informer.NewGlobalMapClusterNamespace, informer.NewK8sInformerFactoryImpl, wire.Bind(new(informer.K8sInformerFactory), new(*informer.K8sInformerFactoryImpl)), - - cluster.NewClusterCronServiceImpl, - wire.Bind(new(cluster.ClusterCronService), new(*cluster.ClusterCronServiceImpl)), ) diff --git a/cmd/external-app/wire_gen.go b/cmd/external-app/wire_gen.go index 23dbbb8301..5271cca4cd 100644 --- a/cmd/external-app/wire_gen.go +++ b/cmd/external-app/wire_gen.go @@ -201,7 +201,11 @@ func InitializeApp() (*App, error) { clusterRepositoryImpl := repository2.NewClusterRepositoryImpl(db, sugaredLogger) syncMap := informer.NewGlobalMapClusterNamespace() k8sInformerFactoryImpl := informer.NewK8sInformerFactoryImpl(sugaredLogger, syncMap, k8sServiceImpl) - clusterServiceImpl := cluster.NewClusterServiceImpl(clusterRepositoryImpl, sugaredLogger, k8sServiceImpl, k8sInformerFactoryImpl, userAuthRepositoryImpl, userRepositoryImpl, roleGroupRepositoryImpl) + cronLoggerImpl := cron.NewCronLoggerImpl(sugaredLogger) + clusterServiceImpl, err := cluster.NewClusterServiceImpl(clusterRepositoryImpl, sugaredLogger, k8sServiceImpl, k8sInformerFactoryImpl, userAuthRepositoryImpl, userRepositoryImpl, roleGroupRepositoryImpl, environmentVariables, cronLoggerImpl) + if err != nil { + return nil, err + } appStatusRepositoryImpl := appStatus.NewAppStatusRepositoryImpl(db, sugaredLogger) environmentRepositoryImpl := repository2.NewEnvironmentRepositoryImpl(db, sugaredLogger, appStatusRepositoryImpl) attributesRepositoryImpl := repository3.NewAttributesRepositoryImpl(db) @@ -334,7 +338,6 @@ func InitializeApp() (*App, error) { } moduleRepositoryImpl := moduleRepo.NewModuleRepositoryImpl(db) providerIdentifierServiceImpl := providerIdentifier.NewProviderIdentifierServiceImpl(sugaredLogger) - cronLoggerImpl := cron.NewCronLoggerImpl(sugaredLogger) telemetryEventClientImpl, err := telemetry.NewTelemetryEventClientImpl(sugaredLogger, httpClient, clusterServiceImpl, k8sServiceImpl, acdAuthConfig, userServiceImpl, attributesRepositoryImpl, ssoLoginServiceImpl, posthogClient, moduleRepositoryImpl, serverDataStoreServerDataStore, userAuditServiceImpl, helmAppClientImpl, installedAppRepositoryImpl, providerIdentifierServiceImpl, cronLoggerImpl) if err != nil { return nil, err diff --git a/pkg/cluster/ClusterCronService.go b/pkg/cluster/ClusterCronService.go deleted file mode 100644 index 6b4a556787..0000000000 --- a/pkg/cluster/ClusterCronService.go +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2024. Devtron Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cluster - -import ( - "fmt" - "github.com/caarlos0/env/v6" - cron2 "github.com/devtron-labs/devtron/util/cron" - "github.com/robfig/cron/v3" - "go.uber.org/zap" -) - -type ClusterCronService interface { -} - -type ClusterCronServiceImpl struct { - logger *zap.SugaredLogger - clusterService ClusterService -} - -type ClusterStatusConfig struct { - ClusterStatusCronTime int `env:"CLUSTER_STATUS_CRON_TIME" envDefault:"15"` -} - -func NewClusterCronServiceImpl(logger *zap.SugaredLogger, clusterService ClusterService, cronLogger *cron2.CronLoggerImpl) (*ClusterCronServiceImpl, error) { - clusterCronServiceImpl := &ClusterCronServiceImpl{ - logger: logger, - clusterService: clusterService, - } - // initialise cron - newCron := cron.New(cron.WithChain(cron.Recover(cronLogger))) - newCron.Start() - cfg := &ClusterStatusConfig{} - err := env.Parse(cfg) - if err != nil { - fmt.Println("failed to parse server cluster status config: " + err.Error()) - } - // add function into cron - _, err = newCron.AddFunc(fmt.Sprintf("@every %dm", cfg.ClusterStatusCronTime), clusterCronServiceImpl.GetAndUpdateClusterConnectionStatus) - if err != nil { - fmt.Println("error in adding cron function into cluster cron service") - return clusterCronServiceImpl, err - } - return clusterCronServiceImpl, nil -} - -func (impl *ClusterCronServiceImpl) GetAndUpdateClusterConnectionStatus() { - impl.logger.Debug("starting cluster connection status fetch thread") - defer impl.logger.Debug("stopped cluster connection status fetch thread") - - //getting all clusters - clusters, err := impl.clusterService.FindAllExceptVirtual() - if err != nil { - impl.logger.Errorw("error in getting all clusters", "err", err) - return - } - impl.clusterService.ConnectClustersInBatch(clusters, true) -} diff --git a/pkg/cluster/ClusterService.go b/pkg/cluster/ClusterService.go index 54d59508db..ad088f74cf 100644 --- a/pkg/cluster/ClusterService.go +++ b/pkg/cluster/ClusterService.go @@ -20,6 +20,8 @@ import ( "context" "encoding/json" "fmt" + cronUtil "github.com/devtron-labs/devtron/util/cron" + "github.com/robfig/cron/v3" "log" "net/http" "net/url" @@ -43,7 +45,7 @@ import ( "github.com/devtron-labs/devtron/internal/constants" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/cluster/repository" - util2 "github.com/devtron-labs/devtron/util" + globalUtil "github.com/devtron-labs/devtron/util" "github.com/go-pg/pg" "go.uber.org/zap" ) @@ -201,7 +203,9 @@ type ClusterServiceImpl struct { func NewClusterServiceImpl(repository repository.ClusterRepository, logger *zap.SugaredLogger, K8sUtil *k8s.K8sServiceImpl, K8sInformerFactory informer.K8sInformerFactory, userAuthRepository repository3.UserAuthRepository, userRepository repository3.UserRepository, - roleGroupRepository repository3.RoleGroupRepository) *ClusterServiceImpl { + roleGroupRepository repository3.RoleGroupRepository, + envVariables *globalUtil.EnvironmentVariables, + cronLogger *cronUtil.CronLoggerImpl) (*ClusterServiceImpl, error) { clusterService := &ClusterServiceImpl{ clusterRepository: repository, logger: logger, @@ -211,8 +215,19 @@ func NewClusterServiceImpl(repository repository.ClusterRepository, logger *zap. userRepository: userRepository, roleGroupRepository: roleGroupRepository, } + // initialise cron + newCron := cron.New(cron.WithChain(cron.Recover(cronLogger))) + newCron.Start() + cfg := envVariables.GlobalClusterConfig + // add function into cron + _, err := newCron.AddFunc(fmt.Sprintf("@every %dm", cfg.ClusterStatusCronTime), clusterService.getAndUpdateClusterConnectionStatus) + if err != nil { + fmt.Println("error in adding cron function into cluster cron service") + return clusterService, err + } + logger.Infow("cluster cron service started successfully!", "cronTime", cfg.ClusterStatusCronTime) go clusterService.buildInformer() - return clusterService + return clusterService, nil } func (impl *ClusterServiceImpl) ConvertClusterBeanToCluster(clusterBean *ClusterBean, userId int32) *repository.Cluster { @@ -242,6 +257,20 @@ func (impl *ClusterServiceImpl) ConvertClusterBeanToCluster(clusterBean *Cluster return model } +// getAndUpdateClusterConnectionStatus is a cron function to update the connection status of all clusters +func (impl *ClusterServiceImpl) getAndUpdateClusterConnectionStatus() { + impl.logger.Debug("starting cluster connection status fetch thread") + defer impl.logger.Debug("stopped cluster connection status fetch thread") + + //getting all clusters + clusters, err := impl.FindAllExceptVirtual() + if err != nil { + impl.logger.Errorw("error in getting all clusters", "err", err) + return + } + impl.ConnectClustersInBatch(clusters, true) +} + func (impl *ClusterServiceImpl) Save(parent context.Context, bean *ClusterBean, userId int32) (*ClusterBean, error) { //validating config @@ -289,7 +318,7 @@ func (impl *ClusterServiceImpl) Save(parent context.Context, bean *ClusterBean, //on successful creation of new cluster, update informer cache for namespace group by cluster //here sync for ea mode only - if util2.IsBaseStack() { + if globalUtil.IsBaseStack() { impl.SyncNsInformer(bean) } impl.logger.Info("saving secret for cluster informer") @@ -530,7 +559,7 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *ClusterBean, u bean.Id = model.Id //here sync for ea mode only - if bean.HasConfigOrUrlChanged && util2.IsBaseStack() { + if bean.HasConfigOrUrlChanged && globalUtil.IsBaseStack() { impl.SyncNsInformer(bean) } impl.logger.Infow("saving secret for cluster informer") @@ -643,7 +672,7 @@ func (impl *ClusterServiceImpl) buildInformer() { impl.K8sInformerFactory.BuildInformer(clusterInfo) } -func (impl ClusterServiceImpl) DeleteFromDb(bean *ClusterBean, userId int32) error { +func (impl *ClusterServiceImpl) DeleteFromDb(bean *ClusterBean, userId int32) error { existingCluster, err := impl.clusterRepository.FindById(bean.Id) if err != nil { impl.logger.Errorw("No matching entry found for delete.", "id", bean.Id) @@ -668,7 +697,7 @@ func (impl ClusterServiceImpl) DeleteFromDb(bean *ClusterBean, userId int32) err return nil } -func (impl ClusterServiceImpl) CheckIfConfigIsValid(cluster *ClusterBean) error { +func (impl *ClusterServiceImpl) CheckIfConfigIsValid(cluster *ClusterBean) error { clusterConfig := cluster.GetClusterConfig() response, err := impl.K8sUtil.DiscoveryClientGetLiveZCall(clusterConfig) if err != nil { @@ -1068,7 +1097,7 @@ func (impl *ClusterServiceImpl) GetAndUpdateConnectionStatusForOneCluster(k8sCli mutex.Unlock() } -func (impl ClusterServiceImpl) ConvertClusterBeanObjectToCluster(bean *ClusterBean) *v1alpha1.Cluster { +func (impl *ClusterServiceImpl) ConvertClusterBeanObjectToCluster(bean *ClusterBean) *v1alpha1.Cluster { configMap := bean.Config serverUrl := bean.ServerUrl bearerToken := "" @@ -1097,7 +1126,7 @@ func (impl ClusterServiceImpl) ConvertClusterBeanObjectToCluster(bean *ClusterBe return cl } -func (impl ClusterServiceImpl) GetClusterConfigByClusterId(clusterId int) (*k8s.ClusterConfig, error) { +func (impl *ClusterServiceImpl) GetClusterConfigByClusterId(clusterId int) (*k8s.ClusterConfig, error) { clusterBean, err := impl.FindById(clusterId) if err != nil { impl.logger.Errorw("error in getting clusterBean by cluster id", "err", err, "clusterId", clusterId) @@ -1108,7 +1137,7 @@ func (impl ClusterServiceImpl) GetClusterConfigByClusterId(clusterId int) (*k8s. return clusterConfig, nil } -func (impl ClusterServiceImpl) IsClusterReachable(clusterId int) (bool, error) { +func (impl *ClusterServiceImpl) IsClusterReachable(clusterId int) (bool, error) { cluster, err := impl.clusterRepository.FindById(clusterId) if err != nil { impl.logger.Errorw("error in finding cluster from clusterId", "envId", clusterId) diff --git a/pkg/cluster/ClusterServiceExtended.go b/pkg/cluster/ClusterServiceExtended.go index 045d5ce5ae..c8047bc162 100644 --- a/pkg/cluster/ClusterServiceExtended.go +++ b/pkg/cluster/ClusterServiceExtended.go @@ -27,9 +27,6 @@ import ( cluster3 "github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster" "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" "github.com/devtron-labs/common-lib/utils/k8s" - repository5 "github.com/devtron-labs/devtron/pkg/auth/user/repository" - "github.com/devtron-labs/devtron/pkg/k8s/informer" - cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster" "github.com/devtron-labs/devtron/client/grafana" "github.com/devtron-labs/devtron/internal/constants" @@ -37,7 +34,6 @@ import ( appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" repository2 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" "github.com/devtron-labs/devtron/pkg/cluster/repository" - "go.uber.org/zap" ) // extends ClusterServiceImpl and enhances method of ClusterService with full mode specific errors @@ -50,30 +46,19 @@ type ClusterServiceImplExtended struct { *ClusterServiceImpl } -func NewClusterServiceImplExtended(repository repository.ClusterRepository, environmentRepository repository.EnvironmentRepository, - grafanaClient grafana.GrafanaClient, logger *zap.SugaredLogger, installedAppRepository repository2.InstalledAppRepository, - K8sUtil *k8s.K8sServiceImpl, - clusterServiceCD cluster2.ServiceClient, K8sInformerFactory informer.K8sInformerFactory, - userAuthRepository repository5.UserAuthRepository, - userRepository repository5.UserRepository, roleGroupRepository repository5.RoleGroupRepository, - gitOpsConfigReadService config.GitOpsConfigReadService) *ClusterServiceImplExtended { +func NewClusterServiceImplExtended(environmentRepository repository.EnvironmentRepository, + grafanaClient grafana.GrafanaClient, installedAppRepository repository2.InstalledAppRepository, + clusterServiceCD cluster2.ServiceClient, + gitOpsConfigReadService config.GitOpsConfigReadService, + clusterServiceImpl *ClusterServiceImpl) *ClusterServiceImplExtended { clusterServiceExt := &ClusterServiceImplExtended{ environmentRepository: environmentRepository, grafanaClient: grafanaClient, installedAppRepository: installedAppRepository, clusterServiceCD: clusterServiceCD, gitOpsConfigReadService: gitOpsConfigReadService, - ClusterServiceImpl: &ClusterServiceImpl{ - clusterRepository: repository, - logger: logger, - K8sUtil: K8sUtil, - K8sInformerFactory: K8sInformerFactory, - userAuthRepository: userAuthRepository, - userRepository: userRepository, - roleGroupRepository: roleGroupRepository, - }, + ClusterServiceImpl: clusterServiceImpl, } - go clusterServiceExt.buildInformer() return clusterServiceExt } diff --git a/pkg/k8s/capacity/k8sCapacityService.go b/pkg/k8s/capacity/k8sCapacityService.go index 3ed56849ea..7768f810f5 100644 --- a/pkg/k8s/capacity/k8sCapacityService.go +++ b/pkg/k8s/capacity/k8sCapacityService.go @@ -113,7 +113,7 @@ func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetail(ctx context.Context if err != nil { if client.IsClusterUnReachableError(err) { impl.logger.Errorw("k8s cluster unreachable", "err", err) - return nil, &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: err.Error()} + return nil, &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: err.Error(), InternalMessage: err.Error()} } impl.logger.Errorw("error in getting node list", "err", err, "clusterId", cluster.Id) return nil, err diff --git a/util/GlobalConfig.go b/util/GlobalConfig.go index e980325d29..879c34094e 100644 --- a/util/GlobalConfig.go +++ b/util/GlobalConfig.go @@ -25,6 +25,7 @@ type EnvironmentVariables struct { DevtronSecretConfig *DevtronSecretConfig DeploymentServiceTypeConfig *DeploymentServiceTypeConfig TerminalEnvVariables *TerminalEnvVariables + GlobalClusterConfig *GlobalClusterConfig } type DeploymentServiceTypeConfig struct { @@ -43,6 +44,10 @@ type GlobalEnvVariables struct { ExecuteWireNilChecker bool `env:"EXECUTE_WIRE_NIL_CHECKER" envDefault:"false"` } +type GlobalClusterConfig struct { + ClusterStatusCronTime int `env:"CLUSTER_STATUS_CRON_TIME" envDefault:"15"` +} + type DevtronSecretConfig struct { DevtronSecretName string `env:"DEVTRON_SECRET_NAME" envDefault:"devtron-secret"` DevtronDexSecretNamespace string `env:"DEVTRON_DEX_SECRET_NAMESPACE" envDefault:"devtroncd"` @@ -58,6 +63,7 @@ func GetEnvironmentVariables() (*EnvironmentVariables, error) { DevtronSecretConfig: &DevtronSecretConfig{}, DeploymentServiceTypeConfig: &DeploymentServiceTypeConfig{}, TerminalEnvVariables: &TerminalEnvVariables{}, + GlobalClusterConfig: &GlobalClusterConfig{}, } err := env.Parse(cfg) if err != nil { diff --git a/wire_gen.go b/wire_gen.go index 0bc013a9cf..76510b4eab 100644 --- a/wire_gen.go +++ b/wire_gen.go @@ -239,7 +239,6 @@ func InitializeApp() (*App, error) { } appStatusRepositoryImpl := appStatus.NewAppStatusRepositoryImpl(db, sugaredLogger) environmentRepositoryImpl := repository.NewEnvironmentRepositoryImpl(db, sugaredLogger, appStatusRepositoryImpl) - clusterRepositoryImpl := repository.NewClusterRepositoryImpl(db, sugaredLogger) httpClient := util.NewHttpClient() grafanaClientConfig, err := grafana.GetGrafanaClientConfig() if err != nil { @@ -249,11 +248,6 @@ func InitializeApp() (*App, error) { attributesServiceImpl := attributes.NewAttributesServiceImpl(sugaredLogger, attributesRepositoryImpl) grafanaClientImpl := grafana.NewGrafanaClientImpl(sugaredLogger, httpClient, grafanaClientConfig, attributesServiceImpl) installedAppRepositoryImpl := repository3.NewInstalledAppRepositoryImpl(sugaredLogger, db) - runtimeConfig, err := k8s.GetRuntimeConfig() - if err != nil { - return nil, err - } - k8sServiceImpl := k8s.NewK8sUtil(sugaredLogger, runtimeConfig) connectionConfig, err := connection.GetConfig() if err != nil { return nil, err @@ -268,19 +262,17 @@ func InitializeApp() (*App, error) { return nil, err } serviceClientImpl := cluster.NewServiceClientImpl(sugaredLogger, argoCDConnectionManagerImpl) - syncMap := informer.NewGlobalMapClusterNamespace() - k8sInformerFactoryImpl := informer.NewK8sInformerFactoryImpl(sugaredLogger, syncMap, k8sServiceImpl) + gitOpsConfigRepositoryImpl := repository2.NewGitOpsConfigRepositoryImpl(sugaredLogger, db) defaultAuthPolicyRepositoryImpl := repository4.NewDefaultAuthPolicyRepositoryImpl(db, sugaredLogger) defaultAuthRoleRepositoryImpl := repository4.NewDefaultAuthRoleRepositoryImpl(db, sugaredLogger) userAuthRepositoryImpl := repository4.NewUserAuthRepositoryImpl(db, sugaredLogger, defaultAuthPolicyRepositoryImpl, defaultAuthRoleRepositoryImpl) userRepositoryImpl := repository4.NewUserRepositoryImpl(db, sugaredLogger) roleGroupRepositoryImpl := repository4.NewRoleGroupRepositoryImpl(db, sugaredLogger) - gitOpsConfigRepositoryImpl := repository2.NewGitOpsConfigRepositoryImpl(sugaredLogger, db) - clientRuntimeConfig, err := client.GetRuntimeConfig() + runtimeConfig, err := client.GetRuntimeConfig() if err != nil { return nil, err } - k8sClient, err := client.NewK8sClient(clientRuntimeConfig) + k8sClient, err := client.NewK8sClient(runtimeConfig) if err != nil { return nil, err } @@ -309,7 +301,20 @@ func InitializeApp() (*App, error) { return nil, err } gitOpsConfigReadServiceImpl := config.NewGitOpsConfigReadServiceImpl(sugaredLogger, gitOpsConfigRepositoryImpl, userServiceImpl, environmentVariables) - clusterServiceImplExtended := cluster2.NewClusterServiceImplExtended(clusterRepositoryImpl, environmentRepositoryImpl, grafanaClientImpl, sugaredLogger, installedAppRepositoryImpl, k8sServiceImpl, serviceClientImpl, k8sInformerFactoryImpl, userAuthRepositoryImpl, userRepositoryImpl, roleGroupRepositoryImpl, gitOpsConfigReadServiceImpl) + clusterRepositoryImpl := repository.NewClusterRepositoryImpl(db, sugaredLogger) + k8sRuntimeConfig, err := k8s.GetRuntimeConfig() + if err != nil { + return nil, err + } + k8sServiceImpl := k8s.NewK8sUtil(sugaredLogger, k8sRuntimeConfig) + syncMap := informer.NewGlobalMapClusterNamespace() + k8sInformerFactoryImpl := informer.NewK8sInformerFactoryImpl(sugaredLogger, syncMap, k8sServiceImpl) + cronLoggerImpl := cron.NewCronLoggerImpl(sugaredLogger) + clusterServiceImpl, err := cluster2.NewClusterServiceImpl(clusterRepositoryImpl, sugaredLogger, k8sServiceImpl, k8sInformerFactoryImpl, userAuthRepositoryImpl, userRepositoryImpl, roleGroupRepositoryImpl, environmentVariables, cronLoggerImpl) + if err != nil { + return nil, err + } + clusterServiceImplExtended := cluster2.NewClusterServiceImplExtended(environmentRepositoryImpl, grafanaClientImpl, installedAppRepositoryImpl, serviceClientImpl, gitOpsConfigReadServiceImpl, clusterServiceImpl) loginService := middleware.NewUserLogin(sessionManager, k8sClient) userAuthServiceImpl := user.NewUserAuthServiceImpl(userAuthRepositoryImpl, sessionManager, loginService, sugaredLogger, userRepositoryImpl, roleGroupRepositoryImpl, userServiceImpl) environmentServiceImpl := cluster2.NewEnvironmentServiceImpl(environmentRepositoryImpl, clusterServiceImplExtended, sugaredLogger, k8sServiceImpl, k8sInformerFactoryImpl, userAuthServiceImpl, attributesRepositoryImpl) @@ -384,14 +389,13 @@ func InitializeApp() (*App, error) { moduleServiceHelperImpl := module.NewModuleServiceHelperImpl(serverEnvConfigServerEnvConfig) moduleResourceStatusRepositoryImpl := moduleRepo.NewModuleResourceStatusRepositoryImpl(db) moduleDataStoreModuleDataStore := moduleDataStore.InitModuleDataStore() - cronLoggerImpl := cron.NewCronLoggerImpl(sugaredLogger) moduleCronServiceImpl, err := module.NewModuleCronServiceImpl(sugaredLogger, moduleEnvConfig, moduleRepositoryImpl, serverEnvConfigServerEnvConfig, helmAppServiceImpl, moduleServiceHelperImpl, moduleResourceStatusRepositoryImpl, moduleDataStoreModuleDataStore, cronLoggerImpl) if err != nil { return nil, err } scanToolMetadataRepositoryImpl := security.NewScanToolMetadataRepositoryImpl(db, sugaredLogger) moduleServiceImpl := module.NewModuleServiceImpl(sugaredLogger, serverEnvConfigServerEnvConfig, moduleRepositoryImpl, moduleActionAuditLogRepositoryImpl, helmAppServiceImpl, serverDataStoreServerDataStore, serverCacheServiceImpl, moduleCacheServiceImpl, moduleCronServiceImpl, moduleServiceHelperImpl, moduleResourceStatusRepositoryImpl, scanToolMetadataRepositoryImpl) - argoUserServiceImpl, err := argo.NewArgoUserServiceImpl(sugaredLogger, clusterServiceImplExtended, environmentVariables, runtimeConfig, argoCDConnectionManagerImpl, versionServiceImpl, k8sServiceImpl, gitOpsConfigReadServiceImpl, moduleServiceImpl) + argoUserServiceImpl, err := argo.NewArgoUserServiceImpl(sugaredLogger, clusterServiceImplExtended, environmentVariables, k8sRuntimeConfig, argoCDConnectionManagerImpl, versionServiceImpl, k8sServiceImpl, gitOpsConfigReadServiceImpl, moduleServiceImpl) if err != nil { return nil, err }