fix(mongodb): set advertised hostname (#2560)

* test

* print hostname

* change probe

* check

* check

* again

* ry

* check

* test

* try again

* again

* again

* localhost

* test

* test something

* one more tet

* publish address

* emtpy

* tets
This commit is contained in:
Stavros Kois
2022-04-25 14:23:57 +03:00
committed by GitHub
parent dacb4888a1
commit c6d95c4488
3 changed files with 12 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ sources:
- https://github.com/bitnami/bitnami-docker-mongodb
- https://www.mongodb.com
type: application
version: 0.1.5
version: 0.1.6
annotations:
truecharts.org/catagories: |
- database

View File

@@ -15,6 +15,7 @@ data:
# '.script' extension is just to avoid the bitnami init script to executing it. (bitnami executes .sh and .js files automatically)
echo 'use '$MONGODB_DATABASE > /docker-entrypoint-initdb.d/createOpLogUser.script;
echo 'db.createUser({user: "'$MONGODB_USERNAME'-oplog", pwd: "'$MONGODB_PASSWORD'", roles: [ { role: "read", db: "local" } ]})' >> /docker-entrypoint-initdb.d/createOpLogUser.script;
echo 'hostname()' >> /docker-entrypoint-initdb.d/createOpLogUser.script;
echo "Command Generated!";
echo "Creating the user...";

View File

@@ -26,6 +26,7 @@ controller:
service:
main:
publishNotReadyAddresses: true
ports:
main:
port: 27017
@@ -61,7 +62,7 @@ probes:
command:
- /bin/bash
- -ec
- echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port 27017 --quiet
# -- Redainess probe configuration
# @default -- See below
@@ -78,7 +79,8 @@ probes:
command:
- /bin/bash
- -ec
- echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port 27017 --quiet
# -- Startup probe configuration
# @default -- See below
startup:
@@ -93,7 +95,7 @@ probes:
command:
- /bin/bash
- -ec
- echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port 27017 --quiet
mongodbPassword: "testpass"
mongodbUsername: "test"
@@ -102,7 +104,6 @@ mongodbRootPassword: "testroot"
mongodbReplicasetMode: "primary"
mongodbReplicasetName: "rs0"
mongodbReplicasetKey: "testreplicasetkey"
mongodbAdvertisedHostname: "localhost"
existingSecret: ""
envValueFrom:
@@ -124,5 +125,8 @@ env:
MONGODB_DATABASE: "{{ .Values.mongodbDatabase }}"
MONGODB_REPLICA_SET_MODE: "{{ .Values.mongodbReplicasetMode }}"
MONGODB_REPLICA_SET_NAME: "{{ .Values.mongodbReplicasetName }}"
MONGODB_ADVERTISED_HOSTNAME: "{{ .Values.mongodbAdvertisedHostname }}"
MONGODB_ADVERTISED_PORT_NUMBER: "27017"
MONGODB_ADVERTISED_HOSTNAME: "{{ .Release.Name }}"
MONGODB_ADVERTISED_PORT_NUMBER: 27017
MONGODB_INITIAL_PRIMARY_HOST: "{{ .Release.Name }}"
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
MONGODB_ENABLE_JOURNAL: true