# grafana_charts_tokengen-rbac.yaml
{{- if and .Values.enterprise.enabled .Values.tokengenJob.enable -}}
{{ $dict := dict "ctx" . "component" "tokengen" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "tempo.resourceName" $dict }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
  namespace: {{ .Release.Namespace | quote }}
rules:
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "create", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "tempo.resourceName" $dict }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
  namespace: {{ .Release.Namespace | quote }}
subjects:
- kind: ServiceAccount
  name: {{ include "tempo.resourceName" $dict }}
  namespace: {{ .Release.Namespace | quote }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "tempo.resourceName" $dict }}
{{- end -}}