Skip to content

[gcloud-sqlproxy] fix #145 use sha1sum instead of randAlphaNum #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 20, 2023
2 changes: 1 addition & 1 deletion stable/gcloud-sqlproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ name: gcloud-sqlproxy
sources:
- https://github.com/rimusz/charts
type: application
version: 0.25.3
version: 0.25.4
3 changes: 2 additions & 1 deletion stable/gcloud-sqlproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ GCP does not support more than 5 endpoints on an Internal Load Balancer. To work

Please note, as of `0.25.0` use [cloud-sql-proxy v2](https://github.com/GoogleCloudPlatform/cloud-sql-proxy/blob/main/migration-guide.md). The `httpPortProbe` replaced `httpLivenessProbe.port` & `httpReadinessProbe.port`.

Please note, as of `0.25.3`, if the value of `cloudsql.instances[].instanceShortName` remains undefined, an instanceShortName of 15 characters length will be generated, with a combination of first 5 letters of the instance name, then a hypen "-" and the remaining 9 characters will be autogenerated.

Please note, as of `0.25.3`, if the value of `cloudsql.instances[].instanceShortName` remains undefined, an instanceShortName of 15 characters length will be generated, with a combination of first 5 letters of the instance name, then a hypen "-" and the remaining 9 characters will be autogenerated using sha1sum of the `instance` name.

**From <= 0.22.2 to >= 0.23.0**

Expand Down
2 changes: 1 addition & 1 deletion stable/gcloud-sqlproxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Create the name of the service account to use
Create the short instance name
*/}}
{{- define "gcloud-sqlproxy.instanceShortName" -}}
{{- $randomString := randAlphaNum 9 | lower -}}
{{- $randomString := sha1sum .instance | lower | substr 0 9 -}}
{{ .instanceShortName | default (printf "%s-%s" (.instance | trunc 5 | trimSuffix "-") $randomString) }}
{{- end -}}

Expand Down