Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit 9ffe03d

Browse files
committed
Opt to enable linkerd proxy shutdown from lifecycle preStop
Added a new `linkerd` object to values & schema. If `enabled=true` & `shutdownAfterCheckpoint=true`, then the STS pod's `lifecycle.preStop` hook will be configured to issue a shutdown call to the local linkerd-proxy. This is entirely optional. If a deployment is not using linkerd, then this option should be left in the default disabled state.
1 parent 7ded6b6 commit 9ffe03d

File tree

8 files changed

+43
-3
lines changed

8 files changed

+43
-3
lines changed

charts/timescaledb-single/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
apiVersion: v1
55
name: timescaledb-single
66
description: 'TimescaleDB HA Deployment.'
7-
version: 0.33.2
7+
version: 0.34.0
88
icon: https://cdn.iconscout.com/icon/free/png-256/timescaledb-1958407-1651618.png
99

1010
# appVersion specifies the version of the software, which can vary wildly,

charts/timescaledb-single/docs/admin-guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ The following table lists the configurable parameters of the TimescaleDB Helm ch
3636
| `image.pullPolicy` | The pull policy | `IfNotPresent` |
3737
| `image.repository` | The image to pull | `timescale/timescaledb-ha` |
3838
| `image.tag` | The version of the image to pull | `pg13-ts2.1-latest`
39+
| `linkerd.enabled` | Enabled limited linkerd support. | `false`
40+
| `linkerd.shutdownAfterCheckpoint` | When `true`, configures the StatefulSet Pod's `lifecycle.preStop` to issue a shutdown call to the local linkerd-proxy sidecar after checkpointing is complete. | `false`
3941
| `service.primary.type` | The service type to use for the primary service | `ClusterIP` |
4042
| `service.primary.port` | The service port to use for the primary service | `5432` |
4143
| `service.primary.nodePort` | The service nodePort to use for the primary service when `type` is `NodePort` | `null` |
@@ -373,7 +375,7 @@ bootstrapFromBackup:
373375
Restoring a different deployment using an existing deployment is possible, but can be dangerous,
374376
as at this point you may be having 2 deployments pointing to the same S3 bucket/path.
375377
Therefore, `bootstrapFromBackup.repo1-path` is required to be set.
376-
378+
377379
If there are any other changes to be made, for example the bucket itself, you can create a secret containing that
378380
information, for example:
379381

charts/timescaledb-single/scripts/prestop.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ CHECKPOINT;
6060
SELECT 'We are a primary: Successfully invoked checkpoints, now issuing a switchover.';
6161
\! curl -s http://localhost:8008/switchover -XPOST -d '{"leader": "$(hostname)"}'
6262
\endif
63+
64+
\if :linkerdShutdown
65+
\! curl -s -m 5 -X POST http://localhost:4191/shutdown
66+
\endif

charts/timescaledb-single/templates/configmap-scripts.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ data:
3333
{{- .Files.Get "scripts/patroni_callback.sh" | nindent 4 }}
3434
lifecycle_preStop.sql: |-
3535
{{- .Files.Get "scripts/prestop.sql" | nindent 4 }}
36-
...

charts/timescaledb-single/templates/statefulset-timescaledb.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ spec:
113113
command:
114114
- psql
115115
- -X
116+
- --set=linkerdShutdown="{{ if and .Values.linkerd.enabled .Values.linkerd.terminateAfterCheckpoint }}1{{else}}0{{end}}"
116117
- --file
117118
- "{{ template "scripts_dir" . }}/lifecycle_preStop.sql"
118119
# When reusing an already existing volume it sometimes happens that the permissions

charts/timescaledb-single/values.schema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@
226226
},
227227
"type": "object"
228228
},
229+
"linkerd": {
230+
"additionalProperties": false,
231+
"properties": {
232+
"enabled": {
233+
"type": [
234+
"boolean"
235+
]
236+
},
237+
"terminateAfterCheckpoint": {
238+
"type": [
239+
"boolean"
240+
]
241+
}
242+
},
243+
"type": "object"
244+
},
229245
"enabled": {
230246
"additionalProperties": true
231247
},
@@ -818,6 +834,7 @@
818834
"fullnameOverride",
819835
"image",
820836
"curlImage",
837+
"linkerd",
821838
"networkPolicy",
822839
"nodeSelector",
823840
"patroni",

charts/timescaledb-single/values.schema.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ required:
1818
- fullnameOverride
1919
- image
2020
- curlImage
21+
- linkerd
2122
- networkPolicy
2223
- nodeSelector
2324
- patroni
@@ -432,6 +433,14 @@ properties:
432433
type:
433434
- string
434435
- "null"
436+
linkerd:
437+
type: object
438+
additionalProperties: false
439+
properties:
440+
enabled:
441+
type: boolean
442+
terminateAfterCheckpoint:
443+
type: boolean
435444
env:
436445
type:
437446
- array

charts/timescaledb-single/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,3 +597,11 @@ debug:
597597
# This command will be executed *before* the main container starts. In the
598598
# example below, we can mimick a slow restore by sleeping for 5 minutes before starting
599599
execStartPre: # sleep 300
600+
601+
# Support for specific use cases when deploying with the linkerd service mesh.
602+
linkerd:
603+
enabled: false
604+
# As part of the statefulset pod's `lifecycle.preStop`, call the local linkerd sidecar
605+
# to cleanly terminate the proxy. If this is not performed, then the proxy will remain
606+
# alive unnecessarily, blocking pod termination for a period of time.
607+
terminateAfterCheckpoint: true

0 commit comments

Comments
 (0)