Skip to content

Commit

Permalink
chore: Remove cluster's configs verification
Browse files Browse the repository at this point in the history
(cherry picked from commit 10cb644)
  • Loading branch information
sophon-zt committed Jan 21, 2025
1 parent c1e8e32 commit a6895be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
15 changes: 3 additions & 12 deletions pkg/controller/component/synthesize_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,20 +375,11 @@ func overrideConfigTemplates(synthesizedComp *SynthesizedComponent, comp *appsv1
if template == nil {
return fmt.Errorf("the config template %s is not defined in definition", *config.Name)
}

specified := func() bool {
return config.ConfigMap != nil && len(config.ConfigMap.Name) > 0
}
switch {
case len(template.TemplateRef) == 0 && !specified():
if config.ConfigMap == nil || config.ConfigMap.Name == "" {
return fmt.Errorf("there is no content provided for config template %s", *config.Name)
case len(template.TemplateRef) > 0 && specified():
return fmt.Errorf("partial overriding is not supported, config template: %s", *config.Name)
case specified():
template.TemplateRef = config.ConfigMap.Name
default:
// do nothing
}
template.TemplateRef = config.ConfigMap.Name
template.Namespace = comp.Namespace
}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/component/synthesize_component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ var _ = Describe("synthesized component", func() {
},
})
_, err := BuildSynthesizedComponent(ctx, cli, compDef, comp, nil)
Expect(err).ShouldNot(BeNil())
Expect(err.Error()).Should(ContainSubstring("partial overriding is not supported"))
Expect(err).Should(BeNil())
})

It("w/ comp override - both not specified", func() {
Expand Down

0 comments on commit a6895be

Please sign in to comment.