#### THIS CHART IS DEPRECATED! ####

** Please be patient while the chart is being deployed **

{{ if not (or .Values.serviceAccountKey .Values.existingSecret) -}}
################################################################################
####   WARNING: You did not provide Google Cloud Service Account key.       ####
################################################################################

gcloud-sqlproxy requires API access to Cloud SQL API. Without specifying a
service account key, gcloud-sqlproxy will rely on default access via instance
scopes or some other external method. Be sure you cluster provides this access.
All pods do not go to the running state if valid credentials are not available.

{{- end }}

{{- if eq (index .Values.cloudsql.instances 0).instance "instance" }}

##############################################################################
####   ERROR: You did not provide Google Cloud instances.   ####
##############################################################################

All pods do not go to the running state if the instances
settings were not provided.

{{- end }}

{{- if ne (index .Values.cloudsql.instances 0).instance "instance" }}

The SQL server instances can be accessed via ports:
{{- range .Values.cloudsql.instances }}
  - {{ .port }} ({{ .instance }})
{{- end }}
on the following DNS name from within your cluster:
- {{ template "gcloud-sqlproxy.fullname" . }}.{{ .Release.Namespace }}

{{- else }}

This deployment will be incomplete until you provide GCP Service Account key
and instances settings:

  helm upgrade {{ .Release.Name }} \
      --set serviceAccountKey="$(cat service-account.json | base64)" \
      --set cloudsql.instances[0].instance=INSTANCE \
      --set cloudsql.instances[0].project=PROJECT \
      --set cloudsql.instances[0].region=REGION \
      --set cloudsql.instances[0].port=5432 \
      stable/gcloud-sqlproxy

{{- end }}
