Skip to content

Commit 50ffe1a

Browse files
fix: update mongo dependecy, create pre-upgrade job to increase FCV of mongo
1 parent 6933861 commit 50ffe1a

File tree

6 files changed

+88
-41
lines changed

6 files changed

+88
-41
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
dependencies:
22
- name: mongodb
33
repository: https://charts.bitnami.com/bitnami
4-
version: 15.6.26
4+
version: 16.5.11
55
- name: redis
66
repository: https://charts.bitnami.com/bitnami
77
version: 20.2.2
88
- name: mibserver
99
repository: https://pysnmp.github.io/mibs/charts/
10-
version: 1.15.18
11-
digest: sha256:64bdee405118b51b47588ca86fada284233e4beb19c7539635dd833c706e1b4d
12-
generated: "2025-05-21T14:10:06.503084+02:00"
10+
version: 1.15.19
11+
digest: sha256:63eced767b2a3f13d819163a5d91bc7570e9ad7ade67673c5445a5cb4d6c18bd
12+
generated: "2025-05-26T15:52:21.870704+02:00"

charts/splunk-connect-for-snmp/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ appVersion: "1.12.3-beta.2"
2323
#
2424
dependencies:
2525
- name: mongodb
26-
version: ~15.6.0
26+
version: ~16.5.9
2727
repository: https://charts.bitnami.com/bitnami
2828
- name: redis
2929
version: ~20.2.0

charts/splunk-connect-for-snmp/templates/mongodb-6.0-upgrade-job.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{- $configMapName := printf "%s-config" (include "splunk-connect-for-snmp.name" .) }}
2+
{{- $existingRelease := (lookup "v1" "ConfigMap" .Release.Namespace $configMapName) }}
3+
{{- if $existingRelease }}
4+
{{- $chartLabel := index $existingRelease.metadata.labels "helm.sh/chart" }}
5+
{{- $namePrefix := printf "%s-" (include "splunk-connect-for-snmp.name" .) }}
6+
{{- $prevVersion := trimPrefix $namePrefix $chartLabel }}
7+
apiVersion: batch/v1
8+
kind: Job
9+
metadata:
10+
name: mongo-fcv-upgrade-to-7
11+
annotations:
12+
"helm.sh/hook": pre-upgrade
13+
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
14+
spec:
15+
backoffLimit: 1
16+
template:
17+
spec:
18+
containers:
19+
- name: mongo-fcv-check
20+
image: {{ .Values.mongodb.image.repository }}:{{ .Values.mongodb.image.tag }}
21+
command:
22+
- /bin/bash
23+
- -c
24+
- |
25+
set -e
26+
27+
PREV_VERSION="{{ $prevVersion }}"
28+
TARGET_VERSION="{{ .Chart.AppVersion }}"
29+
30+
echo "Previous app version: $PREV_VERSION"
31+
echo "Target app version: $TARGET_VERSION"
32+
33+
if [ "$(printf '%s\n' "$PREV_VERSION" "1.12.3" | sort -V | head -n1)" != "1.12.3" ]; then
34+
echo "ERROR: Cannot upgrade directly from app version $PREV_VERSION to $TARGET_VERSION."
35+
echo "Please upgrade to the intermediate version 1.12.3 first."
36+
echo "You can do it with a command:"
37+
echo "microk8s helm3 upgrade --install snmp -f values.yaml splunk-connect-for-snmp/splunk-connect-for-snmp --namespace=sc4snmp --create-namespace --version 1.12.3" >&2
38+
exit 1
39+
fi
40+
41+
echo "Checking current mongo FCV"
42+
FCV=$(mongosh --host {{ include "splunk-connect-for-snmp.mongodbHost" . | quote }} --quiet --eval 'db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 }).featureCompatibilityVersion.version')
43+
echo "Current Mongo Feature Compatibility Version: $FCV"
44+
45+
if [[ "$FCV" < "7.0" ]]; then
46+
echo "FCV < 7.0, setting to 7.0"
47+
mongosh --host {{ include "splunk-connect-for-snmp.mongodbHost" . | quote }} --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "7.0", confirm: true })'
48+
else
49+
echo "FCV >= 7.0, nothing to be changed"
50+
fi
51+
restartPolicy: Never
52+
{{- end }}

docker_compose/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MIBSERVER_TAG=latest
2424
REDIS_IMAGE=docker.io/bitnami/redis
2525
REDIS_TAG=7.2.1-debian-11-r0
2626
MONGO_IMAGE=docker.io/bitnami/mongodb
27-
MONGO_TAG=6.0.9-debian-11-r5
27+
MONGO_TAG=8.0.9-debian-12-r2
2828

2929
# Splunk instance configuration
3030
SPLUNK_HEC_HOST=

docs/troubleshooting/general-issues.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,33 @@ If the `mongo-fcv-upgrade-to-6` job fails for any reason, there are two recovery
2626
db.adminCommand( { setFeatureCompatibilityVersion: "6.0" })
2727
```
2828
29-
Replace `<mongodb-pod-id>` with the actual Pod ID of your MongoDB instance.
29+
Replace `<mongodb-pod-id>` with the actual Pod ID of your MongoDB instance.
30+
31+
32+
### Upgrading SC4SNMP from 1.12.3 to 1.13.0
33+
34+
When upgrading SC4SNMP from version `1.12.3` to `1.13.0`, the subchart version of MongoDB will be updated from `15.6.26` to `16.5.9`. This upgrade requires an increase in the MongoDB `Feature Compatibility Version (FCV)` from `6.0` to `7.0`.
35+
36+
To facilitate this change, a new pre-upgrade job has been introduced in SC4SNMP: `mongo-fcv-upgrade-to-7`. This job automatically updates the Feature Compatibility Version on MongoDB before the installation of MongoDB version `16.5.9`.
37+
38+
#### Pre-Upgrade Job: `mongo-fcv-upgrade-to-7`
39+
40+
- The `mongo-fcv-upgrade-to-7` job is designed to ensure compatibility by running the FCV update prior to upgrading MongoDB.
41+
42+
#### Handling Job Failures
43+
44+
If the `mongo-fcv-upgrade-to-7` job fails for any reason, there are two recovery options:
45+
46+
1. **Reinstall SC4SNMP**:
47+
48+
[Reinstall SC4SNMP](../../microk8s/sc4snmp-installation#restart-splunk-connect-for-snmp) with **Persistent Volume Claim (PVC) deletion**.
49+
50+
2. **Manually Update MongoDB**:
51+
52+
[Update MongoDB's Feature Compatibility Version](https://www.mongodb.com/docs/manual/release-notes/6.0-upgrade-standalone/#upgrade-procedure) manually by executing the following command:
53+
```bash
54+
microk8s exec -it pod/<mongodb-pod-id> -n sc4snmp mongosh
55+
db.adminCommand( { setFeatureCompatibilityVersion: "7.0", confirm: true })
56+
```
57+
58+
Replace `<mongodb-pod-id>` with the actual Pod ID of your MongoDB instance.

0 commit comments

Comments
 (0)