Skip to content

Commit

Permalink
Merge pull request #184 from DFE-Digital/1681-fix-konduit-for-new-rbac
Browse files Browse the repository at this point in the history
[1681] Add namespace option to konduit
  • Loading branch information
saliceti authored Mar 15, 2024
2 parents 49f6643 + 750756d commit 60a4c77
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/konduit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ help() {
echo

echo "Syntax:"
echo " konduit [-a|-c|-h|-i file-name|-p postgres-var|-r redis-var|-t timeout] app-name -- command [args]"
echo " konduit [-a|-c|-h|-i file-name|-p postgres-var|-r redis-var|-t timeout|-n namespace] app-name -- command [args]"
echo " Connect to the default database for app-name"
echo
echo "or konduit [-a|-c|-h|-i file-name|-r redis-var|-t timeout] -d db-name -k key-vault app-name -- command [args]"
echo "or konduit [-a|-c|-h|-i file-name|-r redis-var|-t timeout|-n namespace] -d db-name -k key-vault app-name -- command [args]"
echo " Connect to a specific database from app-name"
echo " Requires a secret containing the DB URL in the specified Azure KV,"
echo " with name {db-name}-database-url"
Expand All @@ -34,6 +34,7 @@ help() {
echo " postgres://ADMIN_USER:URLENCODED(ADMIN_PASSWORD)@POSTGRES_SERVER_NAME-psql.postgres.database.azure.com:5432/DB_NAME."
echo " The ADMIN_PASSWORD can be url encoded using terraform console "
echo " using CMD: urlencode(ADMIN_PASSWORD)"
echo " -n namespace Namespace where the app can be found. Required in case the user doesn't have cluster admin access."
echo " -p postgres-var Variable for postgres [defaults to DATABASE_URL if not set]"
echo " Only valid for commands psql, pg_dump or pg_restore"
echo " -r redis-var Variable for redis cache [defaults to REDIS_URL if not set]"
Expand Down Expand Up @@ -102,7 +103,9 @@ init_setup() {
fi

# Get the deployment namespace
NAMESPACE=$(kubectl get deployments -A | grep "${INSTANCE} " | awk '{print $1}')
if [[ -z "${NAMESPACE}" ]]; then
NAMESPACE=$(kubectl get deployments -A | grep "${INSTANCE} " | awk '{print $1}')
fi

# Set service ports
DB_PORT=5432
Expand Down Expand Up @@ -251,7 +254,7 @@ cleanup() {
}

# Get the options
while getopts "ahcd:i:k:r:p:t:" option; do
while getopts "ahcd:i:k:r:n:p:t:" option; do
case $option in
a)
AKS="True"
Expand All @@ -268,6 +271,9 @@ while getopts "ahcd:i:k:r:p:t:" option; do
i)
Inputfile=$OPTARG
;;
n)
NAMESPACE=$OPTARG
;;
p)
Postgres=$OPTARG
;;
Expand Down

0 comments on commit 60a4c77

Please sign in to comment.