apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dbaas-proxy
rules:
  - apiGroups:
      - ""
    resources:
      - pods
      - persistentvolumeclaims
      - configmaps
      - secrets
      - services
      - namespaces
      - endpoints
      - serviceaccounts
    verbs:
      - get
      - watch
      - list
      - create
      - delete
      - update
  - apiGroups:
      - batch
    resources:
      - jobs
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - delete
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - clusterrolebindings
    verbs:
      - create
      - get
      - update
  - apiGroups:
      - apps
    resources:
      - deployments
      - statefulsets
      - controllerrevisions
    verbs:
      - get
      - list
      - watch
      - create
      - update
  - apiGroups:
      - pingcap.com
    resources:
      - "*"
    verbs:
      - "*"
  - apiGroups:
      - apps.pingcap.com
    resources:
      - statefulsets/status
    verbs:
      - "*"
  - apiGroups:
      - cloud.pingcap.com
    resources:
      - "*"
    verbs:
      - "*"
  - apiGroups:
      - cert-manager.io
    resources:
      - certificates
      - certificaterequests
      - issuers
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
  - apiGroups:
      - storage.k8s.io
    resources:
      - storageclasses
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: dbaas-proxy
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: dbaas-proxy
subjects:
  - kind: ServiceAccount
    name: dbaas-proxy
    namespace: tidb-admin
