Skip to content

Commit 1a31bd4

Browse files
author
Jason Schmidt
authored
fix: add in autopw logic inadvertently removed for kube deploys (#200)
* fix: add in autopw logic inadvertently removed for kube deploys * fix: add a bit more depth to output when finding values
1 parent 2393772 commit 1a31bd4

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

bin/start_kube.sh

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,41 +239,59 @@ fi
239239
# project.
240240
#
241241
echo "Checking for required secrets"
242-
if pulumi config get prometheus:adminpass -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
243-
echo "Configuration value found"
242+
243+
# Sirius Accounts Database
244+
if pulumi config get sirius:accounts_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
245+
true
244246
else
245-
echo "Please enter a password for grafana"
246-
pulumi config set prometheus:adminpass --secret -C pulumi/python/kubernetes/secrets
247+
ACCOUNTS_PW=$(createpw)
248+
pulumi config set --secret sirius:accounts_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets $ACCOUNTS_PW
247249
fi
248250

249-
if pulumi config get sirius:accounts_pwd -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
250-
echo "Configuration value found"
251+
# Sirius Ledger Database
252+
if pulumi config get sirius:ledger_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
253+
true
251254
else
252-
echo "Please enter a password for the sirius accountsdb"
253-
pulumi config set sirius:accounts_pwd --secret -C pulumi/python/kubernetes/secrets
255+
LEDGER_PW=$(createpw)
256+
pulumi config set --secret sirius:ledger_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets $LEDGER_PW
254257
fi
255258

256-
if pulumi config get sirius:demo_login_pwd -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
257-
echo "Configuration value found"
259+
if pulumi config get sirius:ledger_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
260+
true
258261
else
259-
echo "Please enter a password for the sirius ledgerdb"
260-
pulumi config set sirius:demo_login_pwd --secret -C pulumi/python/kubernetes/secrets
262+
LEDGER_PW=$(createpw)
263+
pulumi config set --secret sirius:ledger_pwd -C ${script_dir}/../pulumi/python/kubernetes/secrets $LEDGER_PW
261264
fi
262265

263-
if pulumi config get sirius:demo_login_user -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
264-
echo "Configuration value found"
266+
# Admin password for grafana (see note in __main__.py in prometheus project as to why not encrypted)
267+
# This is for the deployment that is setup as part of the the prometheus operator driven prometheus-kube-stack.
268+
#
269+
if pulumi config get prometheus:adminpass -C ${script_dir}/../pulumi/python/config >/dev/null 2>&1; then
270+
echo "Existing password found for grafana admin user"
271+
else
272+
echo "Create a password for the grafana admin user; this password will be used to access the Grafana dashboard"
273+
echo "This should be an alphanumeric string without any shell special characters; it is presented in plain text"
274+
echo "due to current limitations with Pulumi secrets. You will need this password to access the Grafana dashboard."
275+
pulumi config set prometheus:adminpass -C ${script_dir}/../pulumi/python/config
276+
fi
277+
278+
#
279+
# The demo account defaults to testuser/password for credentials; this needs to be fixed in the BoS to allow
280+
# other passwords to be used. Once that is done we can adjust this section.
281+
#
282+
if pulumi config get sirius:demo_login_pwd -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
283+
echo "Existing demo user login found"
265284
else
266-
echo "Please enter a username for the BoS"
267-
pulumi config set sirius:demo_login_user --secret -C pulumi/python/kubernetes/secrets
285+
pulumi config set sirius:demo_login_pwd --secret -C pulumi/python/kubernetes/secrets "password"
268286
fi
269287

270-
if pulumi config get sirius:ledger_pwd -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
271-
echo "Configuration value found"
288+
if pulumi config get sirius:demo_login_user -C "${script_dir}"/../pulumi/python/kubernetes/secrets >/dev/null 2>&1; then
289+
echo "Existing demo user password found"
272290
else
273-
echo "Please enter a password for the BoS user account"
274-
pulumi config set sirius:ledger_pwd --secret -C pulumi/python/kubernetes/secrets
291+
pulumi config set sirius:demo_login_user --secret -C pulumi/python/kubernetes/secrets "testuser"
275292
fi
276293

294+
277295
#
278296
# The default helm timeout for all the projects is set at the default of 300 seconds (5 minutes)
279297
# However, since this code path is most commonly going to be used to deploy locally we need to bump

0 commit comments

Comments
 (0)