mirror of
https://github.com/kubevela/kubevela.git
synced 2026-04-21 10:07:26 +00:00
ignore vela-system, which is specified in needNamespace for addon metadata information (#3109)
Signed-off-by: StevenLeiZhang <zhangleiic@163.com>
This commit is contained in:
@@ -467,6 +467,10 @@ func RenderApp(ctx context.Context, addon *InstallPackage, config *rest.Config,
|
||||
}
|
||||
app.Labels = util.MergeMapOverrideWithDst(app.Labels, map[string]string{oam.LabelAddonName: addon.Name})
|
||||
for _, namespace := range addon.NeedNamespace {
|
||||
// vela-system must exist before rendering vela addon
|
||||
if namespace == types.DefaultKubeVelaNS {
|
||||
continue
|
||||
}
|
||||
comp := common2.ApplicationComponent{
|
||||
Type: "raw",
|
||||
Name: fmt.Sprintf("%s-namespace", namespace),
|
||||
|
||||
@@ -226,6 +226,17 @@ func TestRenderApp(t *testing.T) {
|
||||
assert.Equal(t, len(app.Spec.Components), 2)
|
||||
}
|
||||
|
||||
func TestRenderAppWithNeedNamespace(t *testing.T) {
|
||||
addon := baseAddon
|
||||
addon.NeedNamespace = append(addon.NeedNamespace, types.DefaultKubeVelaNS)
|
||||
app, err := RenderApp(ctx, &addon, nil, nil, map[string]interface{}{})
|
||||
assert.NoError(t, err, "render app fail")
|
||||
assert.Equal(t, len(app.Spec.Components), 2)
|
||||
for _, c := range app.Spec.Components {
|
||||
assert.NotEqual(t, types.DefaultKubeVelaNS+"-namespace", c.Name, "namespace vela-system should not be rendered")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderDeploy2RuntimeAddon(t *testing.T) {
|
||||
addonDeployToRuntime := baseAddon
|
||||
addonDeployToRuntime.Meta.DeployTo = &DeployTo{
|
||||
|
||||
Reference in New Issue
Block a user