{{- if .Values.rbac.create }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: {{ template "sysdig.fullname" .}}
  labels:
    app: {{ template "sysdig.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
subjects:
  - kind: ServiceAccount
    name: {{ template "sysdig.serviceAccountName" .}}
    namespace: {{ .Release.Namespace }}
roleRef:
  kind: ClusterRole
  name: {{ template "sysdig.fullname" .}}
{{- end }}
