apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "deepflow-agent.fullname" . }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "deepflow-agent.fullname" . }}
  namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
  resources:
  - nodes
  - namespaces
  - configmaps
  - services
  - pods
  - replicationcontrollers
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources:
  - daemonsets
  - deployments
  - replicasets
  - statefulsets
  verbs: ["get", "list", "watch"]
- apiGroups: ["extensions", "networking.k8s.io"]
  resources: ["ingresses"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["route.openshift.io"]
  resources: ["routes"]
  verbs: ["get", "list", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "deepflow-agent.fullname" . }}
subjects:
- kind: ServiceAccount
  name: {{ include "deepflow-agent.fullname" . }}
  namespace: {{ .Release.Namespace }}
  apiGroup: ""
roleRef:
  kind: ClusterRole
  name: {{ include "deepflow-agent.fullname" . }}
  apiGroup: ""