Merge pull request #106294 from gy95/continue

fix duplicate webhook insert operation
This commit is contained in:
Kubernetes Prow Robot 2022-01-04 23:02:43 -08:00 committed by GitHub
commit d2969bd260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,8 +217,9 @@ func validateValidatingWebhookConfiguration(e *admissionregistration.ValidatingW
if opts.requireUniqueWebhookNames && len(hook.Name) > 0 {
if hookNames.Has(hook.Name) {
allErrors = append(allErrors, field.Duplicate(field.NewPath("webhooks").Index(i).Child("name"), hook.Name))
} else {
hookNames.Insert(hook.Name)
}
hookNames.Insert(hook.Name)
}
}
return allErrors
@ -248,8 +249,9 @@ func validateMutatingWebhookConfiguration(e *admissionregistration.MutatingWebho
if opts.requireUniqueWebhookNames && len(hook.Name) > 0 {
if hookNames.Has(hook.Name) {
allErrors = append(allErrors, field.Duplicate(field.NewPath("webhooks").Index(i).Child("name"), hook.Name))
} else {
hookNames.Insert(hook.Name)
}
hookNames.Insert(hook.Name)
}
}
return allErrors