Skip to content

Commit 2cacbc9

Browse files
authored
fix(snapshotAgent): set BAO_ADDR to active service when running a clu… (#129)
* fix(snapshotAgent): add test Signed-off-by: flostru <fs@collabs.de> * fix(snapshotAgent): scale up replicaset in acceptance test Signed-off-by: flostru <fs@collabs.de> * fix(snapshotagent): catch edge case ha without active service Signed-off-by: flostru <fs@collabs.de> * doc(snapshotAgent): correct CHANGELOG entry Signed-off-by: flostru <fs@collabs.de> --------- Signed-off-by: flostru <fs@collabs.de>
1 parent 22eb19f commit 2cacbc9

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Unreleased
22

3+
## 0.23.5
4+
5+
- fix(snapshotAgent): set BAO_ADDR to active service when running a cluster
6+
37
## 0.23.4
48

59
- fix(snapshotAgent): don't create service account if disabled

charts/openbao/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
apiVersion: v2
55
name: openbao
6-
version: 0.23.4
6+
version: 0.23.5
77
appVersion: v2.4.4
88
kubeVersion: ">= 1.30.0-0"
99
description: Official OpenBao Chart
@@ -28,7 +28,7 @@ annotations:
2828
artifacthub.io/changes: |
2929
- kind: fixed
3030
description: |
31-
fix(snapshotAgent): don't create service account if disabled
31+
fix(snapshotAgent): set BAO_ADDR to active service when running a cluster
3232
3333
maintainers:
3434
- name: OpenBao

charts/openbao/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# openbao
22

3-
![Version: 0.23.4](https://img.shields.io/badge/Version-0.23.4-informational?style=flat-square) ![AppVersion: v2.4.4](https://img.shields.io/badge/AppVersion-v2.4.4-informational?style=flat-square)
3+
![Version: 0.23.5](https://img.shields.io/badge/Version-0.23.5-informational?style=flat-square) ![AppVersion: v2.4.4](https://img.shields.io/badge/AppVersion-v2.4.4-informational?style=flat-square)
44

55
Official OpenBao Chart
66

charts/openbao/templates/snapshotagent-configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ data:
2323
BAO_ROLE: {{ .Values.snapshotAgent.config.baoRole }}
2424
{{- if include "openbao.externalAddr" . }}
2525
BAO_ADDR: "{{ include "openbao.externalAddr" . }}"
26+
{{- else if and (eq .mode "ha") (eq (.Values.server.service.active.enabled | toString) "true")}}
27+
BAO_ADDR: {{ include "openbao.scheme" . }}://{{ template "openbao.fullname" . }}-active.{{ include "openbao.namespace" . }}.svc:{{ .Values.server.service.port }}
2628
{{- else }}
2729
BAO_ADDR: {{ include "openbao.scheme" . }}://{{ template "openbao.fullname" . }}.{{ include "openbao.namespace" . }}.svc:{{ .Values.server.service.port }}
2830
{{- end }}

test/acceptance/snapshot.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ EOF
7070
# redeploy with snapshotAgent enabled
7171
helm upgrade --install "$(name_prefix)" . --set injector.enabled=false \
7272
--set server.ha.enabled=true \
73-
--set server.ha.replicas=1 \
73+
--set server.ha.replicas=3 \
7474
--set server.ha.raft.enabled=true \
7575
--set snapshotAgent.enabled=true \
7676
--set snapshotAgent.config.s3Bucket=openbao-snapshots \
@@ -113,7 +113,7 @@ initialize() {
113113
# install openbao
114114
helm install "$(name_prefix)" . --set injector.enabled=false \
115115
--set server.ha.enabled=true \
116-
--set server.ha.replicas=1 \
116+
--set server.ha.replicas=3 \
117117
--set server.ha.raft.enabled=true
118118
wait_for_running $(name_prefix)-0
119119

test/unit/snapshotagent.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ load _helpers
239239
[ "${actual}" = "http://release-name-openbao.foo.svc:8200" ]
240240
}
241241

242+
@test "snapshot/configmap: specify baoAddr" {
243+
cd `chart_dir`
244+
local actual=$(helm template \
245+
--show-only templates/snapshotagent-configmap.yaml \
246+
--set 'snapshotAgent.enabled=true' \
247+
--set 'server.ha.enabled=true' \
248+
--namespace foo \
249+
. | tee /dev/stderr |
250+
yq -r '.data.BAO_ADDR' | tee /dev/stderr)
251+
[ "${actual}" = "http://release-name-openbao-active.foo.svc:8200" ]
252+
}
253+
242254
@test "snapshot/configmap: configuration: externalBaoAddr" {
243255
cd `chart_dir`
244256
local actual=$(helm template \

0 commit comments

Comments
 (0)