From cec16cc1a466cc9a6007e34c7d736ad5be1020d0 Mon Sep 17 00:00:00 2001 From: yangsoon Date: Thu, 2 Sep 2021 14:09:45 +0800 Subject: [PATCH] Fix(webhook): only check the uniqueness of component names under the same namespace (#2222) --- pkg/appfile/parser.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/appfile/parser.go b/pkg/appfile/parser.go index ab30aa200..077e41b03 100644 --- a/pkg/appfile/parser.go +++ b/pkg/appfile/parser.go @@ -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 {