From 5b79f0646fe7ad4af5cf1c2f09fa93ee722cea7e Mon Sep 17 00:00:00 2001 From: abhishek8shankar Date: Thu, 25 Apr 2024 17:07:28 +0530 Subject: [PATCH] [DSD-5029] Updated scripts for release-0.8.0 Signed-off-by: abhishek8shankar --- helm/inji-web/Chart.yaml | 4 ++-- helm/inji-web/copy_cm.sh | 4 ++-- helm/inji-web/delete.sh | 8 +++---- helm/inji-web/install.sh | 44 ++++++++++++++++++++++++++++++++------- helm/inji-web/restart.sh | 2 +- helm/inji-web/values.yaml | 6 +++--- 6 files changed, 48 insertions(+), 20 deletions(-) diff --git a/helm/inji-web/Chart.yaml b/helm/inji-web/Chart.yaml index 0af13eac..f5c3f32f 100644 --- a/helm/inji-web/Chart.yaml +++ b/helm/inji-web/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 -name: inji-web +name: injiweb description: A Helm chart for MOSIP injiweb UI module type: application -version: 1.0.0 +version: 0.0.1 appVersion: "" dependencies: - name: common diff --git a/helm/inji-web/copy_cm.sh b/helm/inji-web/copy_cm.sh index 462711fa..58ac7ea5 100755 --- a/helm/inji-web/copy_cm.sh +++ b/helm/inji-web/copy_cm.sh @@ -4,12 +4,12 @@ function copying_cm() { COPY_UTIL=./copy_cm_func.sh - DST_NS=esignet + DST_NS=inijiweb $COPY_UTIL configmap global default $DST_NS $COPY_UTIL configmap artifactory-share artifactory $DST_NS $COPY_UTIL configmap config-server-share config-server $DST_NS - $COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS + # $COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS return 0 } diff --git a/helm/inji-web/delete.sh b/helm/inji-web/delete.sh index 91a9184a..31893849 100755 --- a/helm/inji-web/delete.sh +++ b/helm/inji-web/delete.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Uninstalls injiweb-ui helm charts +# Uninstalls injiweb helm charts ## Usage: ./delete.sh [kubeconfig] if [ $# -ge 1 ] ; then @@ -7,12 +7,12 @@ if [ $# -ge 1 ] ; then fi function Deleting_injiweb-ui() { - NS=esignet + NS=injiweb while true; do - read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn + read -p "Are you sure you want to delete all injiweb helm charts?(Y/n) " yn if [ $yn = "Y" ] then - helm -n $NS delete injiweb-ui + helm -n $NS delete injiweb break else break diff --git a/helm/inji-web/install.sh b/helm/inji-web/install.sh index 8c745cf5..e5c6b02f 100755 --- a/helm/inji-web/install.sh +++ b/helm/inji-web/install.sh @@ -6,8 +6,38 @@ if [ $# -ge 1 ] ; then export KUBECONFIG=$1 fi -NS=esignet -CHART_VERSION=1.0.0 +NS=injiweb +CHART_VERSION=0.0.1 + +DEFAULT_MOSIP_INJIWEB_HOST=$( kubectl get cm global -n config-server -o jsonpath={.data.mosip-injiweb-host} ) +# Check if MOSIP_INJIWEB_HOST is present under configmap/global of configserver +if echo "$DEFAULT_MOSIP_INJIWEB_HOST" | grep -q "MOSIP_INJIWEB_HOST"; then + echo "MOSIP_INJIWEB_HOST is already present in configmap/global of configserver" + MOSIP_INJIWEB_HOST=DEFAULT_MOSIP_INJIWEB_HOST +else + read -p "Please provide injiwebhost (eg: injiweb.sandbox.xyz.net ) : " MOSIP_INJIWEB_HOST + + if [ -z "MOSIP_INJIWEB_HOST" ]; then + echo "INJIWEB Host not provided; EXITING;" + exit 0; + fi +fi + +CHK_MOSIP_INJIWEB_HOST=$( nslookup "$MOSIP_INJIWEB_HOST" ) +if [ $? -gt 0 ]; then + echo "Injiweb Host does not exists; EXITING;" + exit 0; +fi + +echo "MOSIP_INJIWEB_HOST is not present in configmap/global of configserver" + # Add injiweb host to global + kubectl patch configmap global -n config-server --type merge -p "{\"data\": {\"mosip-injiweb-host\": \"$MOSIP_INIEB_HOST\"}}" + # Add the host + kubectl set env deployment/config-server SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_MOSIP_ESIGNET_INJIWEB_HOST=$MOSIP_INJIWEB_HOST -n config-server + # Restart the configserver deployment + kubectl -n config-server get deploy -o name | xargs -n1 -t kubectl -n config-server rollout restart + +sleep 400s echo Create $NS namespace kubectl create ns $NS @@ -20,18 +50,16 @@ function installing_inji-web() { helm repo update echo Copy configmaps - # ./copy_cm.sh + ./copy_cm.sh - ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host}) INJI_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-injiweb-host}) echo Installing INJIWEB - helm -n $NS install inji-web mosip/inji-web \ + helm -n $NS install injiweb mosip/inji-web \ -f values.yaml \ - --set esignet_redirect_url=$ESIGNET_HOST \ --set istio.hosts\[0\]=$INJI_HOST \ --version $CHART_VERSION -# kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status echo Installed inji-web return 0 @@ -43,4 +71,4 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errtrace # trace ERR through 'time command' and other functions set -o pipefail # trace ERR through pipes -installing_inji-web # calling function +installing_inji-web # calling function \ No newline at end of file diff --git a/helm/inji-web/restart.sh b/helm/inji-web/restart.sh index 706a2a4c..f4c357ff 100755 --- a/helm/inji-web/restart.sh +++ b/helm/inji-web/restart.sh @@ -7,7 +7,7 @@ if [ $# -ge 1 ] ; then fi function Restarting_oidc-ui() { - NS=esignet + NS=injiweb kubectl -n $NS rollout restart deploy oidc-ui kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status diff --git a/helm/inji-web/values.yaml b/helm/inji-web/values.yaml index 042d2308..b7fd0a61 100755 --- a/helm/inji-web/values.yaml +++ b/helm/inji-web/values.yaml @@ -248,8 +248,8 @@ extraEnvVarsCM: - global - config-server-share - artifactory-share - - softhsm-esignet-share - - oidc-ui + # - softhsm-esignet-share + ## Secret with extra environment variables ## @@ -433,5 +433,5 @@ istio: portName: http port: 80 hosts: - - inji.sandbox.xyz.net + - injiweb.sandbox.xyz.net prefix: /