-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Reduce permissions for system-upgrade-controller serviceaccount
This patch drastically cuts down the permissions of the system-upgrades-controller from the previous cluster-admin permissions to a tailored set of permissions for the controller.
- Loading branch information
1 parent
3ffd4a3
commit ba5c781
Showing
4 changed files
with
146 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: system-upgrade-controller | ||
rules: | ||
- apiGroups: | ||
- batch | ||
resources: | ||
- jobs | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- namespaces | ||
- nodes | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- upgrade.cattle.io | ||
resources: | ||
- plans | ||
- plans/status | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: system-upgrade-controller | ||
rules: | ||
- apiGroups: | ||
- batch | ||
resources: | ||
- jobs | ||
verbs: | ||
- create | ||
- delete | ||
- deletecollection | ||
- patch | ||
- update | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
--- | ||
# Borrowed from https://stackoverflow.com/a/63553032 | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: system-upgrade-controller-drainer | ||
rules: | ||
# Needed to evict pods | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- "pods/eviction" | ||
verbs: | ||
- "create" | ||
# Needed to list pods by Node | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- "pods" | ||
verbs: | ||
- "get" | ||
- "list" | ||
# Needed to cordon Nodes | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- "nodes" | ||
verbs: | ||
- "get" | ||
- "patch" | ||
# Needed to determine Pod owners | ||
- apiGroups: | ||
- "apps" | ||
resources: | ||
- "statefulsets" | ||
- "daemonsets" | ||
- "replicasets" | ||
verbs: | ||
- "get" | ||
- "list" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: system-upgrade-drainer | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system-upgrade-controller-drainer | ||
subjects: | ||
- kind: ServiceAccount | ||
name: system-upgrade | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: system-upgrade | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system-upgrade-controller | ||
subjects: | ||
- kind: ServiceAccount | ||
name: system-upgrade | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: system-upgrade | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: system-upgrade-controller | ||
subjects: | ||
- kind: ServiceAccount | ||
name: system-upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters