From 1440949dc668ba7824616deb98d978530ddf92f0 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Fri, 10 Nov 2017 15:45:38 +0800 Subject: [PATCH] not calculate new priority when user update pods motivation of this change: If we update the priority, pod validation mechanism will prevent this update request, this is not expected. --- plugin/pkg/admission/priority/admission.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/pkg/admission/priority/admission.go b/plugin/pkg/admission/priority/admission.go index 471b64c525c..646ff176357 100644 --- a/plugin/pkg/admission/priority/admission.go +++ b/plugin/pkg/admission/priority/admission.go @@ -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)