Skip to content

Commit

Permalink
resolve merge conflit
Browse files Browse the repository at this point in the history
Signed-off-by: kaifk468 <[email protected]>
  • Loading branch information
kaifk468 committed Dec 15, 2024
2 parents a94acf0 + b62821f commit 9fe5b29
Show file tree
Hide file tree
Showing 59 changed files with 1,182 additions and 694 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Repository contains mock implementations for eSignet. Only for non-production us
|[Postgres Init](https://github.com/mosip/mosip-infra/tree/v1.2.0.1-B3/deployment/v3/external/postgres) | 12.0.1-B3 |
|[mock-identity-softhsm](https://github.com/mosip/esignet/blob/v1.0.0/helm/install-all.sh) | 12.0.1-B2 |

### Install Pe-req for mock identity service
### Install Pe-req for mock services
* Install `kubectl` and `helm` utilities.
* Run `prereq.sh` to setup below mentioned pre-requisites for mock services.
* Setup softhsm for mock-identity in `Softhsm` namespace.
Expand All @@ -28,6 +28,7 @@ Repository contains mock implementations for eSignet. Only for non-production us
```
export KUBECONFIG=path/to/kubeconfig.config
```

* Execute installation script:
```
./instll-mock.sh
Expand Down Expand Up @@ -57,7 +58,7 @@ Repository contains mock implementations for eSignet. Only for non-production us
```

## Partner onboarder
* Perform Partner onboarding for esignet mock using [steps](partner-onboarder/README.md).
* Perform Partner onboarding for esignet mock relying party using [steps](partner-onboarder/README.md) only if mosip-identity plugin is used.

## License
This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE).
This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE).
37 changes: 20 additions & 17 deletions deploy/delete-mock.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
#!/bin/bash
# Uninstalls esignet mock services.
## Usage: ./delete.sh [kubeconfig]
# Uninstalls all esignet mock service helm charts
## Usage: ./delete-mock.sh [kubeconfig]

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

Deleting_All() {
MOCK_NS=mockid
NS=esignet
while true; do
read -p "Are you sure you want to delete esignet mock service helm charts?(Y/n) " yn
if [[ $yn = "Y" ]] || [[ $yn = "y" ]];
then
helm -n $NS delete mock-relying-party-service || true
helm -n $NS delete mock-relying-party-ui || true
helm -n $MOCK_NS delete mock-identity-system || true
break
else
break
fi
ROOT_DIR=`pwd`

function deleting_mock() {

declare -a module=("mock-identity-system"
"mock-relying-party-service"
"mock-relying-party-ui"
)

echo Installing esignet mock services

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

echo All esignet mock services deleted sucessfully.
return 0
}

Expand All @@ -30,4 +33,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_All # calling function
deleting_mock # calling function
2 changes: 1 addition & 1 deletion deploy/mock-identity-system/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ $# -ge 1 ] ; then
fi

NS=mockid
CHART_VERSION=0.0.1-develop
CHART_VERSION=0.10.0-develop

echo Create $NS namespace
kubectl create ns $NS
Expand Down
36 changes: 25 additions & 11 deletions deploy/mock-relying-party-service/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

NS=esignet
CHART_VERSION=0.0.1-develop
function installing_mock-relying-party-service() {

echo Create $NS namespace
kubectl create ns $NS
while true; do
read -p "Do you want to install mock relying party service? (y/n): " response
if [[ "$response" == "y" || "$response" == "Y" ]]; then
break
elif [[ "$response" == "n" || "$response" == "N" ]]; then
exit
else
echo "Not a correct response. Please respond with y (yes) or n (no)."
fi
done

helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

NS=esignet
CHART_VERSION=0.10.0-develop

echo Create $NS namespace
kubectl create ns $NS || true

function installing_mock-relying-party-service() {
echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite

Expand All @@ -36,12 +51,11 @@ function installing_mock-relying-party-service() {
ESIGNET_SERVICE_URL=${USER_PROVIDED_ESIGNET_SERVICE_URL:-$DEFAULT_ESIGNET_SERVICE_URL}

echo Installing Mock Relying Party Service
# helm -n $NS install mock-relying-party-service mosip/mock-relying-party-service \
helm -n $NS install mock-relying-party-service ../../helm/mock-relying-party-service/ \
--set mock_relying_party_service.ESIGNET_SERVICE_URL="$ESIGNET_SERVICE_URL" \
--set mock_relying_party_service.ESIGNET_AUD_URL="https://$ESIGNET_HOST/v1/esignet/oauth/v2/token" \
--version $CHART_VERSION $ENABLE_INSECURE \
-f values.yaml --wait
helm -n $NS install mock-relying-party-service mosip/mock-relying-party-service \
--set mock_relying_party_service.ESIGNET_SERVICE_URL="$ESIGNET_SERVICE_URL" \
--set mock_relying_party_service.ESIGNET_AUD_URL="https://$ESIGNET_HOST/v1/esignet/oauth/v2/token" \
--version $CHART_VERSION $ENABLE_INSECURE \
-f values.yaml --wait

kubectl -n $NS get deploy mock-relying-party-service -o name | xargs -n1 -t kubectl -n $NS rollout status

Expand Down
44 changes: 29 additions & 15 deletions deploy/mock-relying-party-ui/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,40 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

NS=esignet
CHART_VERSION=0.0.1-develop
function installing_mock-relying-party-ui() {

read -p "Please provide mock relying party ui domain (eg: healthservices.sandbox.xyz.net ) : " MOCK_UI_HOST
while true; do
read -p "Do you want to install mock relying party ui? (y/n): " response
if [[ "$response" == "y" || "$response" == "Y" ]]; then
break
elif [[ "$response" == "n" || "$response" == "N" ]]; then
exit
else
echo "Not a correct response. Please respond with y (yes) or n (no)."
fi
done

if [ -z "$MOCK_UI_HOST" ]; then
echo "Mock relying party UI Host not provided; EXITING;"
exit 0;
fi
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

CHK_MOCK_UI_HOST=$( nslookup "$MOCK_UI_HOST" )
if [ $? -gt 0 ]; then
echo "Mock relying party UI Host does not exists; EXITING;"
exit 0;
fi
NS=esignet
CHART_VERSION=0.10.0-develop

echo Create $NS namespace
kubectl create ns $NS
read -p "Please provide mock relying party ui domain (eg: healthservices.sandbox.xyz.net ) : " MOCK_UI_HOST
if [ -z "$MOCK_UI_HOST" ]; then
echo "Mock relying party UI Host not provided; EXITING;"
exit 1;
fi

CHK_MOCK_UI_HOST=$( nslookup "$MOCK_UI_HOST" )
if [ $? -gt 0 ]; then
echo "Mock relying party UI Host does not exists; EXITING;"
exit 1;
fi

echo Create $NS namespace
kubectl create ns $NS || true

function installing_mock-relying-party-ui() {
echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite

Expand Down
11 changes: 7 additions & 4 deletions deploy/prereq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ fi

ROOT_DIR=`pwd`
NS=mockid
ESIGNET_NS=esignet
SOFTHSM_NS=softhsm
SOFTHSM_CHART_VERSION=12.0.1

kubectl create ns $NS || true
kubectl create ns $ESIGNET_NS || true

function prereq_mockid () {
echo Create $SOFTHSM_NS namespace
Expand Down Expand Up @@ -38,10 +41,10 @@ function prereq_mockid () {

function prereq_mockrp () {
echo "Create secret for mock-relying-party-service-secrets and jwe-userinfo-private-key delete if exists"
kubectl -n $NS delete --ignore-not-found=true secrets mock-relying-party-private-key-jwk
kubectl -n $NS delete --ignore-not-found=true secrets jwe-userinfo-service-secrets
kubectl -n $NS create secret generic mock-relying-party-private-key-jwk --from-literal=client-private-key='' --dry-run=client -o yaml | kubectl apply -f -
kubectl -n $NS create secret generic jwe-userinfo-service-secrets --from-literal=JWE_USERINFO_PRIVATE_KEY='' --dry-run=client -o yaml | kubectl apply -f -
kubectl -n $ESIGNET_NS delete --ignore-not-found=true secrets mock-relying-party-private-key-jwk
kubectl -n $ESIGNET_NS delete --ignore-not-found=true secrets jwe-userinfo-service-secrets
kubectl -n $ESIGNET_NS create secret generic mock-relying-party-private-key-jwk --from-literal=client-private-key='' --dry-run=client -o yaml | kubectl apply -f -
kubectl -n $ESIGNET_NS create secret generic jwe-userinfo-service-secrets --from-literal=jwe-userinfo-private-key='' --dry-run=client -o yaml | kubectl apply -f -
return 0
}

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
- 8082:8082
environment:
- container_user=mosip
- active_profile_env=local
- active_profile_env=default,local
- SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/mosip_mockidentitysystem?currentSchema=mockidentitysystem
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
Expand Down
4 changes: 2 additions & 2 deletions docker-compose/mock-relying-party-portal-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
mock-relying-party-service:
image: 'mosipdev/mock-relying-party-service:develop'
image: 'mosipdev/mock-relying-party-service:release-0.10.x'
user: root
ports:
- 8888:8888
Expand All @@ -14,7 +14,7 @@ services:


mock-relying-party-ui:
image: 'mosipdev/mock-relying-party-ui:develop'
image: 'mosipdev/mock-relying-party-ui:release-0.10.x'
user: root
ports:
- 3000:3000
Expand Down
2 changes: 2 additions & 0 deletions helm/mock-identity-system/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
Chart.lock
2 changes: 1 addition & 1 deletion helm/mock-identity-system/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mock-identity-system
description: A Helm chart for MOSIP mock-identity-system module
type: application
version: 0.0.1-develop
version: 0.10.0-develop
appVersion: ""
dependencies:
- name: common
Expand Down
19 changes: 0 additions & 19 deletions helm/mock-identity-system/templates/clusterrolebinding.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion helm/mock-identity-system/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
{{- range .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
name: {{ . }}
{{- end }}
{{- end }}

ports:
Expand Down
4 changes: 2 additions & 2 deletions helm/mock-identity-system/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ service:
image:
registry: docker.io
repository: mosipdev/mock-identity-system
tag: develop
tag: release-0.10.x
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down Expand Up @@ -283,7 +283,7 @@ extraEnvVarsCM:

## Secret with extra environment variables
##
extraEnvVarsSecret:
extraEnvVarsSecret: []

## Extra volumes to add to the deployment
##
Expand Down
2 changes: 2 additions & 0 deletions helm/mock-relying-party-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chart/
Chart.lock
2 changes: 1 addition & 1 deletion helm/mock-relying-party-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mock-relying-party-service
description: A Helm chart to file server application.
type: application
version: 0.0.1-develop
version: 0.10.0-develop
appVersion: ""
dependencies:
- name: common
Expand Down
19 changes: 0 additions & 19 deletions helm/mock-relying-party-service/templates/clusterrolebinding.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions helm/mock-relying-party-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ service:

image:
registry: docker.io
repository: mosipqa/mock-relying-party-service
tag: develop
repository: mosipdev/mock-relying-party-service
tag: release-0.10.x
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down
2 changes: 2 additions & 0 deletions helm/mock-relying-party-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
Chart.lock
2 changes: 1 addition & 1 deletion helm/mock-relying-party-ui/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mock-relying-party-ui
description: A Helm chart for MOSIP OIDC UI module
type: application
version: 0.0.1-develop
version: 0.10.0-develop
appVersion: ""
dependencies:
- name: common
Expand Down
19 changes: 0 additions & 19 deletions helm/mock-relying-party-ui/templates/clusterrolebinding.yaml

This file was deleted.

Loading

0 comments on commit 9fe5b29

Please sign in to comment.