Skip to content

Commit

Permalink
add comments to new types
Browse files Browse the repository at this point in the history
  • Loading branch information
c-pius committed Jan 22, 2025
1 parent 6d6d631 commit de12b93
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/templatelookup/moduletemplateinfolookup/aggregated.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ import (
var ErrNoResponsibleStrategy = errors.New("failed to find responsible module template lookup strategy")

type ModuleTemplateInfoLookupStrategy interface {
// IsResponsible checks if the strategy is responsible for the given module installation.
IsResponsible(moduleInfo *templatelookup.ModuleInfo,
moduleReleaseMeta *v1beta2.ModuleReleaseMeta,
) bool
// Lookup looks up the required module template.
Lookup(ctx context.Context,
moduleInfo *templatelookup.ModuleInfo,
kyma *v1beta2.Kyma,
moduleReleaseMeta *v1beta2.ModuleReleaseMeta,
) templatelookup.ModuleTemplateInfo
IsResponsible(moduleInfo *templatelookup.ModuleInfo,
moduleReleaseMeta *v1beta2.ModuleReleaseMeta,
) bool
}

// AggregatedModuleTemplateInfoLookupStrategy is a strategy that aggregates multiple ModuleTemplateInfoLookupStrategies.
// It iterates over the strategies and uses the first one that is responsible for the given module info.
type AggregatedModuleTemplateInfoLookupStrategy struct {
strategies []ModuleTemplateInfoLookupStrategy
}
Expand Down
1 change: 1 addition & 0 deletions pkg/templatelookup/moduletemplateinfolookup/by_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

var ErrNotDefaultChannelAllowed = errors.New("specifying no default channel is not allowed")

// ByChannelStrategy looks up the module template for a given channel-based installation.
type ByChannelStrategy struct {
client client.Reader
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/kyma-project/lifecycle-manager/pkg/templatelookup"
)

// ByModuleReleaseMetaStrategy looks up the module template via the module release meta.
// It only supports channel-based installation.
type ByModuleReleaseMetaStrategy struct {
client client.Reader
}
Expand Down
1 change: 1 addition & 0 deletions pkg/templatelookup/moduletemplateinfolookup/by_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/kyma-project/lifecycle-manager/pkg/templatelookup"
)

// ByVersionStrategy looks up the module template for a given version-based installation.
type ByVersionStrategy struct {
client client.Reader
}
Expand Down

0 comments on commit de12b93

Please sign in to comment.