returnadmission.NewForbidden(a,fmt.Errorf("the integer value of priority must not be provided in pod spec. Priority admission controller populates the value from the given PriorityClass name"))
ifoperation==admission.Update{
oldPod,ok:=a.GetOldObject().(*api.Pod)
if!ok{
returnerrors.NewBadRequest("resource was marked with kind Pod but was unable to be converted")
}
// This admission plugin set pod.Spec.Priority on create.
// Ensure the existing priority is preserved on update.
// API validation prevents mutations to Priority and PriorityClassName, so any other changes will fail update validation and not be persisted.
returnadmission.NewForbidden(a,fmt.Errorf("the integer value of priority (%d) must not be provided in pod spec; priority admission controller computed %d from the given PriorityClass name",*pod.Spec.Priority,priority))