Skip to content

Commit 5dc6aba

Browse files
committed
[BACKPORT 2.6][platform] Restart pod if the configuration changes
- This adds checksum of the configs.yaml file to pod metadata as annotation. This causes it to change if there are any changes in the configuration, and results in a restart of the pod. https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments - Moving the global-config outside from configs.yaml, as it has a random string in it, which causes a restart everytime as the checksum keeps changing. Test plan: - Deployed platform chart in a Kubernetes cluster without this change. - Upgraded the Helm release with this change (the pod restarts as expected). - Add --set helm.timeout=1000 during the helm upgrade (the pod restarts as expected) - Did another upgrade with same command as above (the pod does not restart as the configuration is the same). Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
1 parent 92a7e35 commit 5dc6aba

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

stable/yugaware/templates/configs.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
# Copyright (c) YugaByte, Inc.
2-
---
3-
apiVersion: v1
4-
kind: ConfigMap
5-
metadata:
6-
name: {{ .Release.Name }}-yugaware-global-config
7-
labels:
8-
app: {{ template "yugaware.name" . }}
9-
chart: {{ template "yugaware.chart" . }}
10-
release: {{ .Release.Name }}
11-
heritage: {{ .Values.helm2Legacy | ternary "Tiller" (.Release.Service | quote) }}
12-
data:
13-
postgres_user: "postgres"
14-
postgres_password: "{{ include "getOrGeneratePassword" (dict "Namespace" .Release.Namespace "Kind" "ConfigMap" "Name" (printf "%s%s" .Release.Name "-yugaware-global-config") "Key" "postgres_password") }}"
15-
postgres_db: "yugaware"
16-
app_secret: "{{ b64enc (randAlphaNum 64) }}"
172

183
---
194
apiVersion: v1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) YugaByte, Inc.
2+
3+
---
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: {{ .Release.Name }}-yugaware-global-config
8+
labels:
9+
app: {{ template "yugaware.name" . }}
10+
chart: {{ template "yugaware.chart" . }}
11+
release: {{ .Release.Name }}
12+
heritage: {{ .Values.helm2Legacy | ternary "Tiller" (.Release.Service | quote) }}
13+
data:
14+
postgres_user: "postgres"
15+
postgres_password: "{{ b64enc (randAlphaNum 8) }}"
16+
postgres_db: "yugaware"
17+
app_secret: "{{ b64enc (randAlphaNum 64) }}"

stable/yugaware/templates/statefulset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ spec:
2020
metadata:
2121
labels:
2222
app: {{ .Release.Name }}-yugaware
23+
annotations:
24+
checksum/config: {{ include (print $.Template.BasePath "/configs.yaml") . | sha256sum }}
2325
spec:
2426
serviceAccountName: {{ .Release.Name }}
2527
imagePullSecrets:

0 commit comments

Comments
 (0)