Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a8e1a38
wip
manish-agrawal-ai Oct 25, 2022
6f9fefc
compile fix
manish-agrawal-ai Oct 25, 2022
b91ba03
compile fix2
manish-agrawal-ai Oct 25, 2022
7c1a1b4
type fix
manish-agrawal-ai Oct 25, 2022
bb9099d
sql fix
manish-agrawal-ai Oct 25, 2022
df30ceb
fix
manish-agrawal-ai Oct 25, 2022
47b3afb
fix
manish-agrawal-ai Oct 26, 2022
19ecd1c
clusterName, registryId, externalCi, ipsAccess return for app detail
manish-agrawal-ai Oct 26, 2022
f02fb87
ips create while deployment
manish-agrawal-ai Oct 27, 2022
9f4af77
resourceNode info
manish-agrawal-ai Oct 27, 2022
3696b3d
fix10
manish-agrawal-ai Oct 28, 2022
711ff85
updatr fix
manish-agrawal-ai Oct 28, 2022
78299d5
test cases
manish-agrawal-ai Oct 28, 2022
1d59a22
fix
manish-agrawal-ai Oct 28, 2022
4dac281
ecr fix
manish-agrawal-ai Oct 28, 2022
4206332
refactoring
manish-agrawal-ai Oct 28, 2022
56c93f3
fix
manish-agrawal-ai Oct 28, 2022
097efbd
comment added
manish-agrawal-ai Oct 28, 2022
b9603ee
gcr fix
manish-agrawal-ai Oct 28, 2022
c668758
Merge branch 'main' into issue_1930
manish-agrawal-ai Oct 28, 2022
01d3609
sql file renamed
manish-agrawal-ai Oct 29, 2022
08a6e29
proto update
manish-agrawal-ai Nov 2, 2022
bdc40e1
Merge branch 'main' into issue_1930
manish-agrawal-ai Nov 3, 2022
373d442
fix
manish-agrawal-ai Nov 4, 2022
fd2642f
some checks added
manish-agrawal-ai Nov 4, 2022
5e03ca4
fix for external ci
manish-agrawal-ai Nov 4, 2022
0b36d0a
wip
manish-agrawal-ai Nov 7, 2022
db2a120
wip
manish-agrawal-ai Nov 7, 2022
3fad575
fix
manish-agrawal-ai Nov 8, 2022
7699683
Merge branch 'main' into issue_2582
manish-agrawal-ai Nov 8, 2022
0f25d3a
cron time change
manish-agrawal-ai Nov 8, 2022
8e663d8
fix
manish-agrawal-ai Nov 9, 2022
b282e21
Merge branch 'main' into issue_2582
manish-agrawal-ai Nov 11, 2022
7c1d5f0
sql
manish-agrawal-ai Nov 11, 2022
33315f8
fk fix
manish-agrawal-ai Nov 11, 2022
b37130d
f
manish-agrawal-ai Nov 11, 2022
0bf5321
fixes
manish-agrawal-ai Nov 11, 2022
22d6dc8
fixes
manish-agrawal-ai Nov 11, 2022
a00317f
fix: iface
manish-agrawal-ai Nov 11, 2022
c2a141c
api spec
manish-agrawal-ai Nov 11, 2022
eeab644
Merge branch 'main' into issue_2582
manish-agrawal-ai Nov 15, 2022
2825608
sql file number change
manish-agrawal-ai Nov 15, 2022
63c5dbe
fix: resource status not saving in DB if resource status is not found
manish-agrawal-ai Nov 15, 2022
b20d398
module cron time logic made intelligent
manish-agrawal-ai Nov 15, 2022
60e284b
Merge branch 'main' into issue_2582
manish-agrawal-ai Nov 29, 2022
459f6c0
sql file no. change
manish-agrawal-ai Nov 29, 2022
6e7461f
Merge branch 'main' into issue_2582
manish-agrawal-ai Dec 8, 2022
3cd06c4
wire gen generated
manish-agrawal-ai Dec 8, 2022
2f022e6
Merge branch 'main' into issue_2582
manish-agrawal-ai Dec 14, 2022
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
17 changes: 13 additions & 4 deletions api/helm-app/HelmAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DEFAULT_CLUSTER_ID = 1
type HelmAppService interface {
ListHelmApplications(clusterIds []int, w http.ResponseWriter, token string, helmAuth func(token string, object string) bool)
GetApplicationDetail(ctx context.Context, app *AppIdentifier) (*AppDetail, error)
GetApplicationDetailWithFilter(ctx context.Context, app *AppIdentifier, resourceTreeFilter *ResourceTreeFilter) (*AppDetail, error)
HibernateApplication(ctx context.Context, app *AppIdentifier, hibernateRequest *openapi.HibernateRequest) ([]*openapi.HibernateStatus, error)
UnHibernateApplication(ctx context.Context, app *AppIdentifier, hibernateRequest *openapi.HibernateRequest) ([]*openapi.HibernateStatus, error)
DecodeAppId(appId string) (*AppIdentifier, error)
Expand Down Expand Up @@ -233,15 +234,24 @@ func (impl *HelmAppServiceImpl) GetClusterConf(clusterId int) (*ClusterConfig, e
}

func (impl *HelmAppServiceImpl) GetApplicationDetail(ctx context.Context, app *AppIdentifier) (*AppDetail, error) {
return impl.getApplicationDetail(ctx, app, nil)
}

func (impl *HelmAppServiceImpl) GetApplicationDetailWithFilter(ctx context.Context, app *AppIdentifier, resourceTreeFilter *ResourceTreeFilter) (*AppDetail, error) {
return impl.getApplicationDetail(ctx, app, resourceTreeFilter)
}

func (impl *HelmAppServiceImpl) getApplicationDetail(ctx context.Context, app *AppIdentifier, resourceTreeFilter *ResourceTreeFilter) (*AppDetail, error) {
config, err := impl.GetClusterConf(app.ClusterId)
if err != nil {
impl.logger.Errorw("error in fetching cluster detail", "err", err)
return nil, err
}
req := &AppDetailRequest{
ClusterConfig: config,
Namespace: app.Namespace,
ReleaseName: app.ReleaseName,
ClusterConfig: config,
Namespace: app.Namespace,
ReleaseName: app.ReleaseName,
ResourceTreeFilter: resourceTreeFilter,
}
appdetail, err := impl.helmAppClient.GetAppDetail(ctx, req)
if err != nil {
Expand All @@ -265,7 +275,6 @@ func (impl *HelmAppServiceImpl) GetApplicationDetail(ctx context.Context, app *A
}
}
return appdetail, err

}

func (impl *HelmAppServiceImpl) GetDeploymentHistory(ctx context.Context, app *AppIdentifier) (*HelmAppDeploymentHistory, error) {
Expand Down
1,174 changes: 748 additions & 426 deletions api/helm-app/applist.pb.go

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions api/helm-app/applist.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ message AppDetailRequest {
ClusterConfig clusterConfig = 1;
string namespace = 2;
string ReleaseName = 3;
// Map key cannot be float, double, bytes, message, or enum types (map<Gvk, Labels> could be a better option)
ResourceTreeFilter resourceTreeFilter = 4;
}

message AppDetail{
Expand Down Expand Up @@ -271,4 +273,24 @@ message HelmInstallCustomResponse {

message ChartContent {
bytes Content = 1;
}

message Gvk {
string Group = 1;
string Version = 2;
string Kind = 3;
}

message ResourceFilter {
Gvk gvk = 1;
ResourceIdentifier resourceIdentifier = 2;
}

message ResourceIdentifier {
map<string, string> labels = 1;
}

message ResourceTreeFilter {
ResourceIdentifier globalFilter = 1;
repeated ResourceFilter resourceFilters = 2;
}
6 changes: 6 additions & 0 deletions api/module/wire_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package module
import (
"github.com/devtron-labs/devtron/pkg/module"
moduleRepo "github.com/devtron-labs/devtron/pkg/module/repo"
moduleDataStore "github.com/devtron-labs/devtron/pkg/module/store"
"github.com/google/wire"
)

Expand All @@ -11,7 +12,12 @@ var ModuleWireSet = wire.NewSet(
wire.Bind(new(module.ModuleActionAuditLogRepository), new(*module.ModuleActionAuditLogRepositoryImpl)),
moduleRepo.NewModuleRepositoryImpl,
wire.Bind(new(moduleRepo.ModuleRepository), new(*moduleRepo.ModuleRepositoryImpl)),
moduleRepo.NewModuleResourceStatusRepositoryImpl,
wire.Bind(new(moduleRepo.ModuleResourceStatusRepository), new(*moduleRepo.ModuleResourceStatusRepositoryImpl)),
module.ParseModuleEnvConfig,
moduleDataStore.InitModuleDataStore,
module.NewModuleServiceHelperImpl,
wire.Bind(new(module.ModuleServiceHelper), new(*module.ModuleServiceHelperImpl)),
module.NewModuleServiceImpl,
wire.Bind(new(module.ModuleService), new(*module.ModuleServiceImpl)),
module.NewModuleCronServiceImpl,
Expand Down
8 changes: 6 additions & 2 deletions cmd/external-app/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 28 additions & 3 deletions pkg/module/Bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ package module
import (
"fmt"
"github.com/caarlos0/env"
"k8s.io/apimachinery/pkg/runtime/schema"
)

type ModuleInfoDto struct {
Name string `json:"name,notnull"`
Status string `json:"status,notnull" validate:"oneof=notInstalled installed installing installFailed timeout"`
Name string `json:"name,notnull"`
Status string `json:"status,notnull" validate:"oneof=notInstalled installed installing installFailed timeout"`
ModuleResourcesStatus []*ModuleResourceStatusDto `json:"moduleResourcesStatus"`
}

type ModuleConfigDto struct {
Expand All @@ -45,7 +47,16 @@ type ActionResponse struct {
}

type ModuleEnvConfig struct {
ModuleStatusHandlingCronDurationInMin int `env:"MODULE_STATUS_HANDLING_CRON_DURATION_MIN" envDefault:"3"` // default 3 mins
ModuleStatusHandlingCronDurationInMin int `env:"MODULE_STATUS_HANDLING_CRON_DURATION_MIN" envDefault:"3"` // default 3 minutes
}

type ModuleResourceStatusDto struct {
Group string `json:"group"`
Version string `json:"version"`
Kind string `json:"kind"`
Name string `json:"name"`
HealthStatus string `json:"healthStatus"`
HealthMessage string `json:"healthMessage"`
}

func ParseModuleEnvConfig() (*ModuleEnvConfig, error) {
Expand Down Expand Up @@ -82,3 +93,17 @@ const (
)

var SupportedModuleNamesListFirstReleaseExcludingCicd = []string{ModuleNameArgoCd, ModuleNameSecurityClair, ModuleNameNotification, ModuleNameMonitoringGrafana}

type ResourceFilter struct {
GlobalFilter *ResourceIdentifier `json:"globalFilter,omitempty"`
GvkLevelFilters []*GvkLevelFilter `json:"gvkLevelFilters,omitempty"`
}

type GvkLevelFilter struct {
Gvk *schema.GroupVersionKind `json:"gvk"`
ResourceIdentifier *ResourceIdentifier `json:"filter"`
}

type ResourceIdentifier struct {
Labels map[string]string `json:"labels"`
}
Loading