Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
ffbee8d
added config sql script (#5681)
ayu-devtron Aug 13, 2024
cbace84
Merge branch 'main' into develop
vikramdevtron Aug 13, 2024
92aeea3
Merge branch 'main' into develop
vikramdevtron Aug 14, 2024
3967bbc
feat: CVE severity categorisation and scan result listing API enhance…
gireesh-naidu Aug 21, 2024
5661d5c
feat: casbin deny policy sql scripts (#5677)
Shivam-nagar23 Aug 21, 2024
af3133d
feat: Config diff phase 2 oss (#5488)
prakash100198 Aug 21, 2024
f1aa1fc
fix: Helm apps entries in Ea mode (#5652)
RajeevRanjan27 Aug 21, 2024
6820ffe
feat: refactoring deployment app name usage (#5702)
iamayushm Aug 23, 2024
095d81c
migration syn with ent (#5719)
prkhrkat Aug 23, 2024
ea4974b
fix: group image vulnerabilities by base/os image (#5680)
gireesh-naidu Aug 23, 2024
7f5db23
fix: remove sql script (#5727)
gireesh-naidu Aug 23, 2024
17747c2
Revert "fix: Helm apps entries in Ea mode (#5652)" (#5733)
RajeevRanjan27 Aug 23, 2024
6738628
chore: custom argo-workflow dependency (#5731)
Ash-exp Aug 23, 2024
7048c68
chore: fix go.sum file (#5734)
Ash-exp Aug 23, 2024
0c56885
misc: Main sync develop (#5737)
vikramdevtron Aug 23, 2024
ed70d3e
chore: sql scripts sync (#5763)
gireesh-naidu Aug 29, 2024
29d96a8
fix: Scan tool migration fix develop (#5773)
kripanshdevtron Aug 30, 2024
af5f36d
chore: Oss sync 2 sept 2024 oss (#5779)
prakash100198 Sep 2, 2024
dc67204
chore: plugin creation oss (#5780)
prakash100198 Sep 2, 2024
1f66fdd
fix: Sql injection fix develop (#5785)
kripanshdevtron Sep 2, 2024
63197e9
feat: add support for tag name for external CI (#5689)
ayu-devtron Sep 3, 2024
214bd62
argo-assets moved out (#5788)
prkhrkat Sep 3, 2024
813c3d7
query param split (#5801) (#5803)
Shivam-nagar23 Sep 4, 2024
d4e599e
feat: acr polling plugin support (#5724)
Ash-exp Sep 5, 2024
c022e5f
fix: build failed due to argo assets (#5805)
Ash-exp Sep 5, 2024
c0dc007
handled the release not found case for app detail of external app (#5…
RajeevRanjan27 Sep 9, 2024
61bf950
chore: Main develop sync bd5118 (#5817)
kartik-579 Sep 9, 2024
d38a408
feat: Argo listing change (#5768)
kartik-579 Sep 9, 2024
5727221
feat: Feature release v7 sql scripts (#5757)
Shivam-nagar23 Sep 9, 2024
3ad88d5
fix: sync with common-lib changes (#5820)
systemsdt Sep 9, 2024
f121111
feat: Custom tag for copy container image plugin (#5760)
iamayushm Sep 10, 2024
413e216
adding pco id in app details query (#5826)
iamayushm Sep 10, 2024
4b70ff4
fix: reverse proxy panic noises (#5833)
Ash-exp Sep 12, 2024
16f2443
feat: release v8 (Release Creation RBAC Scripts) (#5821)
Shivam-nagar23 Sep 12, 2024
b7b1de9
get with deduplicate (#5838)
prkhrkat Sep 13, 2024
3cf1c86
chore: Main sync 13 sept 2024 (#5843)
prakash100198 Sep 13, 2024
afd7845
chore: inject ci-runner pod UID and name as env variable (#5839)
gireesh-naidu Sep 16, 2024
12686c7
feat: add cluster filter in notification setting (#5828)
gireesh-naidu Sep 17, 2024
1265542
fix: ignore kubelink errors in server startup (#5852)
gireesh-naidu Sep 17, 2024
3fa1069
chore: Main sync (#5862)
kartik-579 Sep 18, 2024
85710ec
feat: added deployment failed message in deployment history (#5845)
Ash-exp Sep 18, 2024
6d10fff
wip (#5865)
iamayushm Sep 19, 2024
de0c426
script numebr change (#5878)
Shivam-nagar23 Sep 23, 2024
246c8cf
chore: Dependabot fixes 17sept (#5853)
prakash100198 Sep 23, 2024
9746089
feat: ns label refactoring (#5882)
iamayushm Sep 23, 2024
d02ffa8
feat: added the host url in the pre post ci cd steps (#5864)
RajeevRanjan27 Sep 23, 2024
fce48ae
fix: Image broken in default slack notification template (#5829)
SATYAsasini Sep 24, 2024
23b63fa
fix: create gitops configuration issue (#5883) (#5891)
Ash-exp Sep 24, 2024
9ff059f
image in imagescanresp in executionDetail api (#5894)
prakash100198 Sep 24, 2024
508a70b
chore: OSS main branch sync
Ash-exp Sep 24, 2024
02269f1
Merge remote-tracking branch 'origin/main' into oss-main-sync-24-sep
Ash-exp Sep 24, 2024
9eabc12
Merge pull request #5895 from devtron-labs/oss-main-sync-24-sep
Ash-exp Sep 24, 2024
3060edb
fix: empty webhook payload fix for PR based CI pipeline (#5879)
gireesh-naidu Sep 24, 2024
c54fc03
feat: Added support for templates in external secrets (#5874)
Ash-exp Sep 27, 2024
0282dee
fix: Code security fixes (sql injection, sensitive data logs) (#5787)
kartik-579 Sep 30, 2024
3419695
fix: namespace cache delete actions (#5887)
iamayushm Sep 30, 2024
c1e2897
fix: stage artifact logic (#5913)
Ash-exp Oct 3, 2024
0c28dfc
misc: updated migration number
Ash-exp Oct 3, 2024
f6092df
Merge pull request #5948 from devtron-labs/fix-migration-no
Ash-exp Oct 3, 2024
fcfa897
fix: Bulk deploy panic and docker tag handling (#5949)
iamayushm Oct 3, 2024
00918bb
sql scripts (#5950)
Shivam-nagar23 Oct 3, 2024
6d97706
feat: refactoring argo application service and common-lib constants (…
ayu-devtron Oct 7, 2024
6dc494f
Merge branch 'main' into develop-oss
gireesh-naidu Oct 7, 2024
f90cd3c
Merge pull request #5961 from devtron-labs/develop-main-sync-oss
vikramdevtron Oct 7, 2024
be714e1
migration seq fix
vikramdevtron Oct 7, 2024
652d2b8
Merge pull request #5962 from devtron-labs/migration-seq-fix
vikramdevtron Oct 7, 2024
6f92668
migration seq fix
vikramdevtron Oct 7, 2024
fda3116
Merge pull request #5963 from devtron-labs/migration-seq-fix
vikramdevtron Oct 7, 2024
5b2f3ad
initialise acd client (#5964)
ayu-devtron Oct 8, 2024
3ff7fdb
auth group fix (#5966)
Shivam-nagar23 Oct 8, 2024
a670d70
query params append fix (#5967)
Shivam-nagar23 Oct 8, 2024
4953506
bluk edit cm and secret fix (#5968)
prakash100198 Oct 8, 2024
ecc458f
removed the field cia (#5969)
RajeevRanjan27 Oct 8, 2024
b5382eb
query fix (#5971)
Shivam-nagar23 Oct 8, 2024
69275a2
rollback fix (#5972)
Shivam-nagar23 Oct 8, 2024
537cb96
fix: copy container image version
Ash-exp Oct 9, 2024
98d0c18
Merge pull request #5974 from devtron-labs/fix-release-candidate-v0.20.1
Ash-exp Oct 9, 2024
e4b6b63
fix: cluster and env prod/non prod not propagated in notification eve…
gireesh-naidu Oct 9, 2024
6424584
Merge pull request #5977 from devtron-labs/notification-cluster-filte…
gireesh-naidu Oct 10, 2024
4a336e0
common-lib update
vikramdevtron Oct 14, 2024
a846895
Merge pull request #5981 from devtron-labs/common-lib-update-on-rc20
vikramdevtron Oct 14, 2024
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
2 changes: 1 addition & 1 deletion Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func InitializeApp() (*App, error) {
terminal.TerminalWireSet,
build.BuildWireSet,
deployment2.DeploymentWireSet,
argoApplication.ArgoApplicationWireSet,
argoApplication.ArgoApplicationWireSetFull,
fluxApplication.FluxApplicationWireSet,
eventProcessor.EventProcessorWireSet,
workflow3.WorkflowWireSet,
Expand Down
3 changes: 0 additions & 3 deletions api/appStore/AppStoreRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ func (router AppStoreRouterImpl) Init(configRouter *mux.Router) {
HandlerFunc(router.deployRestHandler.CheckAppExists).Methods("POST")
configRouter.Path("/group/install").
HandlerFunc(router.deployRestHandler.DeployBulk).Methods("POST")
configRouter.Path("/installed-app/detail").Queries("installed-app-id", "{installed-app-id}").Queries("env-id", "{env-id}").
HandlerFunc(router.deployRestHandler.FetchAppDetailsForInstalledApp).
Methods("GET")
configRouter.Path("/installed-app/delete/{installedAppId}/non-cascade").
HandlerFunc(router.deployRestHandler.DeleteArgoInstalledAppWithNonCascade).
Methods("DELETE")
Expand Down
99 changes: 4 additions & 95 deletions api/appStore/InstalledAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
"github.com/devtron-labs/devtron/pkg/auth/user"
"github.com/devtron-labs/devtron/pkg/cluster"
bean3 "github.com/devtron-labs/devtron/pkg/deployment/common/bean"
"github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
"github.com/devtron-labs/devtron/util/rbac"
Expand All @@ -65,7 +64,6 @@ type InstalledAppRestHandler interface {
DeployBulk(w http.ResponseWriter, r *http.Request)
CheckAppExists(w http.ResponseWriter, r *http.Request)
DefaultComponentInstallation(w http.ResponseWriter, r *http.Request)
FetchAppDetailsForInstalledApp(w http.ResponseWriter, r *http.Request)
DeleteArgoInstalledAppWithNonCascade(w http.ResponseWriter, r *http.Request)
FetchAppDetailsForInstalledAppV2(w http.ResponseWriter, r *http.Request)
FetchResourceTree(w http.ResponseWriter, r *http.Request)
Expand Down Expand Up @@ -692,90 +690,6 @@ func (handler *InstalledAppRestHandlerImpl) checkNotesAuth(token string, appName
return ok
}

func (handler *InstalledAppRestHandlerImpl) FetchAppDetailsForInstalledApp(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
}

vars := mux.Vars(r)
installedAppId, err := strconv.Atoi(vars["installed-app-id"])
if err != nil {
handler.Logger.Errorw("request err, FetchAppDetailsForInstalledApp", "err", err, "installedAppId", installedAppId)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
token := r.Header.Get("token")
envId, err := strconv.Atoi(vars["env-id"])
if err != nil {
handler.Logger.Errorw("request err, FetchAppDetailsForInstalledApp", "err", err, "installedAppId", installedAppId, "envId", envId)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
handler.Logger.Infow("request payload, FetchAppDetailsForInstalledApp, app store", "installedAppId", installedAppId, "envId", envId)

installedApp, err := handler.installedAppService.GetInstalledAppById(installedAppId)
if err == pg.ErrNoRows {
common.WriteJsonResp(w, err, "App not found in database", http.StatusBadRequest)
return
}
if util3.IsExternalChartStoreApp(installedApp.App.DisplayName) {
//this is external app case where app_name is a unique identifier, and we want to fetch resource based on display_name
handler.installedAppService.ChangeAppNameToDisplayNameForInstalledApp(installedApp)
}

appDetail, err := handler.installedAppService.FindAppDetailsForAppstoreApplication(installedAppId, envId)
if err != nil {
handler.Logger.Errorw("service err, FetchAppDetailsForInstalledApp, app store", "err", err, "installedAppId", installedAppId, "envId", envId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}

//rbac block starts from here
object, object2 := handler.enforcerUtil.GetHelmObjectByAppNameAndEnvId(appDetail.AppName, appDetail.EnvironmentId)

var ok bool

if object2 == "" {
ok = handler.enforcer.Enforce(token, casbin.ResourceHelmApp, casbin.ActionGet, object)
} else {
ok = handler.enforcer.Enforce(token, casbin.ResourceHelmApp, casbin.ActionGet, object) || handler.enforcer.Enforce(token, casbin.ResourceHelmApp, casbin.ActionGet, object2)
}

if !ok {
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), nil, http.StatusForbidden)
return
}
//rback block ends here
resourceTreeAndNotesContainer := bean2.AppDetailsContainer{}
resourceTreeAndNotesContainer.ResourceTree = map[string]interface{}{}

if len(installedApp.App.AppName) > 0 && len(installedApp.Environment.Name) > 0 {
err = handler.fetchResourceTree(w, r, &resourceTreeAndNotesContainer, *installedApp, appDetail.DeploymentConfig, "", "")
if appDetail.DeploymentAppType == util2.PIPELINE_DEPLOYMENT_TYPE_ACD {
apiError, ok := err.(*util2.ApiError)
if ok && apiError != nil {
if apiError.Code == constants.AppDetailResourceTreeNotFound && installedApp.DeploymentAppDeleteRequest == true {
// TODO refactoring: should be performed through nats
err = handler.appStoreDeploymentService.MarkGitOpsInstalledAppsDeletedIfArgoAppIsDeleted(installedAppId, envId)
appDeleteErr, appDeleteErrOk := err.(*util2.ApiError)
if appDeleteErrOk && appDeleteErr != nil {
handler.Logger.Errorw(appDeleteErr.InternalMessage)
return
}
}
}
} else if err != nil {
common.WriteJsonResp(w, fmt.Errorf("error in fetching resource tree"), nil, http.StatusInternalServerError)
return
}
}
appDetail.ResourceTree = resourceTreeAndNotesContainer.ResourceTree
appDetail.Notes = resourceTreeAndNotesContainer.Notes
common.WriteJsonResp(w, nil, appDetail, http.StatusOK)
}

func (handler *InstalledAppRestHandlerImpl) FetchAppDetailsForInstalledAppV2(w http.ResponseWriter, r *http.Request) {
userId, err := handler.userAuthService.GetLoggedInUser(r)
if userId == 0 || err != nil {
Expand Down Expand Up @@ -820,6 +734,8 @@ func (handler *InstalledAppRestHandlerImpl) FetchAppDetailsForInstalledAppV2(w h
}

func (handler *InstalledAppRestHandlerImpl) FetchResourceTree(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("token")
ctx := context.WithValue(r.Context(), "token", token)
userId, err := handler.userAuthService.GetLoggedInUser(r)
if userId == 0 || err != nil {
common.WriteJsonResp(w, err, nil, http.StatusUnauthorized)
Expand Down Expand Up @@ -853,7 +769,6 @@ func (handler *InstalledAppRestHandlerImpl) FetchResourceTree(w http.ResponseWri
common.WriteJsonResp(w, nil, nil, http.StatusOK)
return
}
token := r.Header.Get("token")
object, object2 := handler.enforcerUtil.GetHelmObjectByAppNameAndEnvId(installedApp.App.AppName, installedApp.EnvironmentId)
var ok bool
if object2 == "" {
Expand All @@ -876,7 +791,8 @@ func (handler *InstalledAppRestHandlerImpl) FetchResourceTree(w http.ResponseWri
resourceTreeAndNotesContainer.ResourceTree = map[string]interface{}{}

if len(installedApp.App.AppName) > 0 && len(installedApp.Environment.Name) > 0 {
err = handler.fetchResourceTree(w, r, &resourceTreeAndNotesContainer, *installedApp, appDetail.DeploymentConfig, appDetail.HelmReleaseInstallStatus, appDetail.Status)
cn, _ := w.(http.CloseNotifier)
err = handler.installedAppResourceService.FetchResourceTree(ctx, cn, &resourceTreeAndNotesContainer, *installedApp, appDetail.DeploymentConfig, appDetail.HelmReleaseInstallStatus, appDetail.Status)
if appDetail.DeploymentAppType == util2.PIPELINE_DEPLOYMENT_TYPE_ACD {
//resource tree has been fetched now prepare to sync application deployment status with this resource tree call
handler.syncDeploymentStatusWithResourceTreeCall(appDetail)
Expand Down Expand Up @@ -968,13 +884,6 @@ func (handler *InstalledAppRestHandlerImpl) FetchResourceTreeForACDApp(w http.Re
common.WriteJsonResp(w, err, appDetail, http.StatusOK)
}

func (handler *InstalledAppRestHandlerImpl) fetchResourceTree(w http.ResponseWriter, r *http.Request, resourceTreeAndNotesContainer *bean2.AppDetailsContainer, installedApp repository.InstalledApps, deploymentConfig *bean3.DeploymentConfig, helmReleaseInstallStatus string, status string) error {
ctx := r.Context()
cn, _ := w.(http.CloseNotifier)
err := handler.installedAppResourceService.FetchResourceTree(ctx, cn, resourceTreeAndNotesContainer, installedApp, deploymentConfig, helmReleaseInstallStatus, status)
return err
}

func (handler *InstalledAppRestHandlerImpl) fetchResourceTreeWithHibernateForACD(w http.ResponseWriter, r *http.Request, appDetail *bean2.AppDetailContainer) {
ctx := r.Context()
cn, _ := w.(http.CloseNotifier)
Expand Down
7 changes: 4 additions & 3 deletions api/appbean/AppDetail.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ type Secret struct {
}

type ConfigMapSecretDataVolumeUsageConfig struct {
MountPath string `json:"mountPath"`
SubPath bool `json:"subPath"`
FilePermission string `json:"filePermission"`
MountPath string `json:"mountPath"`
SubPath bool `json:"subPath"`
FilePermission string `json:"filePermission"`
ESOSubPath []string `json:"esoSubPath"`
}

type ExternalSecret struct {
Expand Down
16 changes: 15 additions & 1 deletion api/argoApplication/wire_argoApplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@ import (
"github.com/google/wire"
)

var ArgoApplicationWireSet = wire.NewSet(
var ArgoApplicationWireSetFull = wire.NewSet(
read.NewArgoApplicationReadServiceImpl,
wire.Bind(new(read.ArgoApplicationReadService), new(*read.ArgoApplicationReadServiceImpl)),

argoApplication.NewArgoApplicationServiceExtendedServiceImpl,
wire.Bind(new(argoApplication.ArgoApplicationService), new(*argoApplication.ArgoApplicationServiceExtendedImpl)),

NewArgoApplicationRestHandlerImpl,
wire.Bind(new(ArgoApplicationRestHandler), new(*ArgoApplicationRestHandlerImpl)),

NewArgoApplicationRouterImpl,
wire.Bind(new(ArgoApplicationRouter), new(*ArgoApplicationRouterImpl)),
)

var ArgoApplicationWireSetEA = wire.NewSet(
read.NewArgoApplicationReadServiceImpl,
wire.Bind(new(read.ArgoApplicationReadService), new(*read.ArgoApplicationReadServiceImpl)),

Expand Down
56 changes: 30 additions & 26 deletions api/auth/user/UserRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ func (handler UserRestHandlerImpl) checkRBACForUserCreate(token string, requestS
}

func (handler UserRestHandlerImpl) checkRBACForUserUpdate(token string, userInfo *bean.UserInfo, isUserAlreadySuperAdmin bool, eliminatedRoleFilters,
eliminatedGroupRoles []*repository.RoleModel) (isAuthorised bool, err error) {
eliminatedGroupRoles []*repository.RoleModel, mapOfExistingUserRoleGroup map[string]bool) (isAuthorised bool, err error) {
isActionUserSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*")
requestSuperAdmin := userInfo.SuperAdmin
if (requestSuperAdmin || isUserAlreadySuperAdmin) && !isActionUserSuperAdmin {
Expand Down Expand Up @@ -1241,33 +1241,37 @@ func (handler UserRestHandlerImpl) checkRBACForUserUpdate(token string, userInfo
}
}
if len(roleGroups) > 0 { // auth check inside groups
groupRoles, err := handler.roleGroupService.FetchRolesForUserRoleGroups(roleGroups)
if err != nil && err != pg.ErrNoRows {
handler.logger.Errorw("service err, UpdateUser", "err", err, "payload", roleGroups)
return false, err
}
if len(groupRoles) > 0 {
for _, groupRole := range groupRoles {
switch {
case groupRole.Action == bean.ACTION_SUPERADMIN:
isAuthorised = isActionUserSuperAdmin
case groupRole.AccessType == bean.APP_ACCESS_TYPE_HELM || groupRole.Entity == bean2.EntityJobs:
isAuthorised = isActionUserSuperAdmin
case len(groupRole.Team) > 0:
isAuthorised = handler.enforcer.Enforce(token, casbin.ResourceUser, casbin.ActionCreate, groupRole.Team)
case groupRole.Entity == bean.CLUSTER_ENTITIY:
isAuthorised = handler.userCommonService.CheckRbacForClusterEntity(groupRole.Cluster, groupRole.Namespace, groupRole.Group, groupRole.Kind, groupRole.Resource, token, handler.CheckManagerAuth)
case groupRole.Entity == bean.CHART_GROUP_ENTITY:
isAuthorised = true
default:
isAuthorised = false
}
if !isAuthorised {
return false, nil
//filter out roleGroups (existing has to be ignore while checking rbac)
filteredRoleGroups := util2.FilterRoleGroupIfAlreadyPresent(roleGroups, mapOfExistingUserRoleGroup)
if len(filteredRoleGroups) > 0 {
groupRoles, err := handler.roleGroupService.FetchRolesForUserRoleGroups(roleGroups)
if err != nil && err != pg.ErrNoRows {
handler.logger.Errorw("service err, UpdateUser", "err", err, "filteredRoleGroups", filteredRoleGroups)
return false, err
}
if len(groupRoles) > 0 {
for _, groupRole := range groupRoles {
switch {
case groupRole.Action == bean.ACTION_SUPERADMIN:
isAuthorised = isActionUserSuperAdmin
case groupRole.AccessType == bean.APP_ACCESS_TYPE_HELM || groupRole.Entity == bean2.EntityJobs:
isAuthorised = isActionUserSuperAdmin
case len(groupRole.Team) > 0:
isAuthorised = handler.enforcer.Enforce(token, casbin.ResourceUser, casbin.ActionCreate, groupRole.Team)
case groupRole.Entity == bean.CLUSTER_ENTITIY:
isAuthorised = handler.userCommonService.CheckRbacForClusterEntity(groupRole.Cluster, groupRole.Namespace, groupRole.Group, groupRole.Kind, groupRole.Resource, token, handler.CheckManagerAuth)
case groupRole.Entity == bean.CHART_GROUP_ENTITY:
isAuthorised = true
default:
isAuthorised = false
}
if !isAuthorised {
return false, nil
}
}
} else {
isAuthorised = false
}
} else {
isAuthorised = false
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions api/auth/user/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,25 @@

package util

import (
"github.com/devtron-labs/devtron/api/bean"
"github.com/devtron-labs/devtron/pkg/auth/user/helper"
)

func IsGroupsPresent(groups []string) bool {
if len(groups) > 0 {
return true
}
return false
}

func FilterRoleGroupIfAlreadyPresent(roleGroups []bean.UserRoleGroup, mapOfExistingUserRoleGroup map[string]bool) []bean.UserRoleGroup {
finalRoleGroups := make([]bean.UserRoleGroup, 0, len(roleGroups))
for _, roleGrp := range roleGroups {
if _, ok := mapOfExistingUserRoleGroup[helper.GetCasbinNameFromRoleGroupName(roleGrp.RoleGroup.Name)]; !ok {
finalRoleGroups = append(finalRoleGroups, roleGrp)
}
}
return finalRoleGroups

}
3 changes: 2 additions & 1 deletion api/bean/ConfigMapAndSecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type ConfigSecretMap struct {
RoleARN string `json:"roleARN"`
SecretData json.RawMessage `json:"secretData,omitempty"`
SubPath bool `json:"subPath"`
ESOSubPath []string `json:"esoSubPath"`
FilePermission string `json:"filePermission"`
}

Expand All @@ -70,7 +71,7 @@ func (configSecretJson *ConfigSecretJson) SetReferencedSecrets(secrets []ConfigS
configSecretJson.Secrets = util.GetReferencedArray(secrets)
}

func (ConfigSecretRootJson) GetTransformedDataForSecretData(data string, mode util.SecretTransformMode) (string, error) {
func GetTransformedDataForSecretData(data string, mode util.SecretTransformMode) (string, error) {
secretsJson := ConfigSecretRootJson{}
err := json.Unmarshal([]byte(data), &secretsJson)
if err != nil {
Expand Down
17 changes: 9 additions & 8 deletions api/helm-app/service/HelmAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"github.com/devtron-labs/common-lib/utils/k8s"
"github.com/devtron-labs/common-lib/utils/k8s/commonBean"
"github.com/devtron-labs/devtron/api/helm-app/bean"
"github.com/devtron-labs/devtron/api/helm-app/gRPC"
"github.com/devtron-labs/devtron/api/helm-app/models"
Expand Down Expand Up @@ -234,15 +235,15 @@ func (impl *HelmAppServiceImpl) GetClusterConf(clusterId int) (*gRPC.ClusterConf
}
config := &gRPC.ClusterConfig{
ApiServerUrl: cluster.ServerUrl,
Token: cluster.Config[k8s.BearerToken],
Token: cluster.Config[commonBean.BearerToken],
ClusterId: int32(cluster.Id),
ClusterName: cluster.ClusterName,
InsecureSkipTLSVerify: cluster.InsecureSkipTLSVerify,
}
if cluster.InsecureSkipTLSVerify == false {
config.KeyData = cluster.Config[k8s.TlsKey]
config.CertData = cluster.Config[k8s.CertData]
config.CaData = cluster.Config[k8s.CertificateAuthorityData]
config.KeyData = cluster.Config[commonBean.TlsKey]
config.CertData = cluster.Config[commonBean.CertData]
config.CaData = cluster.Config[commonBean.CertificateAuthorityData]
}
return config, nil
}
Expand Down Expand Up @@ -1095,15 +1096,15 @@ func (impl *HelmAppServiceImpl) listApplications(ctx context.Context, clusterIds
for _, clusterDetail := range clusters {
config := &gRPC.ClusterConfig{
ApiServerUrl: clusterDetail.ServerUrl,
Token: clusterDetail.Config[k8s.BearerToken],
Token: clusterDetail.Config[commonBean.BearerToken],
ClusterId: int32(clusterDetail.Id),
ClusterName: clusterDetail.ClusterName,
InsecureSkipTLSVerify: clusterDetail.InsecureSkipTLSVerify,
}
if clusterDetail.InsecureSkipTLSVerify == false {
config.KeyData = clusterDetail.Config[k8s.TlsKey]
config.CertData = clusterDetail.Config[k8s.CertData]
config.CaData = clusterDetail.Config[k8s.CertificateAuthorityData]
config.KeyData = clusterDetail.Config[commonBean.TlsKey]
config.CertData = clusterDetail.Config[commonBean.CertData]
config.CaData = clusterDetail.Config[commonBean.CertificateAuthorityData]
}
req.Clusters = append(req.Clusters, config)
}
Expand Down
5 changes: 4 additions & 1 deletion api/restHandler/CoreAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ func (handler CoreAppRestHandlerImpl) buildAppConfigMaps(appId int, envId int, c
}
var dataObj map[string]interface{}
if data != nil {
err := json.Unmarshal([]byte(data), &dataObj)
err := json.Unmarshal(data, &dataObj)
if err != nil {
handler.logger.Errorw("service err, un-marshaling of data fail in config map", "err", err, "appId", appId)
return nil, err, http.StatusInternalServerError
Expand Down Expand Up @@ -1041,6 +1041,7 @@ func (handler CoreAppRestHandlerImpl) buildAppSecrets(appId int, envId int, secr
globalSecret.DataVolumeUsageConfig = &appBean.ConfigMapSecretDataVolumeUsageConfig{
SubPath: secret.SubPath,
FilePermission: secret.FilePermission,
ESOSubPath: secret.ESOSubPath,
}
considerGlobalDefaultData := envId > 0 && secret.Data == nil
if considerGlobalDefaultData {
Expand Down Expand Up @@ -1486,6 +1487,7 @@ func (handler CoreAppRestHandlerImpl) createGlobalSecrets(appId int, userId int3
secretData.MountPath = dataVolumeUsageConfig.MountPath
secretData.SubPath = dataVolumeUsageConfig.SubPath
secretData.FilePermission = dataVolumeUsageConfig.FilePermission
secretData.ESOSubPath = dataVolumeUsageConfig.ESOSubPath
}

if secret.IsExternal {
Expand Down Expand Up @@ -1989,6 +1991,7 @@ func (handler CoreAppRestHandlerImpl) createEnvSecret(appId int, userId int32, e
secretData.MountPath = secretOverrideDataVolumeUsageConfig.MountPath
secretData.SubPath = secretOverrideDataVolumeUsageConfig.SubPath
secretData.FilePermission = secretOverrideDataVolumeUsageConfig.FilePermission
secretData.ESOSubPath = secretOverrideDataVolumeUsageConfig.ESOSubPath
}
var secretDataRequest []*bean2.ConfigData
secretDataRequest = append(secretDataRequest, secretData)
Expand Down
Loading
Loading