diff --git a/stable/gcloud-sqlproxy/Chart.yaml b/stable/gcloud-sqlproxy/Chart.yaml index 34a5665..854dee4 100755 --- a/stable/gcloud-sqlproxy/Chart.yaml +++ b/stable/gcloud-sqlproxy/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: gcloud-sqlproxy sources: - https://github.com/rimusz/charts -version: 0.20.5 +version: 0.20.6 diff --git a/stable/gcloud-sqlproxy/templates/_helpers.tpl b/stable/gcloud-sqlproxy/templates/_helpers.tpl index baf6420..27d6100 100755 --- a/stable/gcloud-sqlproxy/templates/_helpers.tpl +++ b/stable/gcloud-sqlproxy/templates/_helpers.tpl @@ -89,3 +89,10 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Create the short instance name +*/}} +{{- define "gcloud-sqlproxy.instanceShortName" -}} +{{ .instanceShortName | default (.instance | trunc 15 | trimSuffix "-") }} +{{- end -}} diff --git a/stable/gcloud-sqlproxy/templates/deployment.yaml b/stable/gcloud-sqlproxy/templates/deployment.yaml index 8556c5e..eed8b2a 100755 --- a/stable/gcloud-sqlproxy/templates/deployment.yaml +++ b/stable/gcloud-sqlproxy/templates/deployment.yaml @@ -61,7 +61,8 @@ spec: {{- end }} ports: {{- range .Values.cloudsql.instances }} - - name: {{ .instanceShortName | default (.instance | trunc 15) }} + {{- $instanceShortName := include "gcloud-sqlproxy.instanceShortName" . }} + - name: {{ $instanceShortName }} containerPort: {{ .port }} {{- end }} {{- if .Values.livenessProbe.enabled }} diff --git a/stable/gcloud-sqlproxy/templates/svc-statefulset.yaml b/stable/gcloud-sqlproxy/templates/svc-statefulset.yaml index a35bb6e..e82c2cb 100644 --- a/stable/gcloud-sqlproxy/templates/svc-statefulset.yaml +++ b/stable/gcloud-sqlproxy/templates/svc-statefulset.yaml @@ -10,10 +10,11 @@ spec: clusterIP: None ports: {{- range .Values.cloudsql.instances }} - - name: {{ .instanceShortName | default (.instance | trunc 15) }} + {{- $instanceShortName := include "gcloud-sqlproxy.instanceShortName" . }} + - name: {{ $instanceShortName }} protocol: TCP port: {{ .port }} - targetPort: {{ .instanceShortName | default (.instance | trunc 15) }} + targetPort: {{ $instanceShortName }} {{- end }} selector: {{- include "gcloud-sqlproxy.selectorLabels" . | nindent 4 }} diff --git a/stable/gcloud-sqlproxy/templates/svc.yaml b/stable/gcloud-sqlproxy/templates/svc.yaml index 4452d5a..7f29493 100755 --- a/stable/gcloud-sqlproxy/templates/svc.yaml +++ b/stable/gcloud-sqlproxy/templates/svc.yaml @@ -18,10 +18,11 @@ spec: {{- end }} ports: {{- range .Values.cloudsql.instances }} - - name: {{ .instanceShortName | default (.instance | trunc 15) }} + {{- $instanceShortName := include "gcloud-sqlproxy.instanceShortName" . }} + - name: {{ $instanceShortName }} protocol: TCP port: {{ .port }} - targetPort: {{ .instanceShortName | default (.instance | trunc 15) }} + targetPort: {{ $instanceShortName }} {{- end }} selector: {{- include "gcloud-sqlproxy.selectorLabels" . | nindent 4 }}