diff --git a/Wire.go b/Wire.go index 2b1abfd489..092943badb 100644 --- a/Wire.go +++ b/Wire.go @@ -121,6 +121,7 @@ import ( "github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig" chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository" "github.com/devtron-labs/devtron/pkg/commonService" + "github.com/devtron-labs/devtron/pkg/configDiff" delete2 "github.com/devtron-labs/devtron/pkg/delete" deployment2 "github.com/devtron-labs/devtron/pkg/deployment" "github.com/devtron-labs/devtron/pkg/deployment/common" @@ -706,6 +707,13 @@ func InitializeApp() (*App, error) { scopedVariable.NewScopedVariableRestHandlerImpl, wire.Bind(new(scopedVariable.ScopedVariableRestHandler), new(*scopedVariable.ScopedVariableRestHandlerImpl)), + router.NewDeploymentConfigurationRouter, + wire.Bind(new(router.DeploymentConfigurationRouter), new(*router.DeploymentConfigurationRouterImpl)), + restHandler.NewDeploymentConfigurationRestHandlerImpl, + wire.Bind(new(restHandler.DeploymentConfigurationRestHandler), new(*restHandler.DeploymentConfigurationRestHandlerImpl)), + configDiff.NewDeploymentConfigurationServiceImpl, + wire.Bind(new(configDiff.DeploymentConfigurationService), new(*configDiff.DeploymentConfigurationServiceImpl)), + router.NewTelemetryRouterImpl, wire.Bind(new(router.TelemetryRouter), new(*router.TelemetryRouterImpl)), restHandler.NewTelemetryRestHandlerImpl, diff --git a/api/restHandler/DeploymentConfigurationRestHandler.go b/api/restHandler/DeploymentConfigurationRestHandler.go new file mode 100644 index 0000000000..216a00d8bb --- /dev/null +++ b/api/restHandler/DeploymentConfigurationRestHandler.go @@ -0,0 +1,71 @@ +package restHandler + +import ( + "fmt" + "github.com/devtron-labs/devtron/api/restHandler/common" + "github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin" + "github.com/devtron-labs/devtron/pkg/auth/user" + "github.com/devtron-labs/devtron/pkg/configDiff" + "github.com/devtron-labs/devtron/util/rbac" + "go.uber.org/zap" + "gopkg.in/go-playground/validator.v9" + "net/http" +) + +type DeploymentConfigurationRestHandler interface { + ConfigAutoComplete(w http.ResponseWriter, r *http.Request) +} +type DeploymentConfigurationRestHandlerImpl struct { + logger *zap.SugaredLogger + userAuthService user.UserService + validator *validator.Validate + enforcerUtil rbac.EnforcerUtil + deploymentConfigurationService configDiff.DeploymentConfigurationService +} + +func NewDeploymentConfigurationRestHandlerImpl(logger *zap.SugaredLogger, + userAuthService user.UserService, + enforcerUtil rbac.EnforcerUtil, + deploymentConfigurationService configDiff.DeploymentConfigurationService, +) *DeploymentConfigurationRestHandlerImpl { + return &DeploymentConfigurationRestHandlerImpl{ + logger: logger, + userAuthService: userAuthService, + enforcerUtil: enforcerUtil, + deploymentConfigurationService: deploymentConfigurationService, + } +} + +func (handler *DeploymentConfigurationRestHandlerImpl) ConfigAutoComplete(w http.ResponseWriter, r *http.Request) { + userId, err := handler.userAuthService.GetLoggedInUser(r) + if userId == 0 || err != nil { + common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized) + return + } + appId, err := common.ExtractIntQueryParam(w, r, "appId", 0) + if err != nil { + return + } + envId, err := common.ExtractIntQueryParam(w, r, "envId", 0) + if err != nil { + return + } + + //RBAC START + token := r.Header.Get(common.TokenHeaderKey) + object := handler.enforcerUtil.GetAppRBACNameByAppId(appId) + ok := handler.enforcerUtil.CheckAppRbacForAppOrJob(token, object, casbin.ActionGet) + if !ok { + common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), nil, http.StatusForbidden) + return + } + //RBAC END + + res, err := handler.deploymentConfigurationService.ConfigAutoComplete(appId, envId) + if err != nil { + handler.logger.Errorw("service err, ConfigAutoComplete ", "appId", appId, "envId", envId, "err", err) + common.WriteJsonResp(w, err, nil, http.StatusInternalServerError) + return + } + common.WriteJsonResp(w, err, res, http.StatusOK) +} diff --git a/api/router/DeploymentConfigRouter.go b/api/router/DeploymentConfigRouter.go new file mode 100644 index 0000000000..941118099a --- /dev/null +++ b/api/router/DeploymentConfigRouter.go @@ -0,0 +1,27 @@ +package router + +import ( + "github.com/devtron-labs/devtron/api/restHandler" + "github.com/gorilla/mux" +) + +type DeploymentConfigurationRouter interface { + initDeploymentConfigurationRouter(configRouter *mux.Router) +} + +type DeploymentConfigurationRouterImpl struct { + deploymentGroupRestHandler restHandler.DeploymentConfigurationRestHandler +} + +func NewDeploymentConfigurationRouter(deploymentGroupRestHandler restHandler.DeploymentConfigurationRestHandler) *DeploymentConfigurationRouterImpl { + router := &DeploymentConfigurationRouterImpl{ + deploymentGroupRestHandler: deploymentGroupRestHandler, + } + return router +} + +func (router DeploymentConfigurationRouterImpl) initDeploymentConfigurationRouter(configRouter *mux.Router) { + configRouter.Path("/autocomplete"). + HandlerFunc(router.deploymentGroupRestHandler.ConfigAutoComplete). + Methods("GET") +} diff --git a/api/router/router.go b/api/router/router.go index 95bbeade9a..33cda124bf 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -113,6 +113,7 @@ type MuxRouter struct { rbacRoleRouter user.RbacRoleRouter scopedVariableRouter ScopedVariableRouter ciTriggerCron cron.CiTriggerCron + deploymentConfigurationRouter DeploymentConfigurationRouter infraConfigRouter infraConfig.InfraConfigRouter argoApplicationRouter argoApplication.ArgoApplicationRouter devtronResourceRouter devtronResource.DevtronResourceRouter @@ -144,6 +145,7 @@ func NewMuxRouter(logger *zap.SugaredLogger, scopedVariableRouter ScopedVariableRouter, ciTriggerCron cron.CiTriggerCron, proxyRouter proxy.ProxyRouter, + deploymentConfigurationRouter DeploymentConfigurationRouter, infraConfigRouter infraConfig.InfraConfigRouter, argoApplicationRouter argoApplication.ArgoApplicationRouter, devtronResourceRouter devtronResource.DevtronResourceRouter) *MuxRouter { @@ -206,6 +208,7 @@ func NewMuxRouter(logger *zap.SugaredLogger, rbacRoleRouter: rbacRoleRouter, scopedVariableRouter: scopedVariableRouter, ciTriggerCron: ciTriggerCron, + deploymentConfigurationRouter: deploymentConfigurationRouter, infraConfigRouter: infraConfigRouter, argoApplicationRouter: argoApplicationRouter, devtronResourceRouter: devtronResourceRouter, @@ -288,8 +291,9 @@ func (r MuxRouter) Init() { chartRefRouter := r.Router.PathPrefix("/orchestrator/chartref").Subrouter() r.ChartRefRouter.initChartRefRouter(chartRefRouter) - configMapRouter := r.Router.PathPrefix("/orchestrator/config").Subrouter() - r.ConfigMapRouter.initConfigMapRouter(configMapRouter) + configRouter := r.Router.PathPrefix("/orchestrator/config").Subrouter() + r.ConfigMapRouter.initConfigMapRouter(configRouter) + r.deploymentConfigurationRouter.initDeploymentConfigurationRouter(configRouter) appStoreRouter := r.Router.PathPrefix("/orchestrator/app-store").Subrouter() r.AppStoreRouter.Init(appStoreRouter) diff --git a/cmd/external-app/wire_gen.go b/cmd/external-app/wire_gen.go index 917252738d..7cada24e76 100644 --- a/cmd/external-app/wire_gen.go +++ b/cmd/external-app/wire_gen.go @@ -1,6 +1,6 @@ // Code generated by Wire. DO NOT EDIT. -//go:generate go run -mod=mod github.com/google/wire/cmd/wire +//go:generate go run github.com/google/wire/cmd/wire //go:build !wireinject // +build !wireinject diff --git a/internal/sql/repository/chartConfig/ConfigMapRepository.go b/internal/sql/repository/chartConfig/ConfigMapRepository.go index 5cc1231199..764378765c 100644 --- a/internal/sql/repository/chartConfig/ConfigMapRepository.go +++ b/internal/sql/repository/chartConfig/ConfigMapRepository.go @@ -17,6 +17,7 @@ package chartConfig import ( + "github.com/devtron-labs/devtron/pkg/pipeline/bean" "github.com/devtron-labs/devtron/pkg/sql" "github.com/go-pg/pg" "github.com/go-pg/pg/orm" @@ -38,6 +39,7 @@ type ConfigMapRepository interface { GetByAppIdAppLevel(appId int) (*ConfigMapAppModel, error) GetByAppIdAndEnvIdEnvLevel(appId int, envId int) (*ConfigMapEnvModel, error) GetEnvLevelByAppId(appId int) ([]*ConfigMapEnvModel, error) + GetConfigNamesForAppAndEnvLevel(appId int, envId int) ([]bean.ConfigNameAndType, error) } type ConfigMapRepositoryImpl struct { @@ -49,6 +51,11 @@ func NewConfigMapRepositoryImpl(Logger *zap.SugaredLogger, dbConnection *pg.DB) return &ConfigMapRepositoryImpl{dbConnection: dbConnection, Logger: Logger} } +const ( + ConfigMapAppLevel string = "config_map_app_level" + ConfigMapEnvLevel string = "config_map_env_level" +) + type ConfigMapAppModel struct { TableName struct{} `sql:"config_map_app_level" pg:",discard_unknown_columns"` Id int `sql:"id,pk"` @@ -57,6 +64,55 @@ type ConfigMapAppModel struct { SecretData string `sql:"secret_data"` sql.AuditLog } +type cMCSNames struct { + Id int `json:"id"` + CMName string `json:"cm_name"` + CSName string `json:"cs_name"` +} + +func (impl ConfigMapRepositoryImpl) GetConfigNamesForAppAndEnvLevel(appId int, envId int) ([]bean.ConfigNameAndType, error) { + var cMCSNames []cMCSNames + tableName := ConfigMapEnvLevel + if envId == -1 { + tableName = ConfigMapAppLevel + } + //below query iterates over the cm, cs stored as json element, and fetches cmName and csName, id for a particular appId or envId if provided + query := impl.dbConnection. + Model(). + Table(tableName). + Column("id"). + ColumnExpr("json_array_elements(CASE WHEN (config_map_data::json->'maps')::TEXT != 'null' THEN (config_map_data::json->'maps') ELSE '[]' END )->>'name' AS cm_name"). + ColumnExpr("json_array_elements(CASE WHEN (secret_data::json->'secrets')::TEXT != 'null' THEN (secret_data::json->'secrets') ELSE '[]' END )->>'name' AS cs_name"). + Where("app_id = ?", appId) + + if envId > 0 { + query = query.Where("environment_id=?", envId) + } + if err := query.Select(&cMCSNames); err != nil { + if err != pg.ErrNoRows { + impl.Logger.Errorw("error occurred while fetching CM/CS names", "appId", appId, "err", err) + return nil, err + } + } + var configNames []bean.ConfigNameAndType + for _, name := range cMCSNames { + if name.CMName != "" { + configNames = append(configNames, bean.ConfigNameAndType{ + Id: name.Id, + Name: name.CMName, + Type: bean.CM, + }) + } + if name.CSName != "" { + configNames = append(configNames, bean.ConfigNameAndType{ + Id: name.Id, + Name: name.CSName, + Type: bean.CS, + }) + } + } + return configNames, nil +} func (impl ConfigMapRepositoryImpl) CreateAppLevel(model *ConfigMapAppModel) (*ConfigMapAppModel, error) { err := impl.dbConnection.Insert(model) diff --git a/pkg/configDiff/DeploymentConfigurationService.go b/pkg/configDiff/DeploymentConfigurationService.go new file mode 100644 index 0000000000..78a25a8ee2 --- /dev/null +++ b/pkg/configDiff/DeploymentConfigurationService.go @@ -0,0 +1,58 @@ +package configDiff + +import ( + "github.com/devtron-labs/devtron/pkg/configDiff/adaptor" + bean2 "github.com/devtron-labs/devtron/pkg/configDiff/bean" + "github.com/devtron-labs/devtron/pkg/configDiff/helper" + "github.com/devtron-labs/devtron/pkg/pipeline" + "github.com/devtron-labs/devtron/pkg/pipeline/bean" + "go.uber.org/zap" +) + +type DeploymentConfigurationService interface { + ConfigAutoComplete(appId int, envId int) (*bean2.ConfigDataResponse, error) +} + +type DeploymentConfigurationServiceImpl struct { + logger *zap.SugaredLogger + configMapService pipeline.ConfigMapService +} + +func NewDeploymentConfigurationServiceImpl(logger *zap.SugaredLogger, + configMapService pipeline.ConfigMapService, +) (*DeploymentConfigurationServiceImpl, error) { + deploymentConfigurationService := &DeploymentConfigurationServiceImpl{ + logger: logger, + configMapService: configMapService, + } + + return deploymentConfigurationService, nil +} +func (impl *DeploymentConfigurationServiceImpl) ConfigAutoComplete(appId int, envId int) (*bean2.ConfigDataResponse, error) { + cMCSNamesAppLevel, cMCSNamesEnvLevel, err := impl.configMapService.FetchCmCsNamesAppAndEnvLevel(appId, envId) + if err != nil { + impl.logger.Errorw("error in fetching CM and CS names at app or env level", "appId", appId, "envId", envId, "err", err) + return nil, err + } + cmcsKeyPropertyAppLevelMap, cmcsKeyPropertyEnvLevelMap := adaptor.GetCmCsAppAndEnvLevelMap(cMCSNamesAppLevel, cMCSNamesEnvLevel) + for key, configProperty := range cmcsKeyPropertyAppLevelMap { + if _, ok := cmcsKeyPropertyEnvLevelMap[key]; !ok { + if envId > 0 { + configProperty.ConfigStage = bean2.Inheriting + } + + } + } + for key, configProperty := range cmcsKeyPropertyEnvLevelMap { + if _, ok := cmcsKeyPropertyAppLevelMap[key]; ok { + configProperty.ConfigStage = bean2.Overridden + } else { + configProperty.ConfigStage = bean2.Env + } + } + combinedProperties := helper.GetCombinedPropertiesMap(cmcsKeyPropertyAppLevelMap, cmcsKeyPropertyEnvLevelMap) + combinedProperties = append(combinedProperties, adaptor.GetConfigProperty(0, "", bean.DeploymentTemplate, bean2.PublishedConfigState)) + + configDataResp := bean2.NewConfigDataResponse().WithResourceConfig(combinedProperties) + return configDataResp, nil +} diff --git a/pkg/configDiff/adaptor/adaptor.go b/pkg/configDiff/adaptor/adaptor.go new file mode 100644 index 0000000000..4ab81eb2d1 --- /dev/null +++ b/pkg/configDiff/adaptor/adaptor.go @@ -0,0 +1,29 @@ +package adaptor + +import ( + bean2 "github.com/devtron-labs/devtron/pkg/configDiff/bean" + "github.com/devtron-labs/devtron/pkg/pipeline/bean" +) + +func GetConfigProperty(id int, name string, configType bean.ResourceType, State bean2.ConfigState) *bean2.ConfigProperty { + return &bean2.ConfigProperty{ + Id: id, + Name: name, + Type: configType, + ConfigState: State, + } +} + +func GetCmCsAppAndEnvLevelMap(cMCSNamesAppLevel, cMCSNamesEnvLevel []bean.ConfigNameAndType) (map[string]*bean2.ConfigProperty, map[string]*bean2.ConfigProperty) { + cMCSNamesAppLevelMap, cMCSNamesEnvLevelMap := make(map[string]*bean2.ConfigProperty, len(cMCSNamesAppLevel)), make(map[string]*bean2.ConfigProperty, len(cMCSNamesEnvLevel)) + + for _, cmcs := range cMCSNamesAppLevel { + property := GetConfigProperty(cmcs.Id, cmcs.Name, cmcs.Type, bean2.PublishedConfigState) + cMCSNamesAppLevelMap[property.GetKey()] = property + } + for _, cmcs := range cMCSNamesEnvLevel { + property := GetConfigProperty(cmcs.Id, cmcs.Name, cmcs.Type, bean2.PublishedConfigState) + cMCSNamesEnvLevelMap[property.GetKey()] = property + } + return cMCSNamesAppLevelMap, cMCSNamesEnvLevelMap +} diff --git a/pkg/configDiff/bean/bean.go b/pkg/configDiff/bean/bean.go new file mode 100644 index 0000000000..0162f6ce03 --- /dev/null +++ b/pkg/configDiff/bean/bean.go @@ -0,0 +1,61 @@ +package bean + +import ( + "fmt" + "github.com/devtron-labs/devtron/pkg/pipeline/bean" +) + +type ConfigState string + +const ( + PublishedConfigState ConfigState = "Published" +) + +type ConfigStage string + +const ( + Env ConfigStage = "Env" + Inheriting ConfigStage = "Inheriting" + Overridden ConfigStage = "Overridden" +) + +type ConfigProperty struct { + Id int `json:"id"` + Name string `json:"name"` + ConfigState ConfigState `json:"configState"` + Type bean.ResourceType `json:"type"` + ConfigStage ConfigStage `json:"configStage"` +} + +func (r *ConfigProperty) IsConfigPropertyGlobal() bool { + return r.ConfigStage == Inheriting +} + +type ConfigDataResponse struct { + ResourceConfig []*ConfigProperty `json:"resourceConfig"` +} + +func NewConfigDataResponse() *ConfigDataResponse { + return &ConfigDataResponse{} +} + +func (r *ConfigDataResponse) WithResourceConfig(resourceConfig []*ConfigProperty) *ConfigDataResponse { + r.ResourceConfig = resourceConfig + return r +} + +func (r *ConfigProperty) GetKey() string { + return fmt.Sprintf("%s-%s", string(r.Type), r.Name) +} + +type ConfigPropertyIdentifier struct { + Name string `json:"name"` + Type bean.ResourceType `json:"type"` +} + +func (r *ConfigProperty) GetIdentifier() ConfigPropertyIdentifier { + return ConfigPropertyIdentifier{ + Name: r.Name, + Type: r.Type, + } +} diff --git a/pkg/configDiff/helper/helper.go b/pkg/configDiff/helper/helper.go new file mode 100644 index 0000000000..70082a7bea --- /dev/null +++ b/pkg/configDiff/helper/helper.go @@ -0,0 +1,20 @@ +package helper + +import ( + bean2 "github.com/devtron-labs/devtron/pkg/configDiff/bean" +) + +func GetCombinedPropertiesMap(cmcsKeyPropertyAppLevelMap, cmcsKeyPropertyEnvLevelMap map[string]*bean2.ConfigProperty) []*bean2.ConfigProperty { + combinedPropertiesMap := make(map[string]*bean2.ConfigProperty, len(cmcsKeyPropertyAppLevelMap)+len(cmcsKeyPropertyEnvLevelMap)) + for key, property := range cmcsKeyPropertyAppLevelMap { + combinedPropertiesMap[key] = property + } + for key, property := range cmcsKeyPropertyEnvLevelMap { + combinedPropertiesMap[key] = property + } + combinedProperties := make([]*bean2.ConfigProperty, 0, len(cmcsKeyPropertyAppLevelMap)+len(cmcsKeyPropertyEnvLevelMap)) + for _, property := range combinedPropertiesMap { + combinedProperties = append(combinedProperties, property) + } + return combinedProperties +} diff --git a/pkg/pipeline/ConfigMapService.go b/pkg/pipeline/ConfigMapService.go index 77e996dcce..975dfd96cc 100644 --- a/pkg/pipeline/ConfigMapService.go +++ b/pkg/pipeline/ConfigMapService.go @@ -81,6 +81,8 @@ type ConfigMapService interface { ConfigSecretEnvironmentDelete(createJobEnvOverrideRequest *bean.CreateJobEnvOverridePayload) (*bean.CreateJobEnvOverridePayload, error) ConfigSecretEnvironmentGet(appId int) ([]bean.JobEnvOverrideResponse, error) ConfigSecretEnvironmentClone(appId int, cloneAppId int, userId int32) ([]chartConfig.ConfigMapEnvModel, error) + + FetchCmCsNamesAppAndEnvLevel(appId int, envId int) ([]bean.ConfigNameAndType, []bean.ConfigNameAndType, error) } type ConfigMapServiceImpl struct { @@ -1991,3 +1993,20 @@ func (impl ConfigMapServiceImpl) ConfigSecretEnvironmentClone(appId int, cloneAp return jobEnvOverrideResponse, nil } +func (impl ConfigMapServiceImpl) FetchCmCsNamesAppAndEnvLevel(appId int, envId int) ([]bean.ConfigNameAndType, []bean.ConfigNameAndType, error) { + var cMCSNamesEnvLevel []bean.ConfigNameAndType + + cMCSNamesAppLevel, err := impl.configMapRepository.GetConfigNamesForAppAndEnvLevel(appId, -1) + if err != nil { + impl.logger.Errorw("error in fetching CM/CS names at app level ", "appId", appId, "err", err) + return nil, nil, err + } + if envId > 0 { + cMCSNamesEnvLevel, err = impl.configMapRepository.GetConfigNamesForAppAndEnvLevel(appId, envId) + if err != nil { + impl.logger.Errorw("error in fetching CM/CS names at env level ", "appId", appId, "envId", envId, "err", err) + return nil, nil, err + } + } + return cMCSNamesAppLevel, cMCSNamesEnvLevel, nil +} diff --git a/pkg/pipeline/bean/ConfigMapBean.go b/pkg/pipeline/bean/ConfigMapBean.go index cae2f33f4a..e66fc8dfa0 100644 --- a/pkg/pipeline/bean/ConfigMapBean.go +++ b/pkg/pipeline/bean/ConfigMapBean.go @@ -107,3 +107,17 @@ type CreateJobEnvOverridePayload struct { type SecretsList struct { ConfigData []*ConfigData `json:"secrets"` } + +type ConfigNameAndType struct { + Id int + Name string + Type ResourceType +} + +type ResourceType string + +const ( + CM ResourceType = "ConfigMap" + CS ResourceType = "Secret" + DeploymentTemplate ResourceType = "Deployment Template" +) diff --git a/specs/configDiffView.yaml b/specs/configDiffView.yaml new file mode 100644 index 0000000000..8a24d50989 --- /dev/null +++ b/specs/configDiffView.yaml @@ -0,0 +1,73 @@ +openapi: 3.0.0 +info: + title: Orchestrator Config Autocomplete API + version: 1.0.0 +paths: + /orchestrator/config/autocomplete: + get: + summary: Retrieve autocomplete data for configuration based on the provided appId and envId. The response includes configuration definitions with names, draft states, and types. + parameters: + - name: appId + in: query + description: The application ID. + required: true + schema: + type: string + - name: envId + in: query + description: The environment ID. + required: true + schema: + type: string + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/ConfigProperty" + + '500': + description: will get this response if any failure occurs at server side. + '400': + description: will get this response if invalid payload is sent in the request. + '403': + description: will get this response if user doesn't view access permission for the app or env + '404': + description: will get this when BaseDeployment Template is not configured + +components: + schemas: + ConfigDataResponse: + type: object + properties: + resourceConfig: + type: array + items: + $ref: '#/components/schemas/ConfigProperty' + + ConfigProperty: + type: object + properties: + name: + type: string + description: Name of the config + example: cm-1 + nullable: true + configState: + $ref: '#/components/schemas/ConfigStateEnum' + type: + $ref: '#/components/schemas/ResourceTypeEnum' + + ConfigStateEnum: + type: integer + enum: [ 1, 2, 3 ] + description: State of config (1 represents draft state , 2 represents approval pending state,3 represents published state) + + ResourceTypeEnum: + type: string + enum: [ "ConfigMap", "Secret", "Deployment Template" ] + description: Describe the config type (possible values are ConfigMap, Secret, Deployment Template) + diff --git a/wire_gen.go b/wire_gen.go index e0c79db411..17743a508e 100644 --- a/wire_gen.go +++ b/wire_gen.go @@ -133,6 +133,7 @@ import ( "github.com/devtron-labs/devtron/pkg/cluster/repository" "github.com/devtron-labs/devtron/pkg/clusterTerminalAccess" "github.com/devtron-labs/devtron/pkg/commonService" + "github.com/devtron-labs/devtron/pkg/configDiff" delete2 "github.com/devtron-labs/devtron/pkg/delete" "github.com/devtron-labs/devtron/pkg/deployment/common" "github.com/devtron-labs/devtron/pkg/deployment/deployedApp" @@ -929,6 +930,12 @@ func InitializeApp() (*App, error) { if err != nil { return nil, err } + deploymentConfigurationServiceImpl, err := configDiff.NewDeploymentConfigurationServiceImpl(sugaredLogger, configMapServiceImpl) + if err != nil { + return nil, err + } + deploymentConfigurationRestHandlerImpl := restHandler.NewDeploymentConfigurationRestHandlerImpl(sugaredLogger, userServiceImpl, enforcerUtilImpl, deploymentConfigurationServiceImpl) + deploymentConfigurationRouterImpl := router.NewDeploymentConfigurationRouter(deploymentConfigurationRestHandlerImpl) infraConfigRestHandlerImpl := infraConfig2.NewInfraConfigRestHandlerImpl(sugaredLogger, infraConfigServiceImpl, userServiceImpl, enforcerImpl, enforcerUtilImpl, validate) infraConfigRouterImpl := infraConfig2.NewInfraProfileRouterImpl(infraConfigRestHandlerImpl) argoApplicationRestHandlerImpl := argoApplication2.NewArgoApplicationRestHandlerImpl(argoApplicationServiceImpl, sugaredLogger, enforcerImpl) @@ -938,7 +945,7 @@ func InitializeApp() (*App, error) { historyRestHandlerImpl := devtronResource2.NewHistoryRestHandlerImpl(sugaredLogger, enforcerImpl, deploymentHistoryServiceImpl, apiReqDecoderServiceImpl, enforcerUtilImpl) historyRouterImpl := devtronResource2.NewHistoryRouterImpl(historyRestHandlerImpl) devtronResourceRouterImpl := devtronResource2.NewDevtronResourceRouterImpl(historyRouterImpl) - muxRouter := router.NewMuxRouter(sugaredLogger, environmentRouterImpl, clusterRouterImpl, webhookRouterImpl, userAuthRouterImpl, gitProviderRouterImpl, gitHostRouterImpl, dockerRegRouterImpl, notificationRouterImpl, teamRouterImpl, userRouterImpl, chartRefRouterImpl, configMapRouterImpl, appStoreRouterImpl, chartRepositoryRouterImpl, releaseMetricsRouterImpl, deploymentGroupRouterImpl, batchOperationRouterImpl, chartGroupRouterImpl, imageScanRouterImpl, policyRouterImpl, gitOpsConfigRouterImpl, dashboardRouterImpl, attributesRouterImpl, userAttributesRouterImpl, commonRouterImpl, grafanaRouterImpl, ssoLoginRouterImpl, telemetryRouterImpl, telemetryEventClientImplExtended, bulkUpdateRouterImpl, webhookListenerRouterImpl, appRouterImpl, coreAppRouterImpl, helmAppRouterImpl, k8sApplicationRouterImpl, pProfRouterImpl, deploymentConfigRouterImpl, dashboardTelemetryRouterImpl, commonDeploymentRouterImpl, externalLinkRouterImpl, globalPluginRouterImpl, moduleRouterImpl, serverRouterImpl, apiTokenRouterImpl, cdApplicationStatusUpdateHandlerImpl, k8sCapacityRouterImpl, webhookHelmRouterImpl, globalCMCSRouterImpl, userTerminalAccessRouterImpl, jobRouterImpl, ciStatusUpdateCronImpl, resourceGroupingRouterImpl, rbacRoleRouterImpl, scopedVariableRouterImpl, ciTriggerCronImpl, proxyRouterImpl, infraConfigRouterImpl, argoApplicationRouterImpl, devtronResourceRouterImpl) + muxRouter := router.NewMuxRouter(sugaredLogger, environmentRouterImpl, clusterRouterImpl, webhookRouterImpl, userAuthRouterImpl, gitProviderRouterImpl, gitHostRouterImpl, dockerRegRouterImpl, notificationRouterImpl, teamRouterImpl, userRouterImpl, chartRefRouterImpl, configMapRouterImpl, appStoreRouterImpl, chartRepositoryRouterImpl, releaseMetricsRouterImpl, deploymentGroupRouterImpl, batchOperationRouterImpl, chartGroupRouterImpl, imageScanRouterImpl, policyRouterImpl, gitOpsConfigRouterImpl, dashboardRouterImpl, attributesRouterImpl, userAttributesRouterImpl, commonRouterImpl, grafanaRouterImpl, ssoLoginRouterImpl, telemetryRouterImpl, telemetryEventClientImplExtended, bulkUpdateRouterImpl, webhookListenerRouterImpl, appRouterImpl, coreAppRouterImpl, helmAppRouterImpl, k8sApplicationRouterImpl, pProfRouterImpl, deploymentConfigRouterImpl, dashboardTelemetryRouterImpl, commonDeploymentRouterImpl, externalLinkRouterImpl, globalPluginRouterImpl, moduleRouterImpl, serverRouterImpl, apiTokenRouterImpl, cdApplicationStatusUpdateHandlerImpl, k8sCapacityRouterImpl, webhookHelmRouterImpl, globalCMCSRouterImpl, userTerminalAccessRouterImpl, jobRouterImpl, ciStatusUpdateCronImpl, resourceGroupingRouterImpl, rbacRoleRouterImpl, scopedVariableRouterImpl, ciTriggerCronImpl, proxyRouterImpl, deploymentConfigurationRouterImpl, infraConfigRouterImpl, argoApplicationRouterImpl, devtronResourceRouterImpl) loggingMiddlewareImpl := util4.NewLoggingMiddlewareImpl(userServiceImpl) cdWorkflowServiceImpl := cd.NewCdWorkflowServiceImpl(sugaredLogger, cdWorkflowRepositoryImpl) cdWorkflowRunnerServiceImpl := cd.NewCdWorkflowRunnerServiceImpl(sugaredLogger, cdWorkflowRepositoryImpl)