Skip to content

Commit cc62dbd

Browse files
fanminshihasbro17
authored andcommitted
pkg/scaffold: use Role/Binding instead of ClusterRole/Binding
1 parent 1f59315 commit cc62dbd

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

pkg/scaffold/role.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ func (r *role) Render(w io.Writer) error {
4343
return t.Execute(w, r.in)
4444
}
4545

46-
// TODO: Change ClusterRole to Role once controller.runtime can be namespaced.
47-
const roleTemplate = `kind: ClusterRole
46+
const roleTemplate = `kind: Role
4847
apiVersion: rbac.authorization.k8s.io/v1beta1
4948
metadata:
5049
name: {{.ProjectName}}

pkg/scaffold/rolebinding.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,15 @@ func (r *roleBinding) Render(w io.Writer) error {
4343
return t.Execute(w, r.in)
4444
}
4545

46-
// TODO: change ClusterRoleBinding to a RoleBinding once
47-
// controller-runtime manager can be namespaced.
48-
const roleBindingTemplate = `kind: ClusterRoleBinding
46+
const roleBindingTemplate = `kind: RoleBinding
4947
apiVersion: rbac.authorization.k8s.io/v1beta1
5048
metadata:
5149
name: default-account-{{.ProjectName}}
5250
subjects:
5351
- kind: ServiceAccount
5452
name: default
55-
namespace: default
5653
roleRef:
57-
kind: ClusterRole
54+
kind: Role
5855
name: {{.ProjectName}}
5956
apiGroup: rbac.authorization.k8s.io
6057
`

0 commit comments

Comments
 (0)