{{- if and .Values.controller.argocd.integrationEnabled .Values.controller.argocd.watchArgocdNamespaceOnly }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: kargo-controller
  namespace: {{ .Values.controller.argocd.namespace | default "argocd" }}
  labels:
    {{- include "kargo.labels" . | nindent 4 }}
    {{- include "kargo.controller.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: kargo-controller
subjects:
- kind: ServiceAccount
  namespace: {{ .Release.Namespace }}
  name: kargo-controller
{{- end }}
