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

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