apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "deepflow.fullname" . }}-server
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "deepflow.fullname" . }}-server
  namespace: {{ .Release.Namespace }}
rules:
  - apiGroups:
    - ""
    resources:
      - endpoints
      - services
    verbs:
      - list
      - get
      - watch
      - create
      - update
  - apiGroups:
    - ""
    resources:
    - pods
    verbs:
      - list
      - get
      - watch
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs:
      - '*'
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "deepflow.fullname" . }}-server
subjects:
- kind: ServiceAccount
  name: {{ include "deepflow.fullname" . }}-server
  namespace: {{ .Release.Namespace }}
  apiGroup: ""
roleRef:
  kind: Role
  name: {{ include "deepflow.fullname" . }}-server
  apiGroup: ""