Fix(webhook): only check the uniqueness of component names under the same namespace (#2222)

This commit is contained in:
yangsoon
2021-09-02 14:09:45 +08:00
committed by GitHub
parent 1776859631
commit cec16cc1a4
+5 -1
View File
@@ -224,7 +224,11 @@ func (p *Parser) parseTrait(ctx context.Context, name string, properties map[str
func (p *Parser) ValidateComponentNames(ctx context.Context, af *Appfile) (int, error) {
existCompNames := make(map[string]string)
existApps := v1beta1.ApplicationList{}
if err := p.client.List(ctx, &existApps); err != nil {
listOpts := []client.ListOption{
client.InNamespace(af.Namespace),
}
if err := p.client.List(ctx, &existApps, listOpts...); err != nil {
return 0, err
}
for _, existApp := range existApps.Items {