# helm_charts_gcpserviceaccount.yaml
{{- if .Values.upload.googlestoragebucket.usingGCPController }}
apiVersion: gcp.kiwigrid.com/v1beta1
kind: GcpServiceAccount
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
{{ include "mysqldump.labels" . | indent 4 }}
  name: {{ template "mysqldump.fullname" . }}
spec:
  serviceAccountIdentifier: {{ template "mysqldump.serviceAccountName" . }}
  serviceAccountDescription: Service account for accessing a storage bucket for mysql backups
  secretName: {{ template "mysqldump.gcpsecretName" . }}
  bindings:
  - resource: buckets/{{ index (splitList "/" (.Values.upload.googlestoragebucket.bucketname | replace "gs://" "")) 0  }}
    roles:
    - roles/storage.objectAdmin
{{ end }}