{{- if and .Values.rbac.create .Values.rbac.rules -}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "stacks-blockchain.fullname" . }}
  labels: {{- include "stacks-blockchain.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "stacks-blockchain.fullname" . }}
subjects:
- kind: ServiceAccount
  name: {{ include "stacks-blockchain.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
{{- end }}
