Skip to content

Commit

Permalink
Allow the confoguration of the mongodb host, adds flexibility to the … (
Browse files Browse the repository at this point in the history
#113)

* Allow the confoguration of the mongodb host, adds flexibility to the chart

* # This is a combination of 3 commits.
# This is the 1st commit message:

Update update-config-map.sh

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
# The commit message #2 will be skipped:

# Fix wrong review

# The commit message #3 will be skipped:

# Fix if

* Update update-config-map.sh
  • Loading branch information
lvarin authored Jul 11, 2024
1 parent c7c28f8 commit c65300a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions deployment/templates/trs-filer-configmap-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
value: {{ .Values.trs_filer.appName }}
- name: HOST_NAME
value: {{ .Values.host_name }}
- name: MONGO_HOST
value: mongodb-{{ .Values.trs_filer.appName }}
restartPolicy: Never
serviceAccountName: {{ .Values.trs_filer.appName }}-configurer
status: {}
Expand Down
11 changes: 10 additions & 1 deletion update-config-map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ then
env
exit 1
fi

if [ -z "$MONGO_HOST" ];
then
MONGO_HOST='mongodb'
fi

echo "Inputs:"
echo " CONFIG MAP NAME: $CONFIG_MAP_NAME"
echo " API SERVER: $APISERVER"
echo " APP CONFIG PATH: $APP_CONFIG_PATH"
echo " WES APP NAME: $APP_NAME"
echo " HOST NAME: $HOST_NAME"
echo " MONGO_HOST: $MONGO_HOST"

NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)

Expand All @@ -31,9 +38,11 @@ echo "Current Kubernetes namespace: $NAMESPACE"; echo
echo " * Getting current default configuration"

APP_CONFIG=$(yq --arg HOST_NAME "$HOST_NAME" \
--arg MONGO_HOST "$MONGO_HOST" \
'.endpoints.service.url_prefix = "https" |
.endpoints.service.external_host = $HOST_NAME |
.endpoints.service.external_port = 443' \
.endpoints.service.external_port = 443 |
.db.host = $MONGO_HOST' \
"$APP_CONFIG_PATH") || exit 4

echo " * Getting current configMap"
Expand Down

0 comments on commit c65300a

Please sign in to comment.