Skip to content

Commit

Permalink
Fix rbac issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLike committed Mar 18, 2019
1 parent 12af9c6 commit 67365ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion installer/chart/volcano/templates/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rules:
verbs: ["create", "list", "watch", "update", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["create", "list", "watch", "update"]
verbs: ["create", "get", "list", "watch", "update", "bind", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "create"]
Expand Down
8 changes: 7 additions & 1 deletion installer/chart/volcano/templates/scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rules:
resources: ["events"]
verbs: ["create", "list", "watch", "update", "patch"]
- apiGroups: [""]
resources: ["pods"]
resources: ["pods", "pods/status"]
verbs: ["create", "get", "list", "watch", "update", "bind", "updateStatus", "delete"]
- apiGroups: [""]
resources: ["pods/binding"]
Expand All @@ -50,6 +50,12 @@ rules:
- apiGroups: ["policy"]
resources: ["poddisruptionbudgets"]
verbs: ["list", "watch"]
- apiGroups: ["scheduling.incubator.k8s.io"]
resources: ["queues"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: ["scheduling.k8s.io"]
resources: ["priorityclasses"]
verbs: ["get", "list", "watch"]

---
kind: ClusterRoleBinding
Expand Down
6 changes: 6 additions & 0 deletions pkg/controllers/job/job_controller_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (cc *Controller) killJob(jobInfo *apis.JobInfo, nextState state.NextStateFn
err := cc.kubeClients.CoreV1().Pods(pod.Namespace).Delete(pod.Name, nil)
if err != nil {
running++
glog.Errorf("Failed to delete pod %s for Job %s, err %#v",
pod.Name, job.Name, err)
errs = append(errs, err)
continue
}
Expand All @@ -76,6 +78,8 @@ func (cc *Controller) killJob(jobInfo *apis.JobInfo, nextState state.NextStateFn
err := cc.kubeClients.CoreV1().Pods(pod.Namespace).Delete(pod.Name, nil)
if err != nil {
pending++
glog.Errorf("Failed to delete pod %s for Job %s, err %#v",
pod.Name, job.Name, err)
errs = append(errs, err)
continue
}
Expand All @@ -86,6 +90,8 @@ func (cc *Controller) killJob(jobInfo *apis.JobInfo, nextState state.NextStateFn
err := cc.kubeClients.CoreV1().Pods(pod.Namespace).Delete(pod.Name, nil)
if err != nil {
failed++
glog.Errorf("Failed to delete pod %s for Job %s, err %#v",
pod.Name, job.Name, err)
errs = append(errs, err)
continue
}
Expand Down

0 comments on commit 67365ba

Please sign in to comment.