Unverified Commit ecdf31d5 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #55221 from CaoShuFeng/priority

Automatic merge from submit-queue (batch tested with PRs 54987, 55221, 54099, 55144, 54215). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. not calculate new priority when user update other spec of a pod motivation of this change: If we update the priority, pod validation mechanism will prevent this update request, this is not expected. **Release note**: ``` Priority admission controller: not calculate new priority when user update a pod ```
parents fc61d9bc 1440949d
......@@ -105,6 +105,7 @@ var (
)
// Admit checks Pods and admits or rejects them. It also resolves the priority of pods based on their PriorityClass.
// Note that pod validation mechanism prevents update of a pod priority.
func (p *PriorityPlugin) Admit(a admission.Attributes) error {
operation := a.GetOperation()
// Ignore all calls to subresources
......@@ -114,7 +115,7 @@ func (p *PriorityPlugin) Admit(a admission.Attributes) error {
switch a.GetResource().GroupResource() {
case podResource:
if operation == admission.Create || operation == admission.Update {
if operation == admission.Create {
return p.admitPod(a)
}
return nil
......@@ -149,7 +150,6 @@ func (p *PriorityPlugin) Validate(a admission.Attributes) error {
}
// admitPod makes sure a new pod does not set spec.Priority field. It also makes sure that the PriorityClassName exists if it is provided and resolves the pod priority from the PriorityClassName.
// Note that pod validation mechanism prevents update of a pod priority.
func (p *PriorityPlugin) admitPod(a admission.Attributes) error {
operation := a.GetOperation()
pod, ok := a.GetObject().(*api.Pod)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment