Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
645d1e4
fix: updated ValidateRegistryStorageType for OCI registry configs
Ash-exp Jul 14, 2023
8c1c0b9
feat: added pull support for registry
Ash-exp Jul 21, 2023
7ee6ed7
feat: fetch the updated struct for registry
Ash-exp Jul 21, 2023
c1e8a81
fix: fetch registry list
Ash-exp Jul 21, 2023
e9e4d8e
fix: fetch registry list
Ash-exp Jul 22, 2023
6a68cc7
Merge branch 'main' into feat-registry-virtual-v3
Ash-exp Jul 23, 2023
e4cef9c
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp Jul 23, 2023
ecccecd
updated: migration script
Ash-exp Jul 23, 2023
d356f91
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp Jul 23, 2023
1330d68
updated: migration comments
Ash-exp Jul 23, 2023
64649c6
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp Jul 23, 2023
3d249ea
added APIs: chart provider list, update enable/disable
Ash-exp Jul 23, 2023
3521364
feat: chart sync support with oci registry
Ash-exp Jul 25, 2023
b82b9a6
AppStore repository structure
Ash-exp Jul 25, 2023
7c63a78
feat: updated FindWithFilter api for chart store
Ash-exp Jul 25, 2023
e2f0fba
feat: updated FindChartDetailsById api for chart store
Ash-exp Jul 26, 2023
da0c165
feat: query error on updateFindWithFilterQuery
Ash-exp Jul 26, 2023
6323b59
feat: Service extraction for EA mode
Ash-exp Jul 26, 2023
fc7cf9c
fix: FindWithFilter query
Ash-exp Jul 27, 2023
9ba8401
Merge branch 'fix-oci-container-registry' into feat-chart-provider-apis
Ash-exp Jul 27, 2023
ff22b1a
fix: fetching registry OCI config nil
Ash-exp Jul 27, 2023
4ab5387
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp Jul 27, 2023
986d6e3
fix: registry validation added
Ash-exp Jul 27, 2023
5cf1499
feat: chart sync on registry update and toggle chart repo feature
Ash-exp Jul 27, 2023
59e3b87
fix: FindWithFilter query for chart store list
Ash-exp Jul 27, 2023
665b4dc
fixed: join query for FindWithFilter
Ash-exp Jul 28, 2023
d50c1c2
fixed: registry validation
Ash-exp Jul 28, 2023
b6fd5c8
feat: modified helm apps query
Ash-exp Jul 28, 2023
5d53360
feat: helm apps list query
Ash-exp Jul 28, 2023
2923510
chore: main merge
Ash-exp Jul 31, 2023
2d1e3ed
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp Jul 31, 2023
2cd3256
oci chart installation changes and api fixes
iamayushm Jul 31, 2023
75e216d
wip
iamayushm Jul 31, 2023
f3cae16
fixing sql queries
iamayushm Jul 31, 2023
f3a6b0d
update code
iamayushm Aug 1, 2023
138b8eb
Merge branch 'main' into oci-chart-kubelink-installation
iamayushm Aug 1, 2023
e59bff3
fixing query
iamayushm Aug 2, 2023
34bac81
chart group api installation
iamayushm Aug 3, 2023
6043bfb
chart group list api
iamayushm Aug 3, 2023
998d0d2
app group installation detail api
iamayushm Aug 3, 2023
afe0ec6
bulk chart group fix
iamayushm Aug 3, 2023
e72d3bc
adding app store active flag
iamayushm Aug 8, 2023
0ce860b
feat: registry support for virtual cluster v3 (#3702)
Ash-exp Aug 9, 2023
f3bd85a
feat: chart provider APIs and registry validation (#3703)
Ash-exp Aug 9, 2023
6a58e0b
feat: wire integration, registry delete validation (#3720)
Ash-exp Aug 9, 2023
845d28b
feat: Refactored docker registry IP config and added integration test…
Ash-exp Aug 9, 2023
d97f754
merge oci-kubelink-install
Ash-exp Aug 9, 2023
8e8bfb2
Merge branch 'main' into virtual-cluster-v3
iamayushm Aug 9, 2023
350c1c9
migration script fix
iamayushm Aug 9, 2023
faab8b0
updated migration
Ash-exp Aug 9, 2023
7cb104a
fixed: ip config update
Ash-exp Aug 9, 2023
60de514
feat: removed super admin RBAC for chart provider list
Ash-exp Aug 10, 2023
970c5df
feat: removed GCR and GAR validation
Ash-exp Aug 11, 2023
b073f32
fix: FindWithFilter query
Ash-exp Aug 11, 2023
c8a6e38
fix: FindWithFilter query with delete condition
Ash-exp Aug 11, 2023
c75fc63
fix: FindWithFilter query with delete condition
Ash-exp Aug 13, 2023
7992c70
fix: LinkHelmApplicationToChartStore nil pointer handled
Ash-exp Aug 14, 2023
2fb4d6f
fix: ipconfig inject skipped for virtual env
Ash-exp Aug 14, 2023
70ff48f
feat: removed validation for other type registry
Ash-exp Aug 14, 2023
1403376
feat: removed validation for other type registry
Ash-exp Aug 14, 2023
49f65c6
Merge branch 'main' into virtual-cluster-v3
iamayushm Aug 16, 2023
6d72a34
wip: modifying search api
iamayushm Aug 16, 2023
70f119e
panic fix: hibernation
iamayushm Aug 16, 2023
6b6402e
updated unlock condition (#3770)
kartik-579 Aug 16, 2023
33fb213
remove use-buildx flag to use k8s buildx driver (#3773)
gireesh-naidu Aug 16, 2023
c27d1b2
fix: resource tree panic fix (#3775)
iamayushm Aug 17, 2023
337f567
chore: Addition of K9s image in cluster terminal (#3779)
kamal-devtron Aug 17, 2023
f439815
release: PR for v0.6.20 (#3620)
prakarsh-dt Aug 17, 2023
4b0eb40
delete all pre-post cd at one time (#3786)
prakash100198 Aug 17, 2023
6e21dc2
perf: hibernate check optimisation (#3788)
kripanshdevtron Aug 17, 2023
4f4515e
doc: HashiCorp external secret operator (#3608)
Shubham9t9 Aug 17, 2023
d060bfd
doc: security feature doc (#3622)
Shubham9t9 Aug 17, 2023
22c608c
docs: container lifecycle (#3623)
Shubham9t9 Aug 17, 2023
3d85047
doc: ci-trigger documentation update (#3629)
Shubham9t9 Aug 17, 2023
93f7b8e
doc: mandatory tags feature (#3630)
Shubham9t9 Aug 17, 2023
cba9cd1
doc: manual image approval (#3649)
Shubham9t9 Aug 18, 2023
8482747
Added purpose of admin login (#3790)
ashoknayak777 Aug 18, 2023
bd392e7
chore: Config approval scripts and refactoring (#3762)
kripanshdevtron Aug 20, 2023
8e4d0bd
Merge branch 'main' into virtual-cluster-v3
Ash-exp Aug 21, 2023
f272e89
chore: updated migration number
Ash-exp Aug 21, 2023
437299d
Merge branch 'main' into virtual-cluster-v3
iamayushm Aug 29, 2023
7b5c26c
Merge branch 'main' into virtual-cluster-v3
iamayushm Sep 1, 2023
053831f
migration script updated
iamayushm Sep 1, 2023
2090679
Merge branch 'main' into virtual-cluster-v3
iamayushm Sep 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
pubsub1 "github.com/devtron-labs/common-lib/pubsub-lib"
"github.com/devtron-labs/devtron/api/apiToken"
appStoreRestHandler "github.com/devtron-labs/devtron/api/appStore"
chartProvider "github.com/devtron-labs/devtron/api/appStore/chartProvider"
appStoreDeployment "github.com/devtron-labs/devtron/api/appStore/deployment"
appStoreDiscover "github.com/devtron-labs/devtron/api/appStore/discover"
appStoreValues "github.com/devtron-labs/devtron/api/appStore/values"
Expand Down Expand Up @@ -137,6 +138,7 @@ func InitializeApp() (*App, error) {
k8s.K8sApplicationWireSet,
chartRepo.ChartRepositoryWireSet,
appStoreDiscover.AppStoreDiscoverWireSet,
chartProvider.AppStoreChartProviderWireSet,
appStoreValues.AppStoreValuesWireSet,
appStoreDeployment.AppStoreDeploymentWireSet,
server.ServerWireSet,
Expand Down Expand Up @@ -224,21 +226,10 @@ func InitializeApp() (*App, error) {
wire.Bind(new(pipeline.CiCdPipelineOrchestrator), new(*pipeline.CiCdPipelineOrchestratorImpl)),
pipelineConfig.NewMaterialRepositoryImpl,
wire.Bind(new(pipelineConfig.MaterialRepository), new(*pipelineConfig.MaterialRepositoryImpl)),

router.NewMigrateDbRouterImpl,
wire.Bind(new(router.MigrateDbRouter), new(*router.MigrateDbRouterImpl)),
restHandler.NewMigrateDbRestHandlerImpl,
wire.Bind(new(restHandler.MigrateDbRestHandler), new(*restHandler.MigrateDbRestHandlerImpl)),
pipeline.NewDockerRegistryConfigImpl,
wire.Bind(new(pipeline.DockerRegistryConfig), new(*pipeline.DockerRegistryConfigImpl)),
dockerRegistry.NewDockerRegistryIpsConfigServiceImpl,
wire.Bind(new(dockerRegistry.DockerRegistryIpsConfigService), new(*dockerRegistry.DockerRegistryIpsConfigServiceImpl)),
dockerRegistryRepository.NewDockerArtifactStoreRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.DockerArtifactStoreRepository), new(*dockerRegistryRepository.DockerArtifactStoreRepositoryImpl)),
dockerRegistryRepository.NewDockerRegistryIpsConfigRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.DockerRegistryIpsConfigRepository), new(*dockerRegistryRepository.DockerRegistryIpsConfigRepositoryImpl)),
dockerRegistryRepository.NewOCIRegistryConfigRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.OCIRegistryConfigRepository), new(*dockerRegistryRepository.OCIRegistryConfigRepositoryImpl)),
util.NewChartTemplateServiceImpl,
wire.Bind(new(util.ChartTemplateService), new(*util.ChartTemplateServiceImpl)),
util.NewChartDeploymentServiceImpl,
Expand Down Expand Up @@ -370,10 +361,6 @@ func InitializeApp() (*App, error) {
wire.Bind(new(router.GitProviderRouter), new(*router.GitProviderRouterImpl)),
restHandler.NewGitProviderRestHandlerImpl,
wire.Bind(new(restHandler.GitProviderRestHandler), new(*restHandler.GitProviderRestHandlerImpl)),
router.NewDockerRegRouterImpl,
wire.Bind(new(router.DockerRegRouter), new(*router.DockerRegRouterImpl)),
restHandler.NewDockerRegRestHandlerImpl,
wire.Bind(new(restHandler.DockerRegRestHandler), new(*restHandler.DockerRegRestHandlerImpl)),

router.NewNotificationRouterImpl,
wire.Bind(new(router.NotificationRouter), new(*router.NotificationRouterImpl)),
Expand Down Expand Up @@ -865,6 +852,23 @@ func InitializeApp() (*App, error) {
wire.Bind(new(repository5.ManifestPushConfigRepository), new(*repository5.ManifestPushConfigRepositoryImpl)),
app.NewGitOpsManifestPushServiceImpl,
wire.Bind(new(app.GitOpsPushService), new(*app.GitOpsManifestPushServiceImpl)),

// start: docker registry wire set injection
router.NewDockerRegRouterImpl,
wire.Bind(new(router.DockerRegRouter), new(*router.DockerRegRouterImpl)),
restHandler.NewDockerRegRestHandlerExtendedImpl,
wire.Bind(new(restHandler.DockerRegRestHandler), new(*restHandler.DockerRegRestHandlerExtendedImpl)),
pipeline.NewDockerRegistryConfigImpl,
wire.Bind(new(pipeline.DockerRegistryConfig), new(*pipeline.DockerRegistryConfigImpl)),
dockerRegistry.NewDockerRegistryIpsConfigServiceImpl,
wire.Bind(new(dockerRegistry.DockerRegistryIpsConfigService), new(*dockerRegistry.DockerRegistryIpsConfigServiceImpl)),
dockerRegistryRepository.NewDockerArtifactStoreRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.DockerArtifactStoreRepository), new(*dockerRegistryRepository.DockerArtifactStoreRepositoryImpl)),
dockerRegistryRepository.NewDockerRegistryIpsConfigRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.DockerRegistryIpsConfigRepository), new(*dockerRegistryRepository.DockerRegistryIpsConfigRepositoryImpl)),
dockerRegistryRepository.NewOCIRegistryConfigRepositoryImpl,
wire.Bind(new(dockerRegistryRepository.OCIRegistryConfigRepository), new(*dockerRegistryRepository.OCIRegistryConfigRepositoryImpl)),
// end: docker registry wire set injection
)
return &App{}, nil
}
12 changes: 11 additions & 1 deletion api/appStore/AppStoreRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package appStore

import (
chartProvider "github.com/devtron-labs/devtron/api/appStore/chartProvider"
appStoreDeployment "github.com/devtron-labs/devtron/api/appStore/deployment"
appStoreDiscover "github.com/devtron-labs/devtron/api/appStore/discover"
appStoreValues "github.com/devtron-labs/devtron/api/appStore/values"
Expand All @@ -33,17 +34,21 @@ type AppStoreRouterImpl struct {
appStoreValuesRouter appStoreValues.AppStoreValuesRouter
appStoreDiscoverRouter appStoreDiscover.AppStoreDiscoverRouter
appStoreDeploymentRouter appStoreDeployment.AppStoreDeploymentRouter
chartProviderRouter chartProvider.ChartProviderRouter
appStoreStatusTimelineRestHandler AppStoreStatusTimelineRestHandler
}

func NewAppStoreRouterImpl(restHandler InstalledAppRestHandler,
appStoreValuesRouter appStoreValues.AppStoreValuesRouter, appStoreDiscoverRouter appStoreDiscover.AppStoreDiscoverRouter,
appStoreValuesRouter appStoreValues.AppStoreValuesRouter,
appStoreDiscoverRouter appStoreDiscover.AppStoreDiscoverRouter,
chartProviderRouter chartProvider.ChartProviderRouter,
appStoreDeploymentRouter appStoreDeployment.AppStoreDeploymentRouter,
appStoreStatusTimelineRestHandler AppStoreStatusTimelineRestHandler) *AppStoreRouterImpl {
return &AppStoreRouterImpl{
deployRestHandler: restHandler,
appStoreValuesRouter: appStoreValuesRouter,
appStoreDiscoverRouter: appStoreDiscoverRouter,
chartProviderRouter: chartProviderRouter,
appStoreDeploymentRouter: appStoreDeploymentRouter,
appStoreStatusTimelineRestHandler: appStoreStatusTimelineRestHandler,
}
Expand All @@ -69,6 +74,11 @@ func (router AppStoreRouterImpl) Init(configRouter *mux.Router) {
router.appStoreDiscoverRouter.Init(appStoreDiscoverSubRouter)
// discover router ends

// chart provider router starts
chartProviderSubRouter := configRouter.PathPrefix("/chart-provider").Subrouter()
router.chartProviderRouter.Init(chartProviderSubRouter)
// chart provider router ends

configRouter.Path("/application/exists").
HandlerFunc(router.deployRestHandler.CheckAppExists).Methods("POST")
configRouter.Path("/group/install").
Expand Down
173 changes: 173 additions & 0 deletions api/appStore/chartProvider/ChartProviderRestHandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
/*
* Copyright (c) 2020 Devtron Labs
*
* 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 chartProvider

import (
"encoding/json"
"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/pkg/appStore/chartProvider"
"github.com/devtron-labs/devtron/pkg/user"
"github.com/devtron-labs/devtron/pkg/user/casbin"
"go.uber.org/zap"
"gopkg.in/go-playground/validator.v9"
"net/http"
"strconv"
)

type ChartProviderRestHandler interface {
GetChartProviderList(w http.ResponseWriter, r *http.Request)
ToggleChartProvider(w http.ResponseWriter, r *http.Request)
SyncChartProvider(w http.ResponseWriter, r *http.Request)
}

type ChartProviderRestHandlerImpl struct {
Logger *zap.SugaredLogger
chartProviderService chartProvider.ChartProviderService
validator *validator.Validate
userAuthService user.UserService
enforcer casbin.Enforcer
}

func NewChartProviderRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService, validator *validator.Validate, chartProviderService chartProvider.ChartProviderService,
enforcer casbin.Enforcer) *ChartProviderRestHandlerImpl {
return &ChartProviderRestHandlerImpl{
Logger: Logger,
validator: validator,
chartProviderService: chartProviderService,
userAuthService: userAuthService,
enforcer: enforcer,
}
}

func (handler *ChartProviderRestHandlerImpl) GetChartProviderList(w http.ResponseWriter, r *http.Request) {
userId, err := handler.userAuthService.GetLoggedInUser(r)
if userId == 0 || err != nil {
common.WriteJsonResp(w, err, nil, http.StatusUnauthorized)
return
}
handler.Logger.Infow("request payload, GetChartProviderList", "userId", userId)

res, err := handler.chartProviderService.GetChartProviderList()
if err != nil {
handler.Logger.Errorw("service err, GetChartProviderList", "err", err, "userId", userId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, err, res, http.StatusOK)
}

func (handler *ChartProviderRestHandlerImpl) ToggleChartProvider(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
userId, err := handler.userAuthService.GetLoggedInUser(r)
if userId == 0 || err != nil {
common.WriteJsonResp(w, err, nil, http.StatusUnauthorized)
return
}
var request chartProvider.ChartProviderRequestDto
err = decoder.Decode(&request)
if err != nil {
handler.Logger.Errorw("request err, ToggleChartProvider", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
err = handler.validator.Struct(request)
if err != nil {
handler.Logger.Errorw("validation err, ToggleChartProvider", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
handler.Logger.Infow("request payload, ToggleChartProvider", "payload", request, "userId", userId)
token := r.Header.Get("token")
//RBAC starts
if ok := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); !ok {
handler.Logger.Infow("user forbidden to toggle chart provider", "userId", userId)
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusForbidden)
return
}
//RBAC ends
request.UserId = userId
err = ValidateRequestObjectForChartRepoId(&request)
if err != nil {
handler.Logger.Errorw("request err, ToggleChartProvider", "err", err, "ChartRepoId", request.Id)
common.WriteJsonResp(w, err, "Invalid ChartRepoId", http.StatusBadRequest)
return
}
err = handler.chartProviderService.ToggleChartProvider(&request)
if err != nil {
handler.Logger.Errorw("service err, ToggleChartProvider", "err", err, "userId", userId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, err, nil, http.StatusOK)
}

func (handler *ChartProviderRestHandlerImpl) SyncChartProvider(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
userId, err := handler.userAuthService.GetLoggedInUser(r)
if userId == 0 || err != nil {
common.WriteJsonResp(w, err, nil, http.StatusUnauthorized)
return
}
var request chartProvider.ChartProviderRequestDto
err = decoder.Decode(&request)
if err != nil {
handler.Logger.Errorw("request err, SyncChartProvider", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
err = handler.validator.Struct(request)
if err != nil {
handler.Logger.Errorw("validation err, SyncChartProvider", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
handler.Logger.Infow("request payload, SyncChartProvider", "payload", request, "userId", userId)
token := r.Header.Get("token")
//RBAC starts
if ok := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); !ok {
handler.Logger.Infow("user forbidden to sync chart provider", "userId", userId)
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusForbidden)
return
}
//RBAC ends
request.UserId = userId
err = ValidateRequestObjectForChartRepoId(&request)
if err != nil {
handler.Logger.Errorw("request err, ToggleChartProvider", "err", err, "ChartRepoId", request.Id)
common.WriteJsonResp(w, err, "Invalid ChartRepoId", http.StatusBadRequest)
return
}
err = handler.chartProviderService.SyncChartProvider(&request)
if err != nil {
handler.Logger.Errorw("service err, SyncChartProvider", "err", err, "userId", userId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, err, nil, http.StatusOK)
}

func ValidateRequestObjectForChartRepoId(request *chartProvider.ChartProviderRequestDto) error {
if !request.IsOCIRegistry {
chartRepoId, err := strconv.Atoi(request.Id)
if err != nil || chartRepoId <= 0 {
return err
}
request.ChartRepoId = chartRepoId
}
return nil
}
45 changes: 45 additions & 0 deletions api/appStore/chartProvider/ChartProviderRouter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2020 Devtron Labs
*
* 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 chartProvider

import (
"github.com/gorilla/mux"
)

type ChartProviderRouter interface {
Init(configRouter *mux.Router)
}

type ChartProviderRouterImpl struct {
chartProviderRestHandler ChartProviderRestHandler
}

func NewChartProviderRouterImpl(chartProviderRestHandler ChartProviderRestHandler) *ChartProviderRouterImpl {
return &ChartProviderRouterImpl{
chartProviderRestHandler: chartProviderRestHandler,
}
}

func (router ChartProviderRouterImpl) Init(configRouter *mux.Router) {
configRouter.Path("/list").
HandlerFunc(router.chartProviderRestHandler.GetChartProviderList).Methods("GET")
configRouter.Path("/update").
HandlerFunc(router.chartProviderRestHandler.ToggleChartProvider).Methods("POST")
configRouter.Path("/sync-chart").
HandlerFunc(router.chartProviderRestHandler.SyncChartProvider).Methods("POST")
}
14 changes: 14 additions & 0 deletions api/appStore/chartProvider/wire_appStoreChartProvider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package chartProvider

import (
chartProviderService "github.com/devtron-labs/devtron/pkg/appStore/chartProvider"
"github.com/google/wire"
)

var AppStoreChartProviderWireSet = wire.NewSet(
chartProviderService.NewChartProviderServiceImpl,
wire.Bind(new(chartProviderService.ChartProviderService), new(*chartProviderService.ChartProviderServiceImpl)),
NewChartProviderRestHandlerImpl,
wire.Bind(new(ChartProviderRestHandler), new(*ChartProviderRestHandlerImpl)),
NewChartProviderRouterImpl,
wire.Bind(new(ChartProviderRouter), new(*ChartProviderRouterImpl)))
16 changes: 15 additions & 1 deletion api/appStore/discover/AppStoreRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ func (handler *AppStoreRestHandlerImpl) FindAllApps(w http.ResponseWriter, r *ht
}
}
}
var registryIds []string
registryIdsStrArr := v.Get("registryId")
if len(registryIdsStrArr) > 0 {
registryIdStrArr := strings.Split(registryIdsStrArr, ",")
for _, registryId := range registryIdStrArr {
registryIds = append(registryIds, registryId)
}
}

appStoreName := strings.ToLower(v.Get("appStoreName"))

offset := 0
Expand All @@ -95,7 +104,12 @@ func (handler *AppStoreRestHandlerImpl) FindAllApps(w http.ResponseWriter, r *ht
if len(sizeStr) > 0 {
size, _ = strconv.Atoi(sizeStr)
}
filter := &appStoreBean.AppStoreFilter{IncludeDeprecated: deprecated, ChartRepoId: chartRepoIds, AppStoreName: appStoreName}
filter := &appStoreBean.AppStoreFilter{
IncludeDeprecated: deprecated,
ChartRepoId: chartRepoIds,
RegistryId: registryIds,
AppStoreName: appStoreName,
}
if size > 0 {
filter.Size = size
filter.Offset = offset
Expand Down
6 changes: 5 additions & 1 deletion api/chartRepo/ChartRepositoryRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ func (handler *ChartRepositoryRestHandlerImpl) TriggerChartSyncManual(w http.Res
common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden)
return
}
err2 := handler.chartRepositoryService.TriggerChartSyncManual()
chartProviderConfig := &chartRepo.ChartProviderConfig{
ChartProviderId: "*",
IsOCIRegistry: true,
}
err2 := handler.chartRepositoryService.TriggerChartSyncManual(chartProviderConfig)
if err2 != nil {
common.WriteJsonResp(w, err2, nil, http.StatusInternalServerError)
} else {
Expand Down
Loading