From 926c38b8afbc5b3b7aa909952c72d2b41b0f850f Mon Sep 17 00:00:00 2001 From: Vinicius Niche Date: Sun, 20 Feb 2022 21:30:15 -0300 Subject: [PATCH] fixes up-sample script Signed-off-by: Vinicius Niche --- config/samples/sample_install_dependencies.sh | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/config/samples/sample_install_dependencies.sh b/config/samples/sample_install_dependencies.sh index f85ee425..ff8b7f2b 100755 --- a/config/samples/sample_install_dependencies.sh +++ b/config/samples/sample_install_dependencies.sh @@ -26,29 +26,20 @@ helm repo update echo "Adding installing dependencies..." helm install rabbitmq bitnami/rabbitmq -helm install postgresql --set postgresqlDatabase=horusec_db bitnami/postgresql +helm install postgresql --set auth.database=horusec_db bitnami/postgresql echo "Getting user and pwd of dependencies..." export POSTGRES_USERNAME="postgres" -export POSTGRES_PASSWORD=$(kubectl get secret postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode) +export POSTGRES_PASSWORD=$(kubectl get secret postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode) export RABBITMQ_USERNAME="user" export RABBITMQ_PASSWORD=$(kubectl get secret rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 --decode) export JWT_SECRET="4ff42f67-5929-fc52-65f1-3afc77ad86d5" +export CONFIDENTIAL_CLIENT_SECRET="4ff42f67-5929-fc52-65f1-3afc77ad86d5" -createAnalyticDB() { - echo "Creating horusec_analytic_db..." +# waits for postgres to be ready +kubectl wait --for=condition=ready pod postgresql-0 --timeout 300s - if ! kubectl run postgresql-client --rm --tty -i --restart='Never' --image docker.io/bitnami/postgresql --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql -U $POSTGRES_USERNAME -d horusec_db -p 5432 --no-password -c "create database horusec_analytic_db;"; then - sleep 10 - createAnalyticDB - fi - - echo "horusec_analytic_db created" -} - -sleep 60 - -createAnalyticDB +kubectl run postgresql-client --rm -it --restart='Never' --image docker.io/bitnami/postgresql --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql -U $POSTGRES_USERNAME -d horusec_db -p 5432 --no-password -c "create database horusec_analytic_db;" echo "Creating secrets of dependencies..." kubectl create secret generic horusec-platform-database --from-literal="username=$POSTGRES_USERNAME" --from-literal="password=$POSTGRES_PASSWORD" @@ -57,3 +48,5 @@ kubectl create secret generic horusec-analytic-database --from-literal="username kubectl create secret generic horusec-broker --from-literal="username=$RABBITMQ_USERNAME" --from-literal="password=$RABBITMQ_PASSWORD" kubectl create secret generic horusec-jwt --from-literal=jwt-token=$JWT_SECRET + +kubectl create secret generic horusec-keycloak-client --from-literal="client-secret=$CONFIDENTIAL_CLIENT_SECRET" \ No newline at end of file