# helm_charts_agent-psp-rolebinding.yaml
{{- if and .Values.agent.enabled .Values.psp.create -}}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app: {{ template "kiam.name" . }}
    chart: {{ template "kiam.chart" . }}
    component: "{{ .Values.agent.name }}"
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "kiam.fullname" . }}-agent-psp
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "kiam.fullname" . }}-agent-psp-use
subjects:
- kind: ServiceAccount
  name: {{ template "kiam.serviceAccountName.agent" . }}
{{- end -}}
{{- end }}