Skip to content

Commit

Permalink
[MOSIP-34233] added deploy scripts for admin services
Browse files Browse the repository at this point in the history
Signed-off-by: ckm007 <[email protected]>
  • Loading branch information
ckm007 committed Jul 16, 2024
1 parent 5698f40 commit 0177314
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 49 deletions.
1 change: 0 additions & 1 deletion deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
```
./install.sh
```

## Admin proxy
Admin service accesses other services like Materdata and Keymanager and currently there is only one URL that is used to connect to both these services. This will get fixed in future versions, but as a an interim solution, Admin Proxy docker has been created, which is basically an Nginx proxy connecting to the above services with these URLs:
```
Expand Down
3 changes: 3 additions & 0 deletions deploy/copy_cm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
# DST_NS: Destination namespace

function copying_cm() {
UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh
COPY_UTIL=./copy_cm_func.sh
DST_NS=admin

wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh

$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
Expand Down
33 changes: 0 additions & 33 deletions deploy/copy_cm_func.sh

This file was deleted.

25 changes: 25 additions & 0 deletions deploy/copy_cm_kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination namespace

function copying_cm() {
UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh
COPY_UTIL=./copy_cm_func.sh
DST_NS=kernel

wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh

$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
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
copying_cm # calling function

7 changes: 4 additions & 3 deletions deploy/delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ function deleting_admin() {
read -p "Are you sure you want to delete ALL Admin helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
kubectl delete -n $NS -f admin-proxy.yaml
kubectl delete -n $NS -f admin-proxy.yaml
helm -n $NS delete admin-hotlist
helm -n $NS delete admin-service
helm -n $NS delete admin-ui
helm -n $KNS delete otpmanager
helm -n $KNS delete masterdata
break
else
break
Expand All @@ -30,4 +31,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
deleting_admin # calling function
deleting_admin # calling function
20 changes: 8 additions & 12 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ if [ $# -ge 1 ] ; then
fi

NS=admin
NS_KERNEL=kernel
CHART_VERSION=12.1.0
ADMIN_UI_CHART_VERSION=12.0.1
CHART_VERSION=12.0.1-develop

echo Create $NS namespace
kubectl create ns $NS
Expand All @@ -30,26 +28,24 @@ function installing_admin() {
echo Installing Admin-Proxy into Masterdata and Keymanager.
kubectl -n $NS apply -f admin-proxy.yaml

ADMIN_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-admin-host})
echo Installing masterdata and allowing Admin UI to access masterdata services.
helm -n $KNS install masterdata mosip/masterdata --set istio.corsPolicy.allowOrigins\[0\].exact=https://$ADMIN_HOST --version $CHART_VERSION

echo Installing syncdata
helm -n $KNS install syncdata mosip/syncdata --version $CHART_VERSION

echo Installing admin hotlist service.
helm -n $NS install admin-hotlist mosip/admin-hotlist --version $CHART_VERSION

echo Installing admin service. Will wait till service gets installed.
helm -n $NS install admin-service mosip/admin-service --set istio.corsPolicy.allowOrigins\[0\].prefix=https://$ADMIN_HOST --wait --version $CHART_VERSION

echo Installing admin-ui
helm -n $NS install admin-ui mosip/admin-ui --set admin.apiUrl=https://$API_HOST/v1/ --set istio.hosts\[0\]=$ADMIN_HOST --version $ADMIN_UI_CHART_VERSION

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Installed admin services

echo "Admin portal URL: https://$ADMIN_HOST/admin-ui/"

echo Installing masterdata and allowing Admin UI to access masterdata services.
helm -n $NS_KERNEL install masterdata mosip/masterdata --set istio.corsPolicy.allowOrigins\[0\].exact=https://$ADMIN_HOST --version $CHART_VERSION

echo Installing syncdata
helm -n $NS_KERNEL install syncdata mosip/syncdata --version $CHART_VERSION
return 0
}

Expand Down

0 comments on commit 0177314

Please sign in to comment.