apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: <name>
rules:
- apiGroups:
  - "" # "" indicates the core API group
  resources:
  - namespaces
  - endpoints
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - get
  - list
  - watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: <name>
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: <name>
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: <name>
roleRef:
  kind: ClusterRole
  name: <name>
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: cnf-user-role
  namespace: cnf-gateway
rules:
- apiGroups:
  - "" # "" indicates the core API group
  resources:
  - pods
  - pods/log
  - pods/exec
  - pods/status
  - services
  - services/finalizers
  - endpoints
  - persistentvolumeclaims
  - events
  - configmaps
  - secrets
  - resourcequotas
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
  - deletecollection
- apiGroups:
  - apps
  - extensions
  resources:
  - deployments
  - deployments/scale
  - daemonsets
  - replicasets
  - statefulsets
  - ingresses
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - monitoring.coreos.com
  resources:
  - servicemonitors
  verbs:
  - get
  - create
- apiGroups:
  - metrics.k8s.io
  resources:
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - k8s.f5net.com
  - dos.k8s.f5net.com
  - dns.k8s.f5net.com
  resources:
  - '*' # asterisk to grant access to all resources of the specified api groups
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - roles
  - rolebindings
  verbs:
  - get
  - watch
  - list
- apiGroups:
  - ""
  resources:
  - serviceaccounts
  verbs:
  - impersonate
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: <name>
  namespace: <namespace>
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: <name>
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: <name>
roleRef:
  kind: Role
  name: <name>
  apiGroup: rbac.authorization.k8s.io
