Skip to content

Commit

Permalink
Merge pull request #224 from Rakshithb1/MOSIP-36836
Browse files Browse the repository at this point in the history
[MOSIP-36836] added helm chart
  • Loading branch information
sree96 authored Nov 11, 2024
2 parents 8503aaa + 1775b3e commit 1a84ee1
Show file tree
Hide file tree
Showing 48 changed files with 1,222 additions and 49 deletions.
22 changes: 22 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# inji verify services

## Install
* Run `install-all.sh` to deploy inji verify services.
```
cd deploy
./install-all.sh
```

## Delete
* Run `delete-all.sh` to remove inji verify services.
```
cd deploy
./delete-all.sh
```

## Restart
* Run `restart-all.sh` to restart inji verify services.
```
cd deploy
./restart.sh
```
35 changes: 35 additions & 0 deletions deploy/delete-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# deletes inji-verify services in correct order
## Usage: ./delete-all.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Deleting_All() {
ROOT_DIR=`pwd`

declare -a module=("inji-verify-service"
"inji-verify-ui"
)

echo Installing inji-verify services

for i in "${module[@]}"
do
cd $ROOT_DIR/"$i"
./delete.sh
done

echo All inji-verify services deleted sucessfully.
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_All # calling function
16 changes: 16 additions & 0 deletions deploy/inji-verify-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# inji verify service

## Install
```
./install.sh
```

## Restart
```
./restart.sh
```

## Delete
```
./delete.sh
```
1 change: 0 additions & 1 deletion helm/inji-verify/copy_cm.sh → deploy/inji-verify-service/copy_cm.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function copying_cm() {
$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
return 0
}

Expand Down
File renamed without changes.
31 changes: 31 additions & 0 deletions deploy/inji-verify-service/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Uninstalls all inji-verify-service helm charts
## Usage: ./delete.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Deleting_inji-verify-service() {
NS=injiverify
while true; do
read -p "Are you sure you want to delete all inji-verify-service helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete inji-verify-service
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_inji-verify-service # calling function

54 changes: 54 additions & 0 deletions deploy/inji-verify-service/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# Installs all inji-verify-service helm charts
## Usage: ./install.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

NS=injiverify
CHART_VERSION=0.0.1-develop

echo Create $NS namespace
kubectl create ns $NS

function installing_inji-verify-service() {

echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

echo Copy configmaps
./copy_cm.sh

echo "Do you have public domain & valid SSL? (Y/n) "
echo "Y: if you have public domain & valid ssl certificate"
echo "n: If you don't have a public domain and a valid SSL certificate. Note: It is recommended to use this option only in development environments."
read -p "" flag

if [ -z "$flag" ]; then
echo "'flag' was provided; EXITING;"
exit 1;
fi
ENABLE_INSECURE=''
if [ "$flag" = "n" ]; then
ENABLE_INSECURE='--set enable_insecure=true';
fi

echo Installing inji-verify-service
helm -n $NS install inji-verify-service mosip/inji-verify-service --version $CHART_VERSION $ENABLE_INSECURE

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

echo Installed inji-verify-service service
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_inji-verify-service # calling function
24 changes: 24 additions & 0 deletions deploy/inji-verify-service/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Restart the inji-verify-service services

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Restarting_inji-verify-service() {
NS=injiverify
kubectl -n $NS rollout restart deploy inji-verify-service

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

echo Retarted inji-verify-service
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_inji-verify-service # calling function
16 changes: 16 additions & 0 deletions deploy/inji-verify-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# inji verify ui

## Install
```
./install.sh
```

## Restart
```
./restart.sh
```

## Delete
```
./delete.sh
```
21 changes: 21 additions & 0 deletions deploy/inji-verify-ui/copy_cm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination namespace

function copying_cm() {
COPY_UTIL=./copy_cm_func.sh
DST_NS=injiverify

$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
33 changes: 33 additions & 0 deletions deploy/inji-verify-ui/copy_cm_func.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Copy configmap and secret from one namespace to another.
# ./copy_cm_func.sh <resource> <configmap_name> <source_namespace> <destination_namespace> [name]
# Parameters:
# resource: configmap|secret
# name: Optional new name of the configmap or secret in destination namespace. This may be needed if there is
# clash of names

if [ $1 = "configmap" ]
then
RESOURCE=configmap
elif [ $1 = "secret" ]
then
RESOURCE=secret
else
echo "Incorrect resource $1. Exiting.."
exit 1
fi


if [ $# -ge 5 ]
then
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $5
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | sed "s/name: $2/name: $5/g" | kubectl -n $4 create -f -
else
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $2
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | kubectl -n $4 create -f -
fi





4 changes: 2 additions & 2 deletions helm/inji-verify/delete.sh → deploy/inji-verify-ui/delete.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fi
function Deleting_injiverify() {
NS=injiverify
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 inji-verify-ui helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete injiverify
helm -n $NS delete inji-verify-ui
break
else
break
Expand Down
13 changes: 6 additions & 7 deletions helm/inji-verify/install.sh → deploy/inji-verify-ui/install.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
## Installs inji-verify helm charts
## Installs inji-verify-ui helm charts
## Usage: ./install.sh [kubeconfig]

if [ $# -ge 1 ] ; then
Expand All @@ -15,7 +15,7 @@ if echo "$DEFAULT_MOSIP_INJIVERIFY_HOST" | grep -q "MOSIP_INJIVERIFY_HOST"; then
echo "MOSIP_INJIVERIFY_HOST is already present in configmap/global of configserver"
MOSIP_INJIVERIFY_HOST=DEFAULT_MOSIP_INJIVERIFY_HOST
else
read -p "Please provide injiverifyhost (eg: injiVERIFY.sandbox.xyz.net ) : " MOSIP_INJIVERIFY_HOST
read -p "Please provide injiverifyhost (eg: injiverify.sandbox.xyz.net ) : " MOSIP_INJIVERIFY_HOST

if [ -z "MOSIP_INJIVERIFY_HOST" ]; then
echo "INJIVERIFY Host not provided; EXITING;"
Expand All @@ -41,7 +41,7 @@ echo "MOSIP_INJIVERIFY_HOST is not present in configmap/global of configserver"
echo Create $NS namespace
kubectl create ns $NS

function installing_inji-verify() {
function installing_inji-verify-ui() {
echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite

Expand All @@ -53,14 +53,13 @@ function installing_inji-verify() {

INJIVERIFY_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-injiverify-host})
echo Installing INJIVERIFY
helm -n $NS install inji-verify mosip/injiverify \
-f values.yaml \
helm -n $NS install inji-verify-ui mosip/inji-verify-ui \
--set istio.hosts\[0\]=$INJIVERIFY_HOST \
--version $CHART_VERSION

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

echo Installed inji-verify
echo Installed inji-verify-ui
return 0
}

Expand All @@ -70,4 +69,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-verify # calling function
installing_inji-verify-ui # calling function
3 changes: 2 additions & 1 deletion helm/inji-verify/restart.sh → deploy/inji-verify-ui/restart.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ fi

function Restarting_oidc-ui() {
NS=injiverify
kubectl -n $NS rollout restart deploy inji-verify-ui

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

echo Retarted injiverify services
echo Retarted inji-verify-ui
return 0
}

Expand Down
36 changes: 36 additions & 0 deletions deploy/install-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Installs inji-verify services in correct order
## Usage: ./install-all.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

ROOT_DIR=`pwd`

function installing_All() {

declare -a module=("inji-verify-service"
"inji-verify-ui"
)

echo Installing inji-verify services

for i in "${module[@]}"
do
cd $ROOT_DIR/"$i"
./install.sh
done

echo All inji-verify services deployed sucessfully.
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_All # calling function
Loading

0 comments on commit 1a84ee1

Please sign in to comment.