diff --git a/src/operator/webhooks/clientintents_webhook_v1.go b/src/operator/webhooks/clientintents_webhook_v1.go index 3a9b72d47..1d40a70e5 100644 --- a/src/operator/webhooks/clientintents_webhook_v1.go +++ b/src/operator/webhooks/clientintents_webhook_v1.go @@ -178,7 +178,7 @@ func (v *IntentsValidatorV1) validateSpec(intents *otterizev1beta1.ClientIntents } for _, dns := range intent.Internet.Domains { _, err := idna.Lookup.ToASCII(dns) - if err != nil && !strings.Contains(dns, "*") { + if err != nil && !strings.HasPrefix(dns, "*") { return &field.Error{ Type: field.ErrorTypeInvalid, Field: "domains", diff --git a/src/operator/webhooks/clientintents_webhook_v1alpha3.go b/src/operator/webhooks/clientintents_webhook_v1alpha3.go index 2f5ab03ef..6fd5f8e66 100644 --- a/src/operator/webhooks/clientintents_webhook_v1alpha3.go +++ b/src/operator/webhooks/clientintents_webhook_v1alpha3.go @@ -178,7 +178,7 @@ func (v *IntentsValidatorV1alpha3) validateSpec(intents *otterizev1alpha3.Client } for _, dns := range intent.Internet.Domains { _, err := idna.Lookup.ToASCII(dns) - if err != nil && !strings.Contains(dns, "*") { + if err != nil && !strings.HasPrefix(dns, "*") { return &field.Error{ Type: field.ErrorTypeInvalid, Field: "domains", diff --git a/src/operator/webhooks/clientintents_webhook_v2alpha1.go b/src/operator/webhooks/clientintents_webhook_v2alpha1.go index 794e5b6bf..928eda643 100644 --- a/src/operator/webhooks/clientintents_webhook_v2alpha1.go +++ b/src/operator/webhooks/clientintents_webhook_v2alpha1.go @@ -430,7 +430,7 @@ func (v *IntentsValidatorV2alpha1) validateInternetTarget(internetTarget *otteri } for _, dns := range internetTarget.Domains { _, err := idna.Lookup.ToASCII(dns) - if err != nil && !strings.Contains(dns, "*") { + if err != nil && !strings.HasPrefix(dns, "*") { return &field.Error{ Type: field.ErrorTypeInvalid, Field: "domains",