From daa840e4e0577fad30e682635014ab3678bd04e2 Mon Sep 17 00:00:00 2001 From: Daniyal I <48337074+danyworks@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:10:05 +0200 Subject: [PATCH] [gcloud-sqlproxy] fix #145 use sha1sum instead of randAlphaNum (#146) * fix #143 add randAlphaNum to instanceShortName * gcloud-sqlproxy bump chart version to 0.25.3 and update readme * gcloud-sqlproxy fix#143 allow only lowercase in randomString for instanceShortName * gcloud-sqlproxy fix#143 reduce length * gcloud-sqlproxy fix#143 update readme * gcloud-sqlproxy fix #145 generate randomstring using sha1sum not with randAlphaNum * gcloud-sqlproxy fix #145 update readme * gcloud-sqlproxy fix #145 bump chart version * add new line at the end of Chart.yaml --------- Co-authored-by: daniyal ibrahim --- stable/gcloud-sqlproxy/Chart.yaml | 2 +- stable/gcloud-sqlproxy/README.md | 3 ++- stable/gcloud-sqlproxy/templates/_helpers.tpl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stable/gcloud-sqlproxy/Chart.yaml b/stable/gcloud-sqlproxy/Chart.yaml index 7d70c7c..4d3a8d4 100755 --- a/stable/gcloud-sqlproxy/Chart.yaml +++ b/stable/gcloud-sqlproxy/Chart.yaml @@ -19,4 +19,4 @@ name: gcloud-sqlproxy sources: - https://github.com/rimusz/charts type: application -version: 0.25.3 +version: 0.25.4 diff --git a/stable/gcloud-sqlproxy/README.md b/stable/gcloud-sqlproxy/README.md index 82b6318..be42dec 100755 --- a/stable/gcloud-sqlproxy/README.md +++ b/stable/gcloud-sqlproxy/README.md @@ -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** diff --git a/stable/gcloud-sqlproxy/templates/_helpers.tpl b/stable/gcloud-sqlproxy/templates/_helpers.tpl index 61fd838..93fcd48 100755 --- a/stable/gcloud-sqlproxy/templates/_helpers.tpl +++ b/stable/gcloud-sqlproxy/templates/_helpers.tpl @@ -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 -}}