Skip to content

Commit

Permalink
CLOUDP-204105 Conditionally run the upgrade hook
Browse files Browse the repository at this point in the history
  • Loading branch information
slaskawi committed Mar 21, 2024
1 parent a87bda5 commit 98b2cae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions controllers/construct/mongodbstatefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,13 @@ func getMongoDBImage(version string) string {
func mongodbContainer(version string, volumeMounts []corev1.VolumeMount, additionalMongoDBConfig mdbv1.MongodConfiguration) container.Modification {
filePath := additionalMongoDBConfig.GetDBDataDir() + "/" + automationMongodConfFileName
mongoDbCommand := fmt.Sprintf(`
#run post-start hook to handle version changes
/hooks/version-upgrade
if [ -e "/hooks/version-upgrade" ]; then
#run post-start hook to handle version changes (if exists)
/hooks/version-upgrade
fi
# wait for config and keyfile to be created by the agent
while ! [ -f %s -a -f %s ]; do sleep 3 ; done ; sleep 2 ;
while ! [ -f %s -a -f %s ]; do sleep 3 ; done ; sleep 2 ;
# start mongod with this configuration
exec mongod -f %s;
Expand Down

0 comments on commit 98b2cae

Please sign in to comment.