apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app: fleet
    chart: fleet
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: fleet
  namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
  - core
  resources:
  - secrets
  resourceNames:
  - {{ .Values.mysql.secretName }}
  - {{ .Values.redis.secretName }}
  - {{ .Values.fleet.secretName }}
  - {{ .Values.osquery.secretName }}
  verbs:
  - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app: fleet
    chart: fleet
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: fleet
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: fleet
subjects:
- apiGroup: ""
  kind: ServiceAccount
  name: fleet
  namespace: {{ .Release.Namespace }}
