From 576292de8b1b9740cea07a72e00342103fc52cd3 Mon Sep 17 00:00:00 2001 From: ckm007 Date: Fri, 4 Oct 2024 17:52:36 +0530 Subject: [PATCH 1/2] [DSD-6382] adding fixes for issues reported during dev round Signed-off-by: ckm007 --- deploy/.gitignore | 1 + deploy/README.md | 1 - deploy/initialise-prereq.sh | 19 +++++++++++--- deploy/install-prereq.sh | 3 +-- deploy/postgres/.postgres-init.sh.swp | Bin 0 -> 1024 bytes deploy/postgres/postgres-init.sh | 2 +- deploy/redis/install.sh | 34 ++++++++++++++++++++++---- helm/esignet/values.yaml | 8 +++--- 8 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 deploy/.gitignore create mode 100644 deploy/postgres/.postgres-init.sh.swp diff --git a/deploy/.gitignore b/deploy/.gitignore new file mode 100644 index 000000000..5440660c2 --- /dev/null +++ b/deploy/.gitignore @@ -0,0 +1 @@ +esignet-global-cm.yaml diff --git a/deploy/README.md b/deploy/README.md index beb32572f..eb16098e4 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -25,7 +25,6 @@ * __Monitoring__ : Setup monitoring consisting elasticsearch, kibana, grafana using [steps](https://github.com/mosip/k8s-infra/tree/v1.2.0.2/monitoring). ### Install Pre-requisites * `esignet-global` configmap: For eSignet K8's env, `esignet-global` configmap in `esignet` namespace contains Domain related information. Follow below steps to add domain details for `esignet-global` configmap. - * Make sure kubeconfig file is already set and k8 cluster is accessible and kubectl is installed. * Copy `esignet-global-cm.yaml.sample` to `esignet-global-cm.yaml`. * Update the domain names in `esignet-global-cm.yaml` correctly for your environment. * Install pre-requisites diff --git a/deploy/initialise-prereq.sh b/deploy/initialise-prereq.sh index a8259252f..e5723ab93 100755 --- a/deploy/initialise-prereq.sh +++ b/deploy/initialise-prereq.sh @@ -48,11 +48,22 @@ function initialising_Prerequisites() { echo Please enter the recaptcha admin secret key for domain $ESIGNET_HOST read ESECRET_KEY - echo Setting up captcha secrets - kubectl -n $NS create secret generic esignet-captcha --from-literal=esignet-captcha-site-key=$ESITE_KEY --from-literal=esignet-captcha-secret-key=$ESECRET_KEY --dry-run=client -o yaml | kubectl apply -f - +while true; do + read -p "Do you want to continue configuring Captcha secrets for esignet ? (y/n) : " ans + if [ $ans='Y' ] || [ $ans='y' ]; then + echo "Please create captcha site and secret key for esignet domain: esignet.sandbox.xyz.net" + echo "Setting up captcha secrets" + kubectl -n $NS create secret generic esignet-captcha --from-literal=esignet-captcha-site-key=$ESITE_KEY --from-literal=esignet-captcha-secret-key=$ESECRET_KEY --dry-run=client -o yaml | kubectl apply -f - + + echo Setting up dummy values for esignet misp license key + kubectl -n $NS create secret generic esignet-misp-onboarder-key --from-literal=mosip-esignet-misp-key='' --dry-run=client -o yaml | kubectl apply -f - + elif [ "$ans" = "N" ] || [ "$ans" = "n" ]; then + exit 1 + else + echo "Please provide a correct option (Y or N)" + fi +done - echo Setting up dummy values for esignet misp license key - kubectl -n $NS create secret generic esignet-misp-onboarder-key --from-literal=mosip-esignet-misp-key='' --dry-run=client -o yaml | kubectl apply -f - echo "All prerequisite services initialised successfully." return 0 diff --git a/deploy/install-prereq.sh b/deploy/install-prereq.sh index b74765fc9..dc5d4441d 100755 --- a/deploy/install-prereq.sh +++ b/deploy/install-prereq.sh @@ -37,13 +37,12 @@ function installing_prerequisites() { ["softhsm"]="Do you want to install softhsm for esignet service in softhsm namespace? Opt "n" in case it already exists in Softhsm namespace: " ["keycloak"]="Do you want to deploy keycloak in the keycloak namespace? Opt "n" in case it already exists in keycloak namespace : " ["kafka"]="Do you want to deploy Kafka in the kafka namespace? Opt "n" in case it already exists in kafka namespace : " - ["redis"]="Do you want to deploy redis in Redis namespace? Opt "n" in case it already exists in Redis namespace : " ) echo "Installing prerequisite services" for module in "${modules[@]}"; do - if [ "$module" == "istio-gateway" ] || [ "$module" == "postgres" ]; then + if [ "$module" == "istio-gateway" ] || [ "$module" == "postgres" ] || [ "$module" == "redis" ]; then cd "$ROOT_DIR/$module" ./install.sh elif [[ -n "${prompts[$module]}" ]]; then diff --git a/deploy/postgres/.postgres-init.sh.swp b/deploy/postgres/.postgres-init.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..1521d8eb2bde28879d06cfa52b76c28b6ae4816d GIT binary patch literal 1024 zcmYc?$V<%2S1{4DU_b%8^%xmSQj;_C@^wutEm5Q}I1qI}Wx76zC7C6qDXF@~CPoGr k>I(9UOVW!{i}hg)-ORkq620OK43(n-qaiRF0`v$00FI6r!~g&Q literal 0 HcmV?d00001 diff --git a/deploy/postgres/postgres-init.sh b/deploy/postgres/postgres-init.sh index 91029570f..aeb6d538d 100755 --- a/deploy/postgres/postgres-init.sh +++ b/deploy/postgres/postgres-init.sh @@ -16,7 +16,7 @@ function initialize_db() { if [ "$ans" = "Y" ] || [ "$ans" = "y" ]; then break elif [ "$ans" = "N" ] || [ "$ans" = "n" ]; then - exit + exit 1 else echo "Please provide a correct option (Y or N)" fi diff --git a/deploy/redis/install.sh b/deploy/redis/install.sh index 7a33fd5ae..9bf297b73 100755 --- a/deploy/redis/install.sh +++ b/deploy/redis/install.sh @@ -6,13 +6,37 @@ if [ $# -ge 1 ] ; then export KUBECONFIG=$1 fi -NS=redis -CHART_VERSION=17.3.14 +function installing_redis() { -echo Create $NS namespace -kubectl create ns $NS + while true; do + read -p "Do you want to install Redis in redis namespace? (y/n) :" ans + if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then + read -p "Please confirm if redis-config is already present in redis namespace. (y/n):" response + if [ "$response" = "Y" ] || [ "$response" = "y" ]; then + echo "Skipping Redis installation as well as redis-config creation." + exit 1 + elif [ "$response" = "N" ] || [ "$response" = "n" ]; then + echo "Skipping Redis installation and continuing with redis-config creation." + kubectl apply -f redis-config.yaml + echo "redis-config configmap creation completed." + exit 1 + else + echo "Incorrect response. Please re-execute the redis installation script." + exit 1 + fi + elif [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then + break + else + echo "Please provide a correct option (Y or N)" + fi + done + + NS=redis + CHART_VERSION=17.3.14 + + echo Create $NS namespace + kubectl create ns $NS || true -function installing_redis() { echo Istio label kubectl label ns $NS istio-injection=enabled --overwrite diff --git a/helm/esignet/values.yaml b/helm/esignet/values.yaml index d2d6a0d34..62a8cf442 100644 --- a/helm/esignet/values.yaml +++ b/helm/esignet/values.yaml @@ -273,22 +273,22 @@ extraEnvVars: | - name: DATABASE_HOST valueFrom: configMapKeyRef: - name: postgres-config + name: esignet-postgres-config key: database-host - name: DATABASE_PORT valueFrom: configMapKeyRef: - name: postgres-config + name: esignet-postgres-config key: database-port - name: DATABASE_NAME valueFrom: configMapKeyRef: - name: postgres-config + name: esignet-postgres-config key: database-name - name: DATABASE_USERNAME valueFrom: configMapKeyRef: - name: postgres-config + name: esignet-postgres-config key: database-username - name: DB_DBUSER_PASSWORD valueFrom: From 7a751a08528dec6689f50c473f7cac432fea76b5 Mon Sep 17 00:00:00 2001 From: ckm007 Date: Fri, 4 Oct 2024 17:57:32 +0530 Subject: [PATCH 2/2] [DSD-6382] removing swp file added by mistake Signed-off-by: ckm007 --- deploy/postgres/.gitignore | 1 + deploy/postgres/.postgres-init.sh.swp | Bin 1024 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100644 deploy/postgres/.postgres-init.sh.swp diff --git a/deploy/postgres/.gitignore b/deploy/postgres/.gitignore index 5e1d061c3..38b1baeae 100644 --- a/deploy/postgres/.gitignore +++ b/deploy/postgres/.gitignore @@ -1,3 +1,4 @@ db-common-secrets.yaml esignet-postgres-postgresql.yaml postgres-host.yaml +.*.swp diff --git a/deploy/postgres/.postgres-init.sh.swp b/deploy/postgres/.postgres-init.sh.swp deleted file mode 100644 index 1521d8eb2bde28879d06cfa52b76c28b6ae4816d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{4DU_b%8^%xmSQj;_C@^wutEm5Q}I1qI}Wx76zC7C6qDXF@~CPoGr k>I(9UOVW!{i}hg)-ORkq620OK43(n-qaiRF0`v$00FI6r!~g&Q