Skip to content

Commit

Permalink
feat: ignore workloads as modules when generating the spec (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkYuan authored May 16, 2024
1 parent 78cbbbd commit 45336c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions pkg/modules/generators/app_configurations_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ type appConfigurationGenerator struct {
dependencies *pkg.Dependencies
}

var ignoreModules = map[string]bool{
// IgnoreModules todo@dayuan delete this condition after workload is changed into a module
var IgnoreModules = map[string]bool{
"service": true,
"job": true,
}

func NewAppConfigurationGenerator(
Expand Down Expand Up @@ -290,8 +292,8 @@ func (g *appConfigurationGenerator) callModules(projectModuleConfigs map[string]

// generate customized module resources
for t, config := range indexModuleConfig {
// ignore workload and namespace modules
if ignoreModules[t] {
// ignore workload modules
if IgnoreModules[t] {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/workspace/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func ValidateModuleConfigs(configs v1.ModuleConfigs) error {

// ValidateModuleConfig is used to validate the moduleConfig is valid or not.
func ValidateModuleConfig(config *v1.ModuleConfig) error {
// todo validate path and version in the config when we have turned workload into a module
if err := ValidateModuleDefaultConfig(config.Configs.Default); err != nil {
return err
}
Expand All @@ -81,6 +80,7 @@ func ValidateModuleConfig(config *v1.ModuleConfig) error {
}

func ValidateModuleDefaultConfig(config v1.GenericConfig) error {
// todo@dayuan validate path and version in the config when we have turned workload into a module
if len(config) == 0 {
return fmt.Errorf("%w, block name: %s", ErrEmptyModuleConfigBlock, v1.DefaultBlock)
}
Expand Down

0 comments on commit 45336c8

Please sign in to comment.