From 64a5cd6f038183557a9106810bf83130fdc5c9a2 Mon Sep 17 00:00:00 2001 From: Abhi Date: Tue, 17 Dec 2024 21:48:51 +0530 Subject: [PATCH] [MOSIP-38169] Updated scripts for pmp-revamp Signed-off-by: Abhi --- deploy/pmp-revamp-ui/README.md | 16 ++++++++++ deploy/pmp-revamp-ui/delete.sh | 30 +++++++++++++++++++ deploy/pmp-revamp-ui/install.sh | 53 +++++++++++++++++++++++++++++++++ deploy/pmp-revamp-ui/restart.sh | 25 ++++++++++++++++ deploy/pmp-ui/delete.sh | 1 - deploy/pmp-ui/install.sh | 12 -------- 6 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 deploy/pmp-revamp-ui/README.md create mode 100644 deploy/pmp-revamp-ui/delete.sh create mode 100644 deploy/pmp-revamp-ui/install.sh create mode 100644 deploy/pmp-revamp-ui/restart.sh diff --git a/deploy/pmp-revamp-ui/README.md b/deploy/pmp-revamp-ui/README.md new file mode 100644 index 000000000..623501c07 --- /dev/null +++ b/deploy/pmp-revamp-ui/README.md @@ -0,0 +1,16 @@ +# Partner Management portal + +## Install +```sh +./install.sh +``` + +## Restart +```sh +./restart.sh +``` + +## Delete +```sh +./delete.sh +``` diff --git a/deploy/pmp-revamp-ui/delete.sh b/deploy/pmp-revamp-ui/delete.sh new file mode 100644 index 000000000..cf92de7ac --- /dev/null +++ b/deploy/pmp-revamp-ui/delete.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Uninstalls all pms ui helm charts +## Usage: ./delete.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function deleting_pmp_ui() { + NS=pms + while true; do + read -p "Are you sure you want to delete all pms helm charts?(Y/n) " yn + if [ $yn = "Y" ] + then + helm -n $NS delete pmp-revamp-ui + break + else + break + fi + done + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +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 +deleting_pmp_ui # calling function \ No newline at end of file diff --git a/deploy/pmp-revamp-ui/install.sh b/deploy/pmp-revamp-ui/install.sh new file mode 100644 index 000000000..c5cc39ef3 --- /dev/null +++ b/deploy/pmp-revamp-ui/install.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Installs all PMS UI charts +## Usage: ./install.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +NS=pms +CHART_VERSION=0.0.1-develop +COPY_UTIL=../copy_cm_func.sh + +echo Create $NS namespace +kubectl create ns $NS + +function installing_pmp_revamp_ui() { + echo Istio label + kubectl label ns $NS istio-injection=enabled --overwrite + helm repo update + + echo Copy configmaps + $COPY_UTIL configmap global default $NS + $COPY_UTIL configmap artifactory-share artifactory $NS + $COPY_UTIL configmap config-server-share config-server $NS + + INTERNAL_API_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-api-internal-host}) + PMP_REVAMP_UI_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-pmp-revamp-ui-host}) + + PARTNER_MANAGER_SERVICE_NAME="pms-partner" + POLICY_MANAGER_SERVICE_NAME="pms-policy" + + echo Installing pmp-revamp-ui + helm -n $NS install pmp-revamp-ui mosip/pmp-revamp-ui \ + --set pmp_revamp.react_app_partner_manager_api_base_url="https://$INTERNAL_API_HOST/v1/partnermanager" \ + --set pmp_revamp.react_app_policy_manager_api_base_url="https://$INTERNAL_API_HOST/v1/policymanager" \ + --set pmp_revamp.pms_partner_manager_internal_service_url="http://$PARTNER_MANAGER_SERVICE_NAME.$NS/v1/partnermanager" \ + --set pmp_revamp.pms_policy_manager_internal_service_url="http://$POLICY_MANAGER_SERVICE_NAME.$NS/v1/policymanager" \ + --set istio.hosts=["$PMP_REVAMP_UI_HOST"] --version $CHART_VERSION + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Installed pmp-revamp-ui services + + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +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_pmp_ui # calling function \ No newline at end of file diff --git a/deploy/pmp-revamp-ui/restart.sh b/deploy/pmp-revamp-ui/restart.sh new file mode 100644 index 000000000..59a8fff19 --- /dev/null +++ b/deploy/pmp-revamp-ui/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Restart the pms services +## Usage: ./restart.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function Restarting_pmp_ui() { + NS=pms + kubectl -n $NS rollout restart deploy + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Restarted pmp ui services + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +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 +Restarting_pmp_ui # calling function \ No newline at end of file diff --git a/deploy/pmp-ui/delete.sh b/deploy/pmp-ui/delete.sh index dc82680c3..9a081e3e8 100755 --- a/deploy/pmp-ui/delete.sh +++ b/deploy/pmp-ui/delete.sh @@ -13,7 +13,6 @@ function deleting_pmp_ui() { if [ $yn = "Y" ] then helm -n $NS delete pmp-ui - helm -n $NS delete pmp-revamp-ui break else break diff --git a/deploy/pmp-ui/install.sh b/deploy/pmp-ui/install.sh index 3a0568878..86df9e8e0 100755 --- a/deploy/pmp-ui/install.sh +++ b/deploy/pmp-ui/install.sh @@ -25,22 +25,10 @@ function installing_pmp_ui() { INTERNAL_API_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-api-internal-host}) PMP_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-pmp-host}) - PMP_NEW_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-pmp-revamp-ui-new-host}) - - PARTNER_MANAGER_SERVICE_NAME="pms-partner" - POLICY_MANAGER_SERVICE_NAME="pms-policy" echo Installing pmp-ui helm -n $NS install pmp-ui mosip/pmp-ui --set pmp.apiUrl=https://$INTERNAL_API_HOST/ --set istio.hosts=["$PMP_HOST"] --version $CHART_VERSION - echo Installing pmp-revamp-ui-new - helm -n $NS install pmp-revamp-ui mosip/pmp-revamp-ui \ - --set pmp_new.react_app_partner_manager_api_base_url="https://$INTERNAL_API_HOST/v1/partnermanager" \ - --set pmp_new.react_app_policy_manager_api_base_url="https://$INTERNAL_API_HOST/v1/policymanager" \ - --set pmp_new.pms_partner_manager_internal_service_url="http://$PARTNER_MANAGER_SERVICE_NAME.$NS/v1/partnermanager" \ - --set pmp_new.pms_policy_manager_internal_service_url="http://$POLICY_MANAGER_SERVICE_NAME.$NS/v1/policymanager" \ - --set istio.hosts=["$PMP_NEW_HOST"] --version $CHART_VERSION - kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status echo Installed pmp ui services