
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "rollout.name" . }}-controller-manager
  namespace: {{ .Values.installation.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "rollout.name" . }}-leader-election-role
  namespace: {{ .Values.installation.namespace }}
rules:
  - apiGroups:
      - ""
    resources:
      - configmaps
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: kruise-rollout-manager-role
rules:
- apiGroups:
  - '*'
  resources:
  - events
  verbs:
  - create
  - patch
  - update
- 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:
  - deployments
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - deployments/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - apps
  resources:
  - replicasets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - replicasets/status
  verbs:
  - get
  - patch
  - update
- 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:
  - 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:
  - daemonsets
  verbs:
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - apps.kruise.io
  resources:
  - daemonsets/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:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - pods/finalizers
  verbs:
  - update
- apiGroups:
  - ""
  resources:
  - pods/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - services
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - services/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - gateway.networking.k8s.io
  resources:
  - httproutes
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - gateway.networking.k8s.io
  resources:
  - httproutes/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - networking.k8s.io
  resources:
  - ingresses
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - networking.k8s.io
  resources:
  - ingresses/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - batchreleases
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - rollouts.kruise.io
  resources:
  - batchreleases/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouthistories
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouthistories/finalizers
  verbs:
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouthistories/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouts
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouts/finalizers
  verbs:
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - rollouts/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - trafficroutings
  verbs:
  - create
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - rollouts.kruise.io
  resources:
  - trafficroutings/finalizers
  verbs:
  - update
- apiGroups:
  - rollouts.kruise.io
  resources:
  - trafficroutings/status
  verbs:
  - get
  - patch
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ template "rollout.name" . }}-leader-election-rolebinding
  namespace: {{ .Values.installation.namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "rollout.name" . }}-leader-election-role
subjects:
  - kind: ServiceAccount
    name: {{ template "rollout.name" . }}-controller-manager
    namespace: {{ .Values.installation.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ template "rollout.name" . }}-manager-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "rollout.name" . }}-manager-role
subjects:
  - kind: ServiceAccount
    name: {{ template "rollout.name" . }}-controller-manager
    namespace: {{ .Values.installation.namespace }}
