Skip to content

Commit 5bf8616

Browse files
committed
*: specify clusterName and bump tsdb chart
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
1 parent 89df39f commit 5bf8616

File tree

5 files changed

+45
-13
lines changed

5 files changed

+45
-13
lines changed

chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ keywords:
1212
- monitoring
1313
- tracing
1414
- opentelemetry
15-
version: 19.0.0
15+
version: 20.0.0
1616
# TODO(paulfantom): Enable after kubernetes 1.22 reaches EOL (2022-10-28)
1717
# kubeVersion: ">= 1.23.0"
1818
dependencies:
1919
- name: timescaledb-single
2020
condition: timescaledb-single.enabled
21-
version: 0.24.1
21+
version: 0.27.2
2222
repository: https://charts.timescale.com
2323
- name: promscale
2424
condition: promscale.enabled
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
: "${NAMESPACE:="default"}"
4+
: "${DB_SECRET_NAME:="tobs-credentials"}"
5+
: "${PROMSCALE_SECRET_NAME:="tobs-promscale-connection"}"
6+
7+
while ! kubectl get secret "${DB_SECRET_NAME}" --namespace "${NAMESPACE}"; do
8+
echo "Waiting for ${DB_SECRET_NAME} secret."
9+
sleep 1
10+
done
11+
PASS="$(kubectl get secret --namespace "${NAMESPACE}" "${DB_SECRET_NAME}" -o json | jq -r '.data["PATRONI_SUPERUSER_PASSWORD"]')"
12+
13+
kubectl get secret --namespace "${NAMESPACE}" "${PROMSCALE_SECRET_NAME}" -o json | jq --arg PASS "$PASS" '.data["PROMSCALE_DB_PASSWORD"]=$PASS' | kubectl apply -f -

chart/templates/connection-secret-job.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ metadata:
6868
heritage: {{ .Release.Service }}
6969
stringData:
7070
PROMSCALE_DB_PORT: "5432"
71-
PROMSCALE_DB_HOST: "{{ .Release.Name }}.{{ .Release.Namespace }}.svc"
71+
PROMSCALE_DB_HOST: "{{ tpl $db.clusterName . }}.{{ .Release.Namespace }}.svc"
7272
PROMSCALE_DB_NAME: "postgres"
7373
PROMSCALE_DB_USER: "postgres"
7474
PROMSCALE_DB_SSL_MODE: "require"
@@ -86,13 +86,7 @@ metadata:
8686
heritage: {{ .Release.Service }}
8787
data:
8888
password-initializer.sh: |
89-
#!/bin/bash
90-
while ! kubectl get secret {{ .Release.Name }}-credentials --namespace {{ template "tobs.namespace" . }}; do
91-
echo "Waiting for {{ .Release.Name }}-credentials secret."
92-
sleep 1
93-
done
94-
PASS=$(kubectl get secret --namespace {{ template "tobs.namespace" . }} {{ .Release.Name }}-credentials -o json | jq -r '.data["PATRONI_SUPERUSER_PASSWORD"]')
95-
kubectl get secret --namespace {{ template "tobs.namespace" . }} {{ .Values.promscale.connectionSecretName }} -o json | jq --arg PASS "$PASS" '.data["PROMSCALE_DB_PASSWORD"]=$PASS' | kubectl apply -f -
89+
{{- $.Files.Get "scripts/password-initializer.sh" | nindent 4 }}
9690
---
9791
apiVersion: batch/v1
9892
kind: Job
@@ -111,6 +105,15 @@ spec:
111105
- name: copier
112106
image: bitnami/kubectl:latest
113107
command: [ '/scripts/password-initializer.sh' ]
108+
env:
109+
- name: NAMESPACE
110+
valueFrom:
111+
fieldRef:
112+
fieldPath: metadata.namespace
113+
- name: DB_SECRET_NAME
114+
value: {{ tpl $db.clusterName . }}-credentials
115+
- name: PROMSCALE_SECRET_NAME
116+
value: {{ .Values.promscale.connectionSecretName }}
114117
volumeMounts:
115118
- name: promscale-initializer
116119
mountPath: /scripts

chart/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ timescaledb-single:
1515
repository: timescale/timescaledb-ha
1616
tag: pg14.5-ts2.8.1-p2
1717
pullPolicy: IfNotPresent
18+
19+
clusterName: "{{ .Release.Name }}-tsdb"
1820
env:
1921
- name: TSTUNE_PROFILE
2022
value: promscale

docs/upgrades.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
# Upgrading tobs using helm (without tobs CLI)
2-
3-
The following steps are necessary if using helm without the tobs CLI. The tobs CLI will handle these upgrade tasks automatically for you.
1+
# Upgrading tobs
42

53
Firstly upgrade the helm repo to pull the latest available tobs helm chart. We always recommend upgrading to the [latest](https://github.com/timescale/tobs/releases/latest) tobs stack available.
64

75
```shell
86
helm repo update
97
```
108

9+
## Upgrading from 19.x to 20.x
10+
11+
Version 20 of tobs is specifying `clusterName` for timescaledb resources. This is required to make seamless connection
12+
string propagation work out of the box with version 0.27+ of timescaledb helm chart. Since tobs is now specifying
13+
`clusterName` in values file, we took this opportunity to also change the default `clusterName` to `{{ .Release.Name }}-tsdb`.
14+
This allows easier operations on the installed cluster as the objects are clearly associated with particular component.
15+
16+
Sadly this is a breaking change for users who are using tobs with version 0.26 or lower of timescaledb helm chart.
17+
If you are using tobs with version 0.26 or lower of timescaledb helm chart and you don't want to manually migrate
18+
your timescaledb resources, you can specify the following option in your `values.yaml` file.
19+
20+
```yaml
21+
timescaledb-single:
22+
clusterName: "{{ .Release.Name }}"
23+
```
24+
1125
## Upgrading from 18.x to 19.x
1226
1327
There is a breaking change in [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-41x-to-42x).

0 commit comments

Comments
 (0)