Files
deprecated-helm-charts/stable/gcloud-sqlproxy/templates/deployment.yaml
T
Aaron Taylor 0978b8bc6c stable/gcloud-sqlproxy: handle longer instance names (#5664)
This commit fixes an issue where the chart woud not install for
instances that had a name longer than the current max length of port
names that k8s allows, which is 15 characters [1]. We allow users of the
chart to override the default configuration for this shortened port name
for cases where the prefix on the instance names may not be unique.

[1] The field is defined as an IANA_SVC_NAME, which is at most 15 chars:
    https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#serviceport-v1-core
2018-05-25 05:00:53 -07:00

48 lines
1.7 KiB
YAML

{{- if and .Values.serviceAccountKey (ne (index .Values.cloudsql.instances 0).instance "instance") }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "gcloud-sqlproxy.fullname" . }}
labels:
app: {{ template "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.replicasCount }}
template:
metadata:
labels:
app: {{ template "gcloud-sqlproxy.fullname" . }}
spec:
containers:
- name: sqlproxy
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
resources:
{{ toYaml .Values.resources | indent 10 }}
command: ["/cloud_sql_proxy", "--dir=/cloudsql",
"-instances={{- range .Values.cloudsql.instances -}}
{{ .project }}:{{ .region }}:{{ .instance }}=tcp:0.0.0.0:{{ .port }},
{{- end }}",
"-credential_file=/secrets/cloudsql/credentials.json"]
ports:
{{- range .Values.cloudsql.instances }}
- name: {{ .instanceShortName | default (.instance | trunc 15) }}
containerPort: {{ .port }}
{{- end }}
volumeMounts:
- name: cloudsql-oauth-credentials
mountPath: /secrets/cloudsql
- name: cloudsql
mountPath: /cloudsql
volumes:
- name: cloudsql-oauth-credentials
secret:
secretName: {{ template "gcloud-sqlproxy.fullname" . }}
- name: cloudsql
emptyDir: {}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}