diff --git a/README.md b/README.md index 6f34c5771b..ae351ed11a 100644 --- a/README.md +++ b/README.md @@ -54,18 +54,6 @@ Prerequisites: $ ./restart.sh ``` -## To deploy Prereg apitestrig within k8s cluster: -### Install - ``` - $ cd ./apitest/deploy/prereg-apitestrig - $ ./install.sh - ``` -### Delete - ``` - $ cd ./apitest/deploy/prereg-apitestrig - $ ./delete.sh - ``` - ## Configuration Refer to the [configuration guide](docs/configuration.md). diff --git a/apitest/deploy/prereg-apitestrig/README.md b/apitest/deploy/prereg-apitestrig/README.md deleted file mode 100644 index 7bb5fdb1f0..0000000000 --- a/apitest/deploy/prereg-apitestrig/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# APITESTRIG - -## Introduction -ApiTestRig will test the working of APIs of the MOSIP modules. - -## Install -* Review `values.yaml` and, Make sure to enable required modules for apitestrig operation. -* Install -```sh -./install.sh -``` -* During the execution of the `install.sh` script, a prompt appears requesting information regarding the presence of a public domain and a valid SSL certificate on the server. -* If the server lacks a public domain and a valid SSL certificate, it is advisable to select the `n` option. Opting it will enable the `init-container` with an `emptyDir` volume and include it in the deployment process. -* The init-container will proceed to download the server's self-signed SSL certificate and mount it to the specified location within the container's Java keystore (i.e., `cacerts`) file. -* This particular functionality caters to scenarios where the script needs to be employed on a server utilizing self-signed SSL certificates. - -### Note - -* Incase if the user needs to use a different image for apitestrig then in the `install.sh` script update the helm command like below: -```sh - helm -n $NS install apitestrig mosip/apitestrig \ - --set crontime="0 $time * * *" \ - --set module.image.repository= \ - --set module.image.tag= \ - --version $CHART_VERSION \ -``` - -## Uninstall -* To uninstall ApiTestRig, run `delete.sh` script. -```sh -./delete.sh -``` - -## Run apitestrig manually - -#### Rancher UI -* Run apitestrig manually via Rancher UI. - ![apitestrig-2.png](./images/apitestrig-2.png) -* There are two modes of apitestrig `smoke` & `smokeAndRegression`. -* By default, apitestrig will execute with `smokeAndRegression`.
- If you want to run apitestrig with only `smoke`.
- You have to update the `apitestrig` configmap and rerun the specific apitestrig job. - -#### CLI -* Download Kubernetes cluster `kubeconfig` file from `rancher dashboard` to your local. - ![apitestrig-1.png](./images/apitestrig-1.png) -* Install `kubectl` package to your local machine. -* Run apitestrig manually via CLI by creating a new job from an existing k8s cronjob. - ``` - kubectl --kubeconfig= -n apitestrig create job --from=cronjob/ - ``` - example: - ``` - kubectl --kubeconfig=/home/xxx/Downloads/qa4.config -n apitestrig create job --from=cronjob/cronjob-apitestrig-masterdata cronjob-apitestrig-masterdata - ``` diff --git a/apitest/deploy/prereg-apitestrig/copy_cm.sh b/apitest/deploy/prereg-apitestrig/copy_cm.sh deleted file mode 100644 index 450e385ca0..0000000000 --- a/apitest/deploy/prereg-apitestrig/copy_cm.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copy configmaps from other namespaces -# DST_NS: Destination namespace - -function copying_cm() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=apitestrig - - 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 keycloak-host keycloak $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 \ No newline at end of file diff --git a/apitest/deploy/prereg-apitestrig/copy_secrets.sh b/apitest/deploy/prereg-apitestrig/copy_secrets.sh deleted file mode 100644 index f0948b5f6d..0000000000 --- a/apitest/deploy/prereg-apitestrig/copy_secrets.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copy secrets from other namespaces -# DST_NS: Destination namespace - -function copying_secrets() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=apitestrig - - wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh - - $COPY_UTIL secret keycloak-client-secrets keycloak $DST_NS - $COPY_UTIL secret s3 s3 $DST_NS - $COPY_UTIL secret postgres-postgresql postgres $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_secrets # calling function \ No newline at end of file diff --git a/apitest/deploy/prereg-apitestrig/delete.sh b/apitest/deploy/prereg-apitestrig/delete.sh deleted file mode 100644 index 6a28aa852f..0000000000 --- a/apitest/deploy/prereg-apitestrig/delete.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# Uninstalls apitestrig -## Usage: ./delete.sh [kubeconfig] - -if [ $# -ge 1 ] ; then - export KUBECONFIG=$1 -fi - -function deleting_apitestrig() { - NS=apitestrig - while true; do - read -p "Are you sure you want to delete apitestrig helm charts?(Y/n) " yn - if [ $yn = "Y" ] - then - helm -n $NS delete apitestrig - 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_apitestrig # calling function \ No newline at end of file diff --git a/apitest/deploy/prereg-apitestrig/images/apitestrig-1.png b/apitest/deploy/prereg-apitestrig/images/apitestrig-1.png deleted file mode 100644 index a7f36f6f05..0000000000 Binary files a/apitest/deploy/prereg-apitestrig/images/apitestrig-1.png and /dev/null differ diff --git a/apitest/deploy/prereg-apitestrig/images/apitestrig-2.png b/apitest/deploy/prereg-apitestrig/images/apitestrig-2.png deleted file mode 100644 index c6e48e63d3..0000000000 Binary files a/apitest/deploy/prereg-apitestrig/images/apitestrig-2.png and /dev/null differ diff --git a/apitest/deploy/prereg-apitestrig/install.sh b/apitest/deploy/prereg-apitestrig/install.sh deleted file mode 100644 index cd6d4783af..0000000000 --- a/apitest/deploy/prereg-apitestrig/install.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Installs apitestrig -## Usage: ./install.sh [kubeconfig] - -if [ $# -ge 1 ] ; then - export KUBECONFIG=$1 -fi - -NS=apitestrig -CHART_VERSION=0.0.1-develop - -echo Create $NS namespace -kubectl create ns $NS - -function installing_apitestrig() { - echo Istio label - kubectl label ns $NS istio-injection=disabled --overwrite - helm repo update - - echo Copy configmaps - ./copy_cm.sh - - echo Copy secrets - ./copy_secrets.sh - - echo "Delete s3, db, & apitestrig configmap if exists" - kubectl -n $NS delete --ignore-not-found=true configmap s3 - kubectl -n $NS delete --ignore-not-found=true configmap db - kubectl -n $NS delete --ignore-not-found=true configmap apitestrig - - DB_HOST=$( kubectl -n default get cm global -o json |jq -r '.data."mosip-api-internal-host"' ) - API_INTERNAL_HOST=$( kubectl -n default get cm global -o json |jq -r '.data."mosip-api-internal-host"' ) - ENV_USER=$( kubectl -n default get cm global -o json |jq -r '.data."mosip-api-internal-host"' | awk -F '.' '/api-internal/{print $1"."$2}') - - read -p "Please enter the time(hr) to run the cronjob every day (time: 0-23) : " time - if [ -z "$time" ]; then - echo "ERROT: Time cannot be empty; EXITING;"; - exit 1; - fi - if ! [ $time -eq $time ] 2>/dev/null; then - echo "ERROR: Time $time is not a number; EXITING;"; - exit 1; - fi - if [ $time -gt 23 ] || [ $time -lt 0 ] ; then - echo "ERROR: Time should be in range ( 0-23 ); EXITING;"; - exit 1; - fi - - 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 - - read -p "Please provide the retention days to remove old reports ( Default: 3 )" reportExpirationInDays - - if [[ -z $reportExpirationInDays ]]; then - reportExpirationInDays=3 - fi - if ! [[ $reportExpirationInDays =~ ^[0-9]+$ ]]; then - echo "The variable \"reportExpirationInDays\" should contain only number; EXITING"; - exit 1; - fi - - read -p "Please provide slack webhook URL to notify server end issues on your slack channel : " slackWebhookUrl - - if [ -z $slackWebhookUrl ]; then - echo "slack webhook URL not provided; EXITING;" - exit 1; - fi - - valid_inputs=("yes" "no") - eSignetDeployed="" - - while [[ ! " ${valid_inputs[@]} " =~ " ${eSignetDeployed} " ]]; do - read -p "Is the eSignet service deployed? (yes/no): " eSignetDeployed - eSignetDeployed=${eSignetDeployed,,} # Convert input to lowercase - done - - if [[ $eSignetDeployed == "yes" ]]; then - echo "eSignet service is deployed. Proceeding with installation..." - else - echo "eSignet service is not deployed. hence will be skipping esignet related test-cases..." - fi - - echo Installing apitestrig - helm -n $NS install apitestrig mosip/apitestrig \ - --set crontime="0 $time * * *" \ - -f values.yaml \ - --version $CHART_VERSION \ - --set apitestrig.configmaps.s3.s3-host='http://minio.minio:9000' \ - --set apitestrig.configmaps.s3.s3-user-key='admin' \ - --set apitestrig.configmaps.s3.s3-region='' \ - --set apitestrig.configmaps.db.db-server="$DB_HOST" \ - --set apitestrig.configmaps.db.db-su-user="postgres" \ - --set apitestrig.configmaps.db.db-port="5432" \ - --set apitestrig.configmaps.apitestrig.ENV_USER="$ENV_USER" \ - --set apitestrig.configmaps.apitestrig.ENV_ENDPOINT="https://$API_INTERNAL_HOST" \ - --set apitestrig.configmaps.apitestrig.ENV_TESTLEVEL="smokeAndRegression" \ - --set apitestrig.configmaps.apitestrig.reportExpirationInDays="$reportExpirationInDays" \ - --set apitestrig.configmaps.apitestrig.slack-webhook-url="$slackWebhookUrl" \ - --set apitestrig.configmaps.apitestrig.eSignetDeployed="$eSignetDeployed" \ - --set apitestrig.configmaps.apitestrig.NS="$NS" \ - $ENABLE_INSECURE - - echo Installed apitestrig. - 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_apitestrig # calling function \ No newline at end of file diff --git a/deploy/prereg-apitestrig/README.md b/deploy/prereg-apitestrig/README.md new file mode 100644 index 0000000000..cece826ae1 --- /dev/null +++ b/deploy/prereg-apitestrig/README.md @@ -0,0 +1,10 @@ +# PREREG APITESTRIG + +This directory contains `values.yaml` file which contains the latest prereg apitestrig release changes with latest released Docker image and tag. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/apitestrig -f values.yaml +``` diff --git a/apitest/deploy/prereg-apitestrig/values.yaml b/deploy/prereg-apitestrig/values.yaml similarity index 81% rename from apitest/deploy/prereg-apitestrig/values.yaml rename to deploy/prereg-apitestrig/values.yaml index bb67e27ba9..2c9f8e9e13 100644 --- a/apitest/deploy/prereg-apitestrig/values.yaml +++ b/deploy/prereg-apitestrig/values.yaml @@ -4,4 +4,4 @@ modules: image: repository: mosipqa/apitest-prereg tag: develop - pullPolicy: Always \ No newline at end of file + pullPolicy: Always