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,10 +217,11 @@ 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)
}
}
}
return allErrors
}
@@ -248,10 +249,11 @@ 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)
}
}
}
return allErrors
}