diff --git a/deployment/kube-batch/templates/role.yaml b/deployment/kube-batch/templates/role.yaml new file mode 100644 index 000000000..16defd1cf --- /dev/null +++ b/deployment/kube-batch/templates/role.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: default-sa-admin +subjects: + - kind: ServiceAccount + name: default + namespace: kube-system +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io diff --git a/pkg/scheduler/actions/preempt/preempt.go b/pkg/scheduler/actions/preempt/preempt.go index 9b2132549..77c451491 100644 --- a/pkg/scheduler/actions/preempt/preempt.go +++ b/pkg/scheduler/actions/preempt/preempt.go @@ -231,10 +231,9 @@ func preempt( } preempted.Add(preemptee.Resreq) // If reclaimed enough resources, break loop to avoid Sub panic. - if resreq.LessEqual(preemptee.Resreq) { + if resreq.LessEqual(preempted) { break } - resreq.Sub(preemptee.Resreq) } metrics.RegisterPreemptionAttempts() diff --git a/pkg/scheduler/actions/reclaim/reclaim.go b/pkg/scheduler/actions/reclaim/reclaim.go index e113a65a9..2f411d82e 100644 --- a/pkg/scheduler/actions/reclaim/reclaim.go +++ b/pkg/scheduler/actions/reclaim/reclaim.go @@ -165,10 +165,9 @@ func (alloc *reclaimAction) Execute(ssn *framework.Session) { } reclaimed.Add(reclaimee.Resreq) // If reclaimed enough resources, break loop to avoid Sub panic. - if resreq.LessEqual(reclaimee.Resreq) { + if resreq.LessEqual(reclaimed) { break } - resreq.Sub(reclaimee.Resreq) } glog.V(3).Infof("Reclaimed <%v> for task <%s/%s> requested <%v>.",