apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
{{ include "reloader-labels.stakater" . | indent 4 }}
{{ include "reloader-labels.chart" . | indent 4 }}
  name: {{ template "reloader-name" . }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
  labels: 
{{ include "reloader-labels.stakater" . | indent 4 }}
{{ include "reloader-labels.chart" . | indent 4 }}
  name: {{ template "reloader-name" . }}-role
  namespace: {{ .Release.Namespace }}
rules:
  - apiGroups:
      - ""
    resources:      
      - secrets
      - configmaps
    verbs:
      - list
      - get
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  labels: 
{{ include "reloader-labels.stakater" . | indent 4 }}
{{ include "reloader-labels.chart" . | indent 4 }}
  name: {{ template "reloader-name" . }}-role-binding
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "reloader-name" . }}-role
subjects:
  - kind: ServiceAccount
    name: {{ template "reloader-name" . }}
    namespace: {{ .Release.Namespace }}