From c9de63e6bdd3aa653031b3623209a5078ce458cf Mon Sep 17 00:00:00 2001 From: Eric Tendian Date: Tue, 22 Oct 2019 21:28:53 -0500 Subject: [PATCH 1/2] Allowing setting of lifecycle hooks on gcloud-sqlproxy to improve reliability with autoscaling --- stable/gcloud-sqlproxy/README.md | 1 + stable/gcloud-sqlproxy/templates/deployment.yaml | 4 ++++ stable/gcloud-sqlproxy/values.yaml | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/stable/gcloud-sqlproxy/README.md b/stable/gcloud-sqlproxy/README.md index 3dee79c..6dbafad 100755 --- a/stable/gcloud-sqlproxy/README.md +++ b/stable/gcloud-sqlproxy/README.md @@ -70,6 +70,7 @@ The following table lists the configurable parameters of the `gcloud-sqlproxy` c | `serviceAccountName` | specify a service account name to use | `""` | | `cloudsql.instances` | List of PostgreSQL/MySQL instances | [{instance: `instance`, project: `project`, region: `region`, port: 5432}] must be provided | | `resources` | CPU/Memory resource requests/limits | Memory: `100/150Mi`, CPU: `100/150m` | +| `lifecycleHooks` | Container lifecycle hooks | `{}` | | `autoscaling.enabled` | Enable CPU/Memory horizontal pod autoscaler | `false` | | `autoscaling.minReplicas` | Autoscaler minimum pod replica count | `1` | | `autoscaling.maxReplicas` | Autoscaler maximum pod replica count | `3` | diff --git a/stable/gcloud-sqlproxy/templates/deployment.yaml b/stable/gcloud-sqlproxy/templates/deployment.yaml index e997984..35135a5 100755 --- a/stable/gcloud-sqlproxy/templates/deployment.yaml +++ b/stable/gcloud-sqlproxy/templates/deployment.yaml @@ -37,6 +37,10 @@ spec: {{ end -}} {{- range $key, $value := .Values.extraArgs }} - --{{ $key }}={{ $value }} + {{- end }} + {{- if .Values.lifecycleHooks }} + lifecycle: +{{ toYaml .Values.lifecycleHooks | indent 10 }} {{- end }} ports: {{- range .Values.cloudsql.instances }} diff --git a/stable/gcloud-sqlproxy/values.yaml b/stable/gcloud-sqlproxy/values.yaml index dd81339..916fd96 100755 --- a/stable/gcloud-sqlproxy/values.yaml +++ b/stable/gcloud-sqlproxy/values.yaml @@ -111,6 +111,14 @@ tolerations: [] ## Affinity affinity: {} +## Lifecycle hooks +## This can be helpful for gracefully terminating the proxy, when used in combination with the -term_timeout=10s extra arg +## NOTE: Your Docker image must have a shell for the preStop command to work, the default Docker image does not have one +lifecycleHooks: {} +# preStop: +# exec: +# command: ['sleep', '10'] + ## Configure the PodDisruptionBudget podDisruptionBudget: | maxUnavailable: 1 From 32792f202818d9178fc53d2c4fb0ad892555e098 Mon Sep 17 00:00:00 2001 From: Eric Tendian Date: Thu, 24 Oct 2019 02:40:56 -0500 Subject: [PATCH 2/2] Bumping gcloud-sqlproxy chart version --- stable/gcloud-sqlproxy/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/gcloud-sqlproxy/Chart.yaml b/stable/gcloud-sqlproxy/Chart.yaml index 66d5a42..6268f1c 100755 --- a/stable/gcloud-sqlproxy/Chart.yaml +++ b/stable/gcloud-sqlproxy/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: gcloud-sqlproxy sources: - https://github.com/rimusz/charts -version: 0.17.0 +version: 0.18.0