apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: kruise-leader-election-role
  namespace: {{ .Values.installation.namespace }}
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - configmaps/status
  verbs:
  - get
  - update
  - patch
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: kruise-manager-role
rules:
- apiGroups:
  {{ toYaml .Values.installation.roleListGroups }}
  resources:
  - '*'
  verbs:
  - list
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - validatingwebhookconfigurations
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - controllerrevisions
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - deployments
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - deployments/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps
  resources:
  - replicasets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - replicasets/status
  verbs:
  - get
- apiGroups:
  - apps
  resources:
  - statefulsets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - statefulsets/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - advancedcronjobs
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - advancedcronjobs/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - broadcastjobs
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - broadcastjobs/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - clonesets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - clonesets/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - containerrecreaterequests
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - containerrecreaterequests/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - daemonsets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - daemonsets/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - imagepulljobs
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - imagepulljobs/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - nodeimages
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - nodeimages/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - sidecarsets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - sidecarsets/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - statefulsets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - statefulsets/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - uniteddeployments
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - uniteddeployments/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps.kruise.io
  resources:
  - workloadspreads
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - workloadspreads/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - batch
  resources:
  - jobs
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - batch
  resources:
  - jobs/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - nodes
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - persistentvolumeclaims
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - pods/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - policy.kruise.io
  resources:
  - podunavailablebudgets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - policy.kruise.io
  resources:
  - podunavailablebudgets/status
  verbs:
  - get
  - patch
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: kruise-daemon-role
rules:
- apiGroups:
  - apps.kruise.io
  resources:
  - nodeimages
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - nodeimages/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - update
  - patch
- apiGroups:
  - apps.kruise.io
  resources:
  - containerrecreaterequests
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - containerrecreaterequests/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - pods/status
  verbs:
  - get
  - patch
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: kruise-leader-election-rolebinding
  namespace: {{ .Values.installation.namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: kruise-leader-election-role
subjects:
  - kind: ServiceAccount
    name: default
    namespace: {{ .Values.installation.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kruise-manager-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kruise-manager-role
subjects:
  - kind: ServiceAccount
    name: default
    namespace: {{ .Values.installation.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kruise-daemon-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kruise-daemon-role
subjects:
  - kind: ServiceAccount
    name: kruise-daemon
    namespace: {{ .Values.installation.namespace }}
