apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ .Values.roleBindingName | default .Release.Name }}
  namespace: {{ .Release.Namespace }}
{{- if .Values.extraLabels.roleBinding }}
  labels:
  {{- toYaml .Values.extraLabels.roleBinding | nindent 4 }}
{{- end }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ .Values.roleName | default .Release.Name }}
subjects:
- kind: ServiceAccount
  name: {{ template "teleport-kube-agent.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
