-
Notifications
You must be signed in to change notification settings - Fork 554
feat: Virtual cluster v3 #3764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: Virtual cluster v3 #3764
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 8c1c0b9
feat: added pull support for registry
Ash-exp 7ee6ed7
feat: fetch the updated struct for registry
Ash-exp c1e8a81
fix: fetch registry list
Ash-exp e9e4d8e
fix: fetch registry list
Ash-exp 6a68cc7
Merge branch 'main' into feat-registry-virtual-v3
Ash-exp e4cef9c
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp ecccecd
updated: migration script
Ash-exp d356f91
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp 1330d68
updated: migration comments
Ash-exp 64649c6
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp 3d249ea
added APIs: chart provider list, update enable/disable
Ash-exp 3521364
feat: chart sync support with oci registry
Ash-exp b82b9a6
AppStore repository structure
Ash-exp 7c63a78
feat: updated FindWithFilter api for chart store
Ash-exp e2f0fba
feat: updated FindChartDetailsById api for chart store
Ash-exp da0c165
feat: query error on updateFindWithFilterQuery
Ash-exp 6323b59
feat: Service extraction for EA mode
Ash-exp fc7cf9c
fix: FindWithFilter query
Ash-exp 9ba8401
Merge branch 'fix-oci-container-registry' into feat-chart-provider-apis
Ash-exp ff22b1a
fix: fetching registry OCI config nil
Ash-exp 4ab5387
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp 986d6e3
fix: registry validation added
Ash-exp 5cf1499
feat: chart sync on registry update and toggle chart repo feature
Ash-exp 59e3b87
fix: FindWithFilter query for chart store list
Ash-exp 665b4dc
fixed: join query for FindWithFilter
Ash-exp d50c1c2
fixed: registry validation
Ash-exp b6fd5c8
feat: modified helm apps query
Ash-exp 5d53360
feat: helm apps list query
Ash-exp 2923510
chore: main merge
Ash-exp 2d1e3ed
Merge branch 'feat-registry-virtual-v3' into feat-chart-provider-apis
Ash-exp 2cd3256
oci chart installation changes and api fixes
iamayushm 75e216d
wip
iamayushm f3cae16
fixing sql queries
iamayushm f3a6b0d
update code
iamayushm 138b8eb
Merge branch 'main' into oci-chart-kubelink-installation
iamayushm e59bff3
fixing query
iamayushm 34bac81
chart group api installation
iamayushm 6043bfb
chart group list api
iamayushm 998d0d2
app group installation detail api
iamayushm afe0ec6
bulk chart group fix
iamayushm e72d3bc
adding app store active flag
iamayushm 0ce860b
feat: registry support for virtual cluster v3 (#3702)
Ash-exp f3bd85a
feat: chart provider APIs and registry validation (#3703)
Ash-exp 6a58e0b
feat: wire integration, registry delete validation (#3720)
Ash-exp 845d28b
feat: Refactored docker registry IP config and added integration test…
Ash-exp d97f754
merge oci-kubelink-install
Ash-exp 8e8bfb2
Merge branch 'main' into virtual-cluster-v3
iamayushm 350c1c9
migration script fix
iamayushm faab8b0
updated migration
Ash-exp 7cb104a
fixed: ip config update
Ash-exp 60de514
feat: removed super admin RBAC for chart provider list
Ash-exp 970c5df
feat: removed GCR and GAR validation
Ash-exp b073f32
fix: FindWithFilter query
Ash-exp c8a6e38
fix: FindWithFilter query with delete condition
Ash-exp c75fc63
fix: FindWithFilter query with delete condition
Ash-exp 7992c70
fix: LinkHelmApplicationToChartStore nil pointer handled
Ash-exp 2fb4d6f
fix: ipconfig inject skipped for virtual env
Ash-exp 70ff48f
feat: removed validation for other type registry
Ash-exp 1403376
feat: removed validation for other type registry
Ash-exp 49f65c6
Merge branch 'main' into virtual-cluster-v3
iamayushm 6d72a34
wip: modifying search api
iamayushm 70f119e
panic fix: hibernation
iamayushm 6b6402e
updated unlock condition (#3770)
kartik-579 33fb213
remove use-buildx flag to use k8s buildx driver (#3773)
gireesh-naidu c27d1b2
fix: resource tree panic fix (#3775)
iamayushm 337f567
chore: Addition of K9s image in cluster terminal (#3779)
kamal-devtron f439815
release: PR for v0.6.20 (#3620)
prakarsh-dt 4b0eb40
delete all pre-post cd at one time (#3786)
prakash100198 6e21dc2
perf: hibernate check optimisation (#3788)
kripanshdevtron 4f4515e
doc: HashiCorp external secret operator (#3608)
Shubham9t9 d060bfd
doc: security feature doc (#3622)
Shubham9t9 22c608c
docs: container lifecycle (#3623)
Shubham9t9 3d85047
doc: ci-trigger documentation update (#3629)
Shubham9t9 93f7b8e
doc: mandatory tags feature (#3630)
Shubham9t9 cba9cd1
doc: manual image approval (#3649)
Shubham9t9 8482747
Added purpose of admin login (#3790)
ashoknayak777 bd392e7
chore: Config approval scripts and refactoring (#3762)
kripanshdevtron 8e4d0bd
Merge branch 'main' into virtual-cluster-v3
Ash-exp f272e89
chore: updated migration number
Ash-exp 437299d
Merge branch 'main' into virtual-cluster-v3
iamayushm 7b5c26c
Merge branch 'main' into virtual-cluster-v3
iamayushm 053831f
migration script updated
iamayushm 2090679
Merge branch 'main' into virtual-cluster-v3
iamayushm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.