Skip to content

Commit

Permalink
feat: Prevent unallowed internal/beta module installation (kyma-proje…
Browse files Browse the repository at this point in the history
…ct#2111)

* feat: Prevent unallowed internal/beta module installation

* fix linting

* tests to allow ireturn

* refactor mrm fetching

* fix tests

* revert receiver to normal func

* remove unnecessary context

* add missing testcases
# Conflicts:
#	pkg/templatelookup/regular.go
  • Loading branch information
medmes authored and c-pius committed Dec 17, 2024
1 parent b9574fa commit f733532
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/templatelookup/regular.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/kyma-project/lifecycle-manager/api/shared"
"github.com/kyma-project/lifecycle-manager/api/v1beta2"

"github.com/kyma-project/lifecycle-manager/internal/descriptor/provider"
"github.com/kyma-project/lifecycle-manager/internal/remote"
"github.com/kyma-project/lifecycle-manager/pkg/log"
Expand Down Expand Up @@ -47,7 +48,7 @@ type ModuleTemplatesByModuleName map[string]*ModuleTemplateInfo

func (t *TemplateLookup) GetRegularTemplates(ctx context.Context, kyma *v1beta2.Kyma) ModuleTemplatesByModuleName {
templates := make(ModuleTemplatesByModuleName)
for _, module := range FindAvailableModules(kyma) {
for _, module := range FetchModuleStatusInfo(kyma) {
_, found := templates[module.Name]
if found {
continue
Expand Down Expand Up @@ -92,7 +93,7 @@ func (t *TemplateLookup) GetRegularTemplates(ctx context.Context, kyma *v1beta2.
}

func (t *TemplateLookup) PopulateModuleTemplateInfo(ctx context.Context,
module AvailableModule, namespace, kymaChannel string, moduleReleaseMeta *v1beta2.ModuleReleaseMeta,
module ModuleStatusInfo, namespace, kymaChannel string, moduleReleaseMeta *v1beta2.ModuleReleaseMeta,
) ModuleTemplateInfo {
if moduleReleaseMeta == nil {
return t.populateModuleTemplateInfoWithoutModuleReleaseMeta(ctx, module, kymaChannel)
Expand All @@ -102,7 +103,7 @@ func (t *TemplateLookup) PopulateModuleTemplateInfo(ctx context.Context,
}

func (t *TemplateLookup) populateModuleTemplateInfoWithoutModuleReleaseMeta(ctx context.Context,
module AvailableModule, kymaChannel string,
module ModuleStatusInfo, kymaChannel string,
) ModuleTemplateInfo {
var templateInfo ModuleTemplateInfo
if module.IsInstalledByVersion() {
Expand All @@ -114,7 +115,7 @@ func (t *TemplateLookup) populateModuleTemplateInfoWithoutModuleReleaseMeta(ctx
}

func (t *TemplateLookup) populateModuleTemplateInfoUsingModuleReleaseMeta(ctx context.Context,
module AvailableModule,
module ModuleStatusInfo,
moduleReleaseMeta *v1beta2.ModuleReleaseMeta, kymaChannel, namespace string,
) ModuleTemplateInfo {
var templateInfo ModuleTemplateInfo
Expand Down

0 comments on commit f733532

Please sign in to comment.