# helm_charts_server-read-clusterrolebinding.yaml
{{- if .Values.server.enabled -}}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  labels:
    app: {{ template "kiam.name" . }}
    chart: {{ template "kiam.chart" . }}
    component: "{{ .Values.server.name }}"
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "kiam.fullname" . }}-read
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "kiam.fullname" . }}-read
subjects:
  - kind: ServiceAccount
    name: {{ template "kiam.serviceAccountName.server" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end }}