diff --git a/.github/workflows/chart-lint-publish.yml b/.github/workflows/chart-lint-publish.yml new file mode 100644 index 00000000000..c8d6ba3bd31 --- /dev/null +++ b/.github/workflows/chart-lint-publish.yml @@ -0,0 +1,62 @@ +name: Validate / Publish helm charts + +on: + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + paths: + - 'helm/**' + workflow_dispatch: + inputs: + IGNORE_CHARTS: + description: 'Provide list of charts to be ignored separated by pipe(|)' + required: false + default: '""' + type: string + CHART_PUBLISH: + description: 'Chart publishing to gh-pages branch' + required: false + default: 'NO' + type: string + options: + - YES + - NO + INCLUDE_ALL_CHARTS: + description: 'Include all charts for Linting/Publishing (YES/NO)' + required: false + default: 'NO' + type: string + options: + - YES + - NO + push: + branches: + - '!release-branch' + - '!master' + - 1.* + - 0.* + - develop + - release* + paths: + - 'helm/**' + +jobs: + chart-lint-publish: + uses: mosip/kattu/.github/workflows/chart-lint-publish.yml@master + with: + CHARTS_DIR: ./helm + CHARTS_URL: https://mosip.github.io/mosip-helm + REPOSITORY: mosip-helm + BRANCH: gh-pages + INCLUDE_ALL_CHARTS: "${{ inputs.INCLUDE_ALL_CHARTS || 'NO' }}" + IGNORE_CHARTS: "${{ inputs.IGNORE_CHARTS || '\"\"' }}" + CHART_PUBLISH: "${{ inputs.CHART_PUBLISH || 'YES' }}" + LINTING_CHART_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-schema.yaml" + LINTING_LINTCONF_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/lintconf.yaml" + LINTING_CHART_TESTING_CONFIG_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-testing-config.yaml" + LINTING_HEALTH_CHECK_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/health-check-schema.yaml" + DEPENDENCIES: "mosip,https://mosip.github.io/mosip-helm;" + secrets: + TOKEN: ${{ secrets.ACTION_PAT }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/README.md b/README.md index c2570e151cb..ffef03211bb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Maven Package upon a push](https://github.com/mosip/registration/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/registration/actions/workflows/push_trigger.yml) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.2.0.1&project=mosip_registration&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0.1&id=mosip_registration) +[![Maven Package upon a push](https://github.com/mosip/registration/actions/workflows/push-trigger.yml/badge.svg?branch=master)](https://github.com/mosip/registration/actions/workflows/push-trigger.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=master&project=mosip_registration&metric=alert_status)](https://sonarcloud.io/dashboard?branch=master&id=mosip_registration) # Registration Processor diff --git a/db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.0.2_rollback.sql b/db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.0.2_rollback.sql new file mode 100644 index 00000000000..e69de29bb2d diff --git a/db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.0.2_upgrade.sql b/db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.0.2_upgrade.sql new file mode 100644 index 00000000000..e69de29bb2d diff --git a/db_upgrade_scripts/mosip_regprc/sql/1.2.0.2_to_1.2.1.0_rollback.sql b/db_upgrade_scripts/mosip_regprc/sql/1.2.0.2_to_1.2.1.0_rollback.sql new file mode 100644 index 00000000000..e69de29bb2d diff --git a/db_upgrade_scripts/mosip_regprc/sql/1.2.0.2_to_1.2.1.0_upgrade.sql b/db_upgrade_scripts/mosip_regprc/sql/1.2.0.2_to_1.2.1.0_upgrade.sql new file mode 100644 index 00000000000..e69de29bb2d diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 00000000000..faea2c430cd --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,16 @@ +# Registration processor services + +## Prerequisites +* Install Kafka as given [here](../../external/kafka/README.md) +## Install +``` +./install.sh +``` +## To delete all modules +``` +./delete.sh +``` +## To restart all modules +``` +./restart.sh +``` diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh new file mode 100755 index 00000000000..acf46ec64b6 --- /dev/null +++ b/deploy/copy_cm.sh @@ -0,0 +1,24 @@ +#!/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=regproc + + 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 diff --git a/deploy/delete.sh b/deploy/delete.sh new file mode 100755 index 00000000000..ad4824e935c --- /dev/null +++ b/deploy/delete.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Uninstalls all regproc helm charts +function deleting_regproc() { + NS=regproc + while true; do + read -p "Are you sure you want to delete all regproc helm charts?(Y/n) " yn + if [ $yn = "Y" ] + then + helm -n $NS delete regproc-salt + helm -n $NS delete regproc-workflow + helm -n $NS delete regproc-status + helm -n $NS delete regproc-camel + helm -n $NS delete regproc-pktserver + helm -n $NS delete regproc-group1 + helm -n $NS delete regproc-group2 + helm -n $NS delete regproc-group3 + helm -n $NS delete regproc-group4 + helm -n $NS delete regproc-group5 + helm -n $NS delete regproc-group6 + helm -n $NS delete regproc-group7 + helm -n $NS delete regproc-notifier + helm -n $NS delete regproc-trans + helm -n $NS delete regproc-reprocess + helm -n $NS delete regproc-landingzone + 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_regproc # calling function diff --git a/deploy/group1_values.yaml b/deploy/group1_values.yaml new file mode 100644 index 00000000000..a3eaaeb0c0d --- /dev/null +++ b/deploy/group1_values.yaml @@ -0,0 +1,3 @@ +persistence: + storageClass: longhorn + size: 5Gi diff --git a/deploy/install.sh b/deploy/install.sh new file mode 100755 index 00000000000..513c1446a07 --- /dev/null +++ b/deploy/install.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# Installs all regproc helm charts +## Usage: ./install.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +NS=regproc +CHART_VERSION=12.1.0 + +echo Create $NS namespace +kubectl create ns $NS + +function installing_regproc() { + echo Istio label + kubectl label ns $NS istio-injection=enabled --overwrite + helm repo update + + echo Copy configmaps + sed -i 's/\r$//' copy_cm.sh + ./copy_cm.sh + + echo Running regproc-salt job + helm -n $NS install regproc-salt mosip/regproc-salt --version $CHART_VERSION --wait --wait-for-jobs + + echo Installing regproc-workflow + helm -n $NS install regproc-workflow mosip/regproc-workflow --version $CHART_VERSION + + echo Installing regproc-status + helm -n $NS install regproc-status mosip/regproc-status --version $CHART_VERSION + + echo Installing regproc-camel + helm -n $NS install regproc-camel mosip/regproc-camel --version $CHART_VERSION + + echo Installing regproc-pktserver + helm -n $NS install regproc-pktserver mosip/regproc-pktserver --version $CHART_VERSION + + echo Installing group1 + helm -n $NS install regproc-group1 mosip/regproc-group1 -f group1_values.yaml --version $CHART_VERSION + + echo Installing group2 + helm -n $NS install regproc-group2 mosip/regproc-group2 --version $CHART_VERSION + + echo Installing group3 + helm -n $NS install regproc-group3 mosip/regproc-group3 --version $CHART_VERSION + + echo Installing group4 + helm -n $NS install regproc-group4 mosip/regproc-group4 --version $CHART_VERSION + + echo Installing group5 + helm -n $NS install regproc-group5 mosip/regproc-group5 --version $CHART_VERSION + + echo Installing group6 + helm -n $NS install regproc-group6 mosip/regproc-group6 --version $CHART_VERSION + + echo Installing group7 + helm -n $NS install regproc-group7 mosip/regproc-group7 --version $CHART_VERSION + + echo Installing regproc-trans + helm -n $NS install regproc-trans mosip/regproc-trans --version $CHART_VERSION + + echo Installing regproc-notifier + helm -n $NS install regproc-notifier mosip/regproc-notifier --version $CHART_VERSION + + echo Installing regproc-reprocess + helm -n $NS install regproc-reprocess mosip/regproc-reprocess --version $CHART_VERSION + + echo Installing regproc-landingzone + helm -n $NS install regproc-landingzone mosip/regproc-landingzone --version $CHART_VERSION + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Installed regproc 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_regproc # calling function diff --git a/deploy/restart.sh b/deploy/restart.sh new file mode 100755 index 00000000000..cf622fa0b6d --- /dev/null +++ b/deploy/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Restart the regproc services +## Usage: ./restart.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function Restarting_regproc() { + NS=regproc + kubectl -n $NS rollout restart deploy + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Restarted regproc 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_regproc # calling function diff --git a/deploy/topic/create_topics.sh b/deploy/topic/create_topics.sh new file mode 100755 index 00000000000..a495c68578c --- /dev/null +++ b/deploy/topic/create_topics.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# + +function create_topics() { + read -p "Enter IAM username: " iam_user + + # This username is hardcoded in sql scripts + DB_PWD=$(kubectl get secret --namespace postgres db-common-secrets -o jsonpath={.data.db-dbuser-password} | base64 --decode) + DB_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-api-internal-host}) + DB_PORT=5432 + + echo Creating topics + cd lib + python3 create_topics.py $DB_HOST $DB_PWD $iam_user ../topics.xlsx +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 +create_topics # calling function diff --git a/deploy/upgrade/README.md b/deploy/upgrade/README.md new file mode 100644 index 00000000000..310611fbd4f --- /dev/null +++ b/deploy/upgrade/README.md @@ -0,0 +1,13 @@ +# To Mount NFS folder to regproc packet server and regproc group 1 stage: + +* Update NFS server and path in dmz-landing-pv.yaml and dmz-pkt-pv.yaml. +* Run commands in sequential: +``` +kubectl apply -f dmz-sc.yaml +kubectl apply -f dmz-pkt-pv.yaml +kubectl apply -f dmz-pkt-pvc.yaml +kubectl apply -f dmz-landing-pv.yaml +kubectl apply -f dmz-landing-pvc.yaml +``` +* Edit persistent Volume claim name in regproc-group1 deployment as given in dmz-landing-pvc.yaml +* Edit persistent Volume claim name in regproc-pktserver deployment as given in dmz-pkt-pvc.yaml \ No newline at end of file diff --git a/deploy/upgrade/dmz-landing-pv.yaml b/deploy/upgrade/dmz-landing-pv.yaml new file mode 100644 index 00000000000..47bed228228 --- /dev/null +++ b/deploy/upgrade/dmz-landing-pv.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: landing-pv + labels: + name: landing-pv +spec: + storageClassName: manual + capacity: + storage: 5Gi + accessModes: + - ReadWriteMany + nfs: + server: + path: diff --git a/deploy/upgrade/dmz-landing-pvc.yaml b/deploy/upgrade/dmz-landing-pvc.yaml new file mode 100644 index 00000000000..1ffe81d9d11 --- /dev/null +++ b/deploy/upgrade/dmz-landing-pvc.yaml @@ -0,0 +1,14 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: landing-pvc + namespace: regproc + labels: + app: landing-pvc +spec: + storageClassName: manual + accessModes: + - ReadWriteMany + resources: + requests: + storage: 5Gi diff --git a/deploy/upgrade/dmz-pkt-pv.yaml b/deploy/upgrade/dmz-pkt-pv.yaml new file mode 100644 index 00000000000..b1571fc95b2 --- /dev/null +++ b/deploy/upgrade/dmz-pkt-pv.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pktserver-pv + labels: + name: pktserver-pv +spec: + storageClassName: manual + capacity: + storage: 5Gi + accessModes: + - ReadOnlyMany + nfs: + server: + path: diff --git a/deploy/upgrade/dmz-pkt-pvc.yaml b/deploy/upgrade/dmz-pkt-pvc.yaml new file mode 100644 index 00000000000..3a30a367102 --- /dev/null +++ b/deploy/upgrade/dmz-pkt-pvc.yaml @@ -0,0 +1,15 @@ +# Source: dmzregproc/templates/pktserver-pvc.yaml +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: pktserver-pvc + namespace: regproc + labels: + app: pktserver-pvc +spec: + storageClassName: manual + accessModes: + - ReadOnlyMany + resources: + requests: + storage: 5Gi diff --git a/deploy/upgrade/dmz-sc.yaml b/deploy/upgrade/dmz-sc.yaml new file mode 100644 index 00000000000..b63f6187eaa --- /dev/null +++ b/deploy/upgrade/dmz-sc.yaml @@ -0,0 +1,6 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: manual +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer diff --git a/docs/api-doc/workflow-manager-service-openapi.yaml b/docs/api-doc/workflow-manager-service-openapi.yaml new file mode 100644 index 00000000000..7e686d424d4 --- /dev/null +++ b/docs/api-doc/workflow-manager-service-openapi.yaml @@ -0,0 +1,152 @@ +openapi: 3.0.1 +info: + title: Workflow Manager API documentation + description: Workflow Manager Service contains the APIs used by Workflow Manager module. + license: + name: Mosip + url: https://docs.mosip.io/platform/license + version: '1.0' +servers: + - url: http://localhost:3000/registrationprocessor/v1/workflowmanager +tags: + - name: WorkflowInstanceApi + description: Workflow Instance APIs +paths: + /workflowinstance: + post: + tags: + - WorkflowInstanceApi + summary: Create workflow instance for packet processing. + description: Create workflow instance for packet processing. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceDTO' + example: + id: "mosip.registration.processor.workflow.instance" + version: "v1" + requesttime: "2025-04-08T12:34:56Z" + request: + registrationId: "10035100081001720250110061144" + process: "CRVS_NEW" + source: "CRVS1" + additionalInfoReqId: "" + notificationInfo: + name: "crvs_user" + phone: "+1234567890" + email: "crvs_user@example.com" + required: true + parameters: + - schema: + type: string + in: cookie + name: Authorization + required: true + description: Authorization token is used to validate the permissions carried by the user. + responses: + '200': + description: Workflow instance created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceResponseDTO' + example: + id: "mosip.registration.processor.workflow.instance" + version: "v1" + responsetime: "2025-04-08T12:35:56Z" + response: + workflowInstanceId: "95d09502-a548-413f-9c01-f15a7c8b08af" + errors: null + '201': + description: Created + '400': + description: Unable to create workflow instance + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found +components: + schemas: + WorkflowInstanceDTO: + type: object + properties: + id: + type: string + description: "Unique identification for API" + version: + type: string + description: "API version" + requesttime: + type: string + format: date-time + description: "Date time when request sent" + request: + $ref: '#/components/schemas/WorkflowInstanceRequestDTO' + WorkflowInstanceRequestDTO: + type: object + properties: + registrationId: + type: string + description: "Registration Id" + process: + type: string + description: "Process name" + source: + type: string + description: "Packet source" + additionalInfoReqId: + type: string + description: "Addition information requested for packet during correction flow" + notificationInfo: + $ref: '#/components/schemas/NotificationInfoDTO' + NotificationInfoDTO: + type: object + description: "Notification details used for triggering notification once packet validation passes" + properties: + name: + type: string + description: "Resident name for notification" + phone: + type: string + description: "Resident phone for notification" + email: + type: string + description: "Resident email for notification" + WorkflowInstanceResponseDTO: + type: object + properties: + id: + type: string + description: "Unique identification for API" + version: + type: string + description: "API version" + responsetime: + type: string + format: date-time + description: "Date time when response sent" + response: + $ref: '#/components/schemas/WorkflowInstanceResponse' + errors: + type: array + items: + $ref: '#/components/schemas/ErrorDTO' + WorkflowInstanceResponse: + type: object + properties: + workflowInstanceId: + type: string + description: "Unique identification for created workflow instance" + ErrorDTO: + type: object + properties: + errorCode: + type: string + description: "Error code" + message: + type: string + description: "Error message" + diff --git a/docs/assets/crvs-mosip-integration.png b/docs/assets/crvs-mosip-integration.png new file mode 100644 index 00000000000..343d6d22167 Binary files /dev/null and b/docs/assets/crvs-mosip-integration.png differ diff --git a/docs/crvs-mosip-integration.md b/docs/crvs-mosip-integration.md new file mode 100644 index 00000000000..21b4281ab27 --- /dev/null +++ b/docs/crvs-mosip-integration.md @@ -0,0 +1,16 @@ +# CRVS - MOSIP Integration +## Overview +The document describes the integration flow between the CRVS and MOSIP. +## Prerequisites +**_clientId_** and **_secretKey_** must be created associated with the **_ONLINE_REGISTRATION_CLIENT_** role. +## Integration Flow +1. **CRVS System Authentication:** CRVS system must authenticate using the **_clientId_** and **_secretKey_** associated with the **_ONLINE_REGISTRATION_CLIENT_** role. On successful authentication, CRVS system receives the authentication token in response which must be used in subsequent APIs for authentication. +2. **Create Packet:** CRVS system should invoke the **_/createPacket_** API of packet manager along with required arguments and authentication token as per the API specification inorder to generate the packet for CRVS system use cases such as Birth registration and death registration. +3. **Trigger Packet Processing:** Once packet is created successfully, in order to trigger the packet processing, CRVS system should invoke the **_/workflowinstance_** API of workflow manager service of registration processor module with required arguments and authentication token as per the API specification. This API does below: + 1. It creates the entry in **_registration_list_** table with required information. + 2. It creates the entry in the **_registration_** table with required information along with **_status_code_** as **_RESUMABLE_**, **_latest_trn_type_code_** as **_WORKFLOW_RESUME_** and **_reg_stage_name_** as **_PacketValidatorStage_**. + 3. It creates entry in the **_registration_transaction_** table with required information. +4. Re-processor service of registration processor module picks up the registration table entry with **_RESUMABLE_** **_status_code_** and triggers the packet processing. Re-processor service runs with predefined interval. + +## Sequence Diagram +![CRVS MOSIP Integration](assets/crvs-mosip-integration.png) \ No newline at end of file diff --git a/docs/postman-collection/registration-processor-apis-collection.json b/docs/postman-collection/registration-processor-apis-collection.json new file mode 100644 index 00000000000..50451de90c2 --- /dev/null +++ b/docs/postman-collection/registration-processor-apis-collection.json @@ -0,0 +1,40 @@ +{ + "info": { + "_postman_id": "922ceeef-1c71-42a2-ac40-8bf56aa3cabe", + "name": "Registration Processor APIs Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", + "_exporter_id": "21896995" + }, + "item": [ + { + "name": "Workflow Manager Service", + "item": [ + { + "name": "workflowinstance", + "request": { + "auth": { + "type": "apikey", + "apikey": { + "value": "Authorization={{token}}", + "key": "Cookie" + } + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"mosip.registration.processor.workflow.instance\",\r\n \"version\": \"v1\",\r\n \"requesttime\": \"{{current_time}}\",\r\n \"request\": {\r\n \"registrationId\": \"{{regId}}\",\r\n \"process\": \"{{process}}\",\r\n \"source\": \"{{source}}\",\r\n \"additionalInfoReqId\": \"\",\r\n \"notificationInfo\": {\r\n \"name\": \"{{name}}\",\r\n \"phone\": \"{{phone}}\",\r\n \"email\": \"{{email}}\"\r\n }\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{url}}/registrationprocessor/v1/workflowmanager/workflowinstance" + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/helm/regproc-camel/.gitignore b/helm/regproc-camel/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-camel/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-camel/.helmignore b/helm/regproc-camel/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-camel/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-camel/Chart.yaml b/helm/regproc-camel/Chart.yaml new file mode 100644 index 00000000000..d32998f5985 --- /dev/null +++ b/helm/regproc-camel/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: regproc-camel +description: A Helm chart for MOSIP Registration Processor Camel stage +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-camel + - regproc + - camel +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-camel/README.md b/helm/regproc-camel/README.md new file mode 100644 index 00000000000..e680c5831ca --- /dev/null +++ b/helm/regproc-camel/README.md @@ -0,0 +1,11 @@ +# Camel + +Helm chart for installing Registration Processor Camel stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-camel +``` + diff --git a/helm/regproc-camel/templates/NOTES.txt b/helm/regproc-camel/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-camel/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-camel/templates/_helpers.tpl b/helm/regproc-camel/templates/_helpers.tpl new file mode 100644 index 00000000000..7ab575bcd02 --- /dev/null +++ b/helm/regproc-camel/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-camel.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-camel.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-camel.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-camel.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-camel.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-camel.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-camel.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-camel.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-camel/templates/deployment.yaml b/helm/regproc-camel/templates/deployment.yaml new file mode 100644 index 00000000000..9379532d55c --- /dev/null +++ b/helm/regproc-camel/templates/deployment.yaml @@ -0,0 +1,135 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-camel.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-camel.serviceAccountName" . }} + {{- include "regproc-camel.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-camel.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-camel + image: {{ template "regproc-camel.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + - name: zone_env + value: default + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-camel/templates/extra-list.yaml b/helm/regproc-camel/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-camel/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-camel/templates/service-account.yaml b/helm/regproc-camel/templates/service-account.yaml new file mode 100644 index 00000000000..432c6024f4c --- /dev/null +++ b/helm/regproc-camel/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-camel.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-camel/templates/service.yaml b/helm/regproc-camel/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-camel/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-camel/templates/servicemonitor.yaml b/helm/regproc-camel/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-camel/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-camel/templates/virtualservice.yaml b/helm/regproc-camel/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-camel/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-camel/values.yaml b/helm/regproc-camel/values.yaml new file mode 100644 index 00000000000..edee28b5a4b --- /dev/null +++ b/helm/regproc-camel/values.yaml @@ -0,0 +1,380 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-common-camel-bridge + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8022 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## TODO: enable probes once health urls are available +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/camelbridge/actuator/health + port: 8022 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/camelbridge/actuator/health + port: 8022 + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/camelbridge/actuator/health + port: 8022 + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 1000m + memory: 2000Mi + requests: + cpu: 100m + memory: 1500Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms750M -Xmx750M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/camelbridge/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/camelbridge diff --git a/helm/regproc-group1/.gitignore b/helm/regproc-group1/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group1/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group1/.helmignore b/helm/regproc-group1/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group1/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group1/Chart.yaml b/helm/regproc-group1/Chart.yaml new file mode 100644 index 00000000000..8c4a637df09 --- /dev/null +++ b/helm/regproc-group1/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group1 +description: A Helm chart for MOSIP Registration Processor Group 1 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group1 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group1/README.md b/helm/regproc-group1/README.md new file mode 100644 index 00000000000..ebed5b33f80 --- /dev/null +++ b/helm/regproc-group1/README.md @@ -0,0 +1,11 @@ +# Group 1 stage + +Helm chart for installing RegProc Group 1 stage. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-group1 +``` + diff --git a/helm/regproc-group1/templates/NOTES.txt b/helm/regproc-group1/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group1/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group1/templates/_helpers.tpl b/helm/regproc-group1/templates/_helpers.tpl new file mode 100644 index 00000000000..c63ac873260 --- /dev/null +++ b/helm/regproc-group1/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group1.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group1.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group1.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group1.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group1.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group1.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group1.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group1.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group1/templates/deployment.yaml b/helm/regproc-group1/templates/deployment.yaml new file mode 100644 index 00000000000..72c577428fa --- /dev/null +++ b/helm/regproc-group1/templates/deployment.yaml @@ -0,0 +1,142 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group1.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group1.serviceAccountName" . }} + {{- include "regproc-group1.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group1.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group1 + image: {{ template "regproc-group1.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + volumeMounts: + - name: landing-folder + mountPath: {{ .Values.persistence.mountDir }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} + volumes: + - name: landing-folder + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" .) }} + {{- else }} + emptyDir: {} + {{ end }} diff --git a/helm/regproc-group1/templates/extra-list.yaml b/helm/regproc-group1/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group1/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group1/templates/pvc.yaml b/helm/regproc-group1/templates/pvc.yaml new file mode 100644 index 00000000000..7db9bc8a797 --- /dev/null +++ b/helm/regproc-group1/templates/pvc.yaml @@ -0,0 +1,32 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + "helm.sh/resource-policy": keep +spec: + accessModes: + {{- if not (empty .Values.persistence.accessModes) }} + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + {{- else }} + - {{ .Values.persistence.accessMode | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 2 }} + {{- if .Values.persistence.dataSource }} + dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/regproc-group1/templates/service-account.yaml b/helm/regproc-group1/templates/service-account.yaml new file mode 100644 index 00000000000..c2d8fb9442d --- /dev/null +++ b/helm/regproc-group1/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group1.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group1/templates/service.yaml b/helm/regproc-group1/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-group1/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group1/templates/servicemonitor.yaml b/helm/regproc-group1/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-group1/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-group1/templates/virtualservice.yaml b/helm/regproc-group1/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group1/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group1/values.yaml b/helm/regproc-group1/values.yaml new file mode 100644 index 00000000000..00613593cea --- /dev/null +++ b/helm/regproc-group1/values.yaml @@ -0,0 +1,383 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-1 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## TODO: enable probes once health urls are available +springServicePort: 8081 +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/packetreceiver/actuator/health + port: 8081 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/packetreceiver/actuator/health + port: 8081 + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/packetreceiver/actuator/health + port: 8081 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 1000m + memory: 5000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms4000M -Xmx4000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: true + storageClass: longhorn + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + accessModes: + - ReadWriteMany + size: 5Gi + existingClaim: + # Dir where all incoming packets are stored + # Make sure this matches with what is given in the config properties + mountDir: /mnt/landing + labels: + purpose: landing-folder + reclaimPolicy: Retain +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/packetreceiver/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires public access. +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/packetreceiver diff --git a/helm/regproc-group2/.gitignore b/helm/regproc-group2/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group2/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group2/.helmignore b/helm/regproc-group2/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group2/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group2/Chart.yaml b/helm/regproc-group2/Chart.yaml new file mode 100644 index 00000000000..94fbd6d778e --- /dev/null +++ b/helm/regproc-group2/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group2 +description: A Helm chart for MOSIP Registration Processor Group 2 stage +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group2 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group2/README.md b/helm/regproc-group2/README.md new file mode 100644 index 00000000000..94e20c17395 --- /dev/null +++ b/helm/regproc-group2/README.md @@ -0,0 +1,11 @@ +# Group2 stage + +Helm chart for installing Registration Processor Group 2 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group2 +``` + diff --git a/helm/regproc-group2/templates/NOTES.txt b/helm/regproc-group2/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group2/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group2/templates/_helpers.tpl b/helm/regproc-group2/templates/_helpers.tpl new file mode 100644 index 00000000000..9a21cdbcc17 --- /dev/null +++ b/helm/regproc-group2/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group2.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group2.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group2.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group2.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group2.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group2.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group2.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group2.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group2/templates/deployment.yaml b/helm/regproc-group2/templates/deployment.yaml new file mode 100644 index 00000000000..b48f65b45ba --- /dev/null +++ b/helm/regproc-group2/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group2.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group2.serviceAccountName" . }} + {{- include "regproc-group2.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group2.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group2 + image: {{ template "regproc-group2.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group2/templates/extra-list.yaml b/helm/regproc-group2/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group2/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group2/templates/service-account.yaml b/helm/regproc-group2/templates/service-account.yaml new file mode 100644 index 00000000000..679c28205ad --- /dev/null +++ b/helm/regproc-group2/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group2.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group2/templates/service.yaml b/helm/regproc-group2/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group2/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group2/templates/servicemonitor.yaml b/helm/regproc-group2/templates/servicemonitor.yaml new file mode 100644 index 00000000000..d833a97e19d --- /dev/null +++ b/helm/regproc-group2/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-group2/templates/virtualservice.yaml b/helm/regproc-group2/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group2/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group2/values.yaml b/helm/regproc-group2/values.yaml new file mode 100644 index 00000000000..9c7460891ca --- /dev/null +++ b/helm/regproc-group2/values.yaml @@ -0,0 +1,397 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-2 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +springServicePort: 8090 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8090/registrationprocessor/v1/securezone/actuator/health,http://localhost:9072/registrationprocessor/v1/qualityclassifier/actuator/health,http://localhost:8088/registrationprocessor/v1/sender-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8090/registrationprocessor/v1/securezone/actuator/health,http://localhost:9072/registrationprocessor/v1/qualityclassifier/actuator/health,http://localhost:8088/registrationprocessor/v1/sender-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + # initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8090/registrationprocessor/v1/securezone/actuator/health,http://localhost:9072/registrationprocessor/v1/qualityclassifier/actuator/health,http://localhost:8088/registrationprocessor/v1/sender-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/securezone/actuator/prometheus' + port_name: securezone + port: 80 + targetPort: 8090 + - endpointPath: '/registrationprocessor/v1/qualityclassifier/actuator/prometheus' + port_name: qualityclassifier + port: 9072 + targetPort: 9072 + - endpointPath: '/registrationprocessor/v1/sender-stage/actuator/prometheus' + port_name: sender-stage + port: 8088 + targetPort: 8088 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/securezone diff --git a/helm/regproc-group3/.gitignore b/helm/regproc-group3/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group3/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group3/.helmignore b/helm/regproc-group3/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group3/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group3/Chart.yaml b/helm/regproc-group3/Chart.yaml new file mode 100644 index 00000000000..9a47e1fe66b --- /dev/null +++ b/helm/regproc-group3/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group3 +description: A Helm chart for MOSIP Registration Processor Group 3 stage +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group3 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group3/README.md b/helm/regproc-group3/README.md new file mode 100644 index 00000000000..503fc1c82c0 --- /dev/null +++ b/helm/regproc-group3/README.md @@ -0,0 +1,11 @@ +# Group 3 Stage + +Helm chart for installing Registration Processor Group 3 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group3 +``` + diff --git a/helm/regproc-group3/templates/NOTES.txt b/helm/regproc-group3/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group3/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group3/templates/_helpers.tpl b/helm/regproc-group3/templates/_helpers.tpl new file mode 100644 index 00000000000..f1deb7c1603 --- /dev/null +++ b/helm/regproc-group3/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group3.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group3.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group3.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group3.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group3.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group3.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group3.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group3.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group3/templates/deployment.yaml b/helm/regproc-group3/templates/deployment.yaml new file mode 100644 index 00000000000..e407f7aafd3 --- /dev/null +++ b/helm/regproc-group3/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group3.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group3.serviceAccountName" . }} + {{- include "regproc-group3.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group3.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group3 + image: {{ template "regproc-group3.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group3/templates/extra-list.yaml b/helm/regproc-group3/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group3/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group3/templates/service-account.yaml b/helm/regproc-group3/templates/service-account.yaml new file mode 100644 index 00000000000..e36a366e7e6 --- /dev/null +++ b/helm/regproc-group3/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group3.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group3/templates/service.yaml b/helm/regproc-group3/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group3/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group3/templates/servicemonitor.yaml b/helm/regproc-group3/templates/servicemonitor.yaml new file mode 100644 index 00000000000..bd01e3b0545 --- /dev/null +++ b/helm/regproc-group3/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + {{- end }} diff --git a/helm/regproc-group3/templates/virtualservice.yaml b/helm/regproc-group3/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group3/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group3/values.yaml b/helm/regproc-group3/values.yaml new file mode 100644 index 00000000000..967a13219ae --- /dev/null +++ b/helm/regproc-group3/values.yaml @@ -0,0 +1,397 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-3 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:9096/registrationprocessor/v1/biodedupe/actuator/health,http://localhost:9071/registrationprocessor/v1/abishandler/actuator/health,http://localhost:8084/registrationprocessor/v1/manualverification/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:9096/registrationprocessor/v1/biodedupe/actuator/health,http://localhost:9071/registrationprocessor/v1/abishandler/actuator/health,http://localhost:8084/registrationprocessor/v1/manualverification/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:9096/registrationprocessor/v1/biodedupe/actuator/health,http://localhost:9071/registrationprocessor/v1/abishandler/actuator/health,http://localhost:8084/registrationprocessor/v1/manualverification/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/biodedupe/actuator/prometheus' + port_name: biodedupe + port: 9096 + targetPort: 9096 + - endpointPath: '/registrationprocessor/v1/abishandler/actuator/prometheus' + port_name: abishandler + port: 9071 + targetPort: 9071 + - endpointPath: '/registrationprocessor/v1/manualverification/actuator/prometheus' + port_name: manualverification + port: 8084 + targetPort: 8084 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +## TODO: Enable once access is available +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/abishandler diff --git a/helm/regproc-group4/.gitignore b/helm/regproc-group4/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group4/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group4/.helmignore b/helm/regproc-group4/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group4/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group4/Chart.lock b/helm/regproc-group4/Chart.lock new file mode 100644 index 00000000000..be10d7b6f6a --- /dev/null +++ b/helm/regproc-group4/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2023-01-05T19:12:50.260600119+05:30" diff --git a/helm/regproc-group4/Chart.yaml b/helm/regproc-group4/Chart.yaml new file mode 100644 index 00000000000..33d8de7e90f --- /dev/null +++ b/helm/regproc-group4/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group4 +description: A Helm chart for MOSIP Registration Processor Group 4 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group4 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group4/README.md b/helm/regproc-group4/README.md new file mode 100644 index 00000000000..366209b382a --- /dev/null +++ b/helm/regproc-group4/README.md @@ -0,0 +1,11 @@ +# Group 4 Stage + +Helm chart for installing Registration Processor Group 4 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group4 +``` + diff --git a/helm/regproc-group4/templates/NOTES.txt b/helm/regproc-group4/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group4/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group4/templates/_helpers.tpl b/helm/regproc-group4/templates/_helpers.tpl new file mode 100644 index 00000000000..dc0d1272219 --- /dev/null +++ b/helm/regproc-group4/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group4.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group4.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group4.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group4.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group4.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group4.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group4.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group4.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group4/templates/deployment.yaml b/helm/regproc-group4/templates/deployment.yaml new file mode 100644 index 00000000000..26df667980f --- /dev/null +++ b/helm/regproc-group4/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group4.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group4.serviceAccountName" . }} + {{- include "regproc-group4.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group4.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group4 + image: {{ template "regproc-group4.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group4/templates/extra-list.yaml b/helm/regproc-group4/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group4/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group4/templates/service-account.yaml b/helm/regproc-group4/templates/service-account.yaml new file mode 100644 index 00000000000..fa38dc3897d --- /dev/null +++ b/helm/regproc-group4/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group4.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group4/templates/service.yaml b/helm/regproc-group4/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group4/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group4/templates/servicemonitor.yaml b/helm/regproc-group4/templates/servicemonitor.yaml new file mode 100644 index 00000000000..bd01e3b0545 --- /dev/null +++ b/helm/regproc-group4/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + {{- end }} diff --git a/helm/regproc-group4/templates/virtualservice.yaml b/helm/regproc-group4/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group4/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group4/values.yaml b/helm/regproc-group4/values.yaml new file mode 100644 index 00000000000..ab8d0f280cd --- /dev/null +++ b/helm/regproc-group4/values.yaml @@ -0,0 +1,392 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-4 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8020/registrationprocessor/v1/bioauth/actuator/health,http://localhost:8091/registrationprocessor/v1/demodedupe/actuator/health"; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then exit 1; fi; done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8020/registrationprocessor/v1/bioauth/actuator/health,http://localhost:8091/registrationprocessor/v1/demodedupe/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8020/registrationprocessor/v1/bioauth/actuator/health,http://localhost:8091/registrationprocessor/v1/demodedupe/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/bioauth/actuator/prometheus' + port_name: bioauth + port: 8020 + targetPort: 8020 + - endpointPath: '/registrationprocessor/v1/demodedupe/actuator/prometheus' + port_name: demodedupe + port: 8091 + targetPort: 8091 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/demodedupe diff --git a/helm/regproc-group5/.gitignore b/helm/regproc-group5/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group5/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group5/.helmignore b/helm/regproc-group5/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group5/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group5/Chart.yaml b/helm/regproc-group5/Chart.yaml new file mode 100644 index 00000000000..f36e33d0906 --- /dev/null +++ b/helm/regproc-group5/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group5 +description: A Helm chart for MOSIP Registration Processor Group 5 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group5 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group5/README.md b/helm/regproc-group5/README.md new file mode 100644 index 00000000000..79caa34f542 --- /dev/null +++ b/helm/regproc-group5/README.md @@ -0,0 +1,11 @@ +# Group 5 Stage + +Helm chart for installing Registration Processor Group 5 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group5 +``` + diff --git a/helm/regproc-group5/templates/NOTES.txt b/helm/regproc-group5/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group5/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group5/templates/_helpers.tpl b/helm/regproc-group5/templates/_helpers.tpl new file mode 100644 index 00000000000..19ded16b847 --- /dev/null +++ b/helm/regproc-group5/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group5.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group5.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group5.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group5.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group5.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group5.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group5.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group5.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group5/templates/deployment.yaml b/helm/regproc-group5/templates/deployment.yaml new file mode 100644 index 00000000000..67dc6ac3760 --- /dev/null +++ b/helm/regproc-group5/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group5.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group5.serviceAccountName" . }} + {{- include "regproc-group5.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group5.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group5 + image: {{ template "regproc-group5.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group5/templates/extra-list.yaml b/helm/regproc-group5/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group5/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group5/templates/service-account.yaml b/helm/regproc-group5/templates/service-account.yaml new file mode 100644 index 00000000000..485b92ee9e9 --- /dev/null +++ b/helm/regproc-group5/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group5.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group5/templates/service.yaml b/helm/regproc-group5/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group5/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group5/templates/servicemonitor.yaml b/helm/regproc-group5/templates/servicemonitor.yaml new file mode 100644 index 00000000000..bd01e3b0545 --- /dev/null +++ b/helm/regproc-group5/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + {{- end }} diff --git a/helm/regproc-group5/templates/virtualservice.yaml b/helm/regproc-group5/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group5/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group5/values.yaml b/helm/regproc-group5/values.yaml new file mode 100644 index 00000000000..aac3bf33bd2 --- /dev/null +++ b/helm/regproc-group5/values.yaml @@ -0,0 +1,405 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-5 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8088/registrationprocessor/v1/packetvalidator/actuator/health,http://localhost:8089/registrationprocessor/v1/cmdvalidator/actuator/health,http://localhost:8093/registrationprocessor/v1/operatorvalidator/actuator/health,http://localhost:8094/registrationprocessor/v1/supervisorvalidator/actuator/health,http://localhost:8095/registrationprocessor/v1/introducervalidator/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8088/registrationprocessor/v1/packetvalidator/actuator/health,http://localhost:8089/registrationprocessor/v1/cmdvalidator/actuator/health,http://localhost:8093/registrationprocessor/v1/operatorvalidator/actuator/health,http://localhost:8094/registrationprocessor/v1/supervisorvalidator/actuator/health,http://localhost:8095/registrationprocessor/v1/introducervalidator/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8088/registrationprocessor/v1/packetvalidator/actuator/health,http://localhost:8089/registrationprocessor/v1/cmdvalidator/actuator/health,http://localhost:8093/registrationprocessor/v1/operatorvalidator/actuator/health,http://localhost:8094/registrationprocessor/v1/supervisorvalidator/actuator/health,http://localhost:8095/registrationprocessor/v1/introducervalidator/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +## TODO: Enable when prometheus url is available +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/packetvalidator/actuator/prometheus' + port_name: packetvalidator + port: 8088 + targetPort: 8088 + - endpointPath: '/registrationprocessor/v1/cmdvalidator/actuator/prometheus' + port_name: cmdvalidator + port: 8089 + targetPort: 8089 + - endpointPath: '/registrationprocessor/v1/operatorvalidator/actuator/prometheus' + port_name: operatorvalidator + port: 8093 + targetPort: 8093 + - endpointPath: '/registrationprocessor/v1/supervisorvalidator/actuator/prometheus' + port_name: supervisorvalidator + port: 8094 + targetPort: 8094 + - endpointPath: '/registrationprocessor/v1/introducervalidator/actuator/prometheus' + port_name: introducervalidator + port: 8095 + targetPort: 8095 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/demodedupe diff --git a/helm/regproc-group6/.gitignore b/helm/regproc-group6/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group6/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group6/.helmignore b/helm/regproc-group6/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group6/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group6/Chart.yaml b/helm/regproc-group6/Chart.yaml new file mode 100644 index 00000000000..5521502b06f --- /dev/null +++ b/helm/regproc-group6/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group6 +description: A Helm chart for MOSIP Registration Processor Group 6 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group6 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group6/README.md b/helm/regproc-group6/README.md new file mode 100644 index 00000000000..85354cc8b46 --- /dev/null +++ b/helm/regproc-group6/README.md @@ -0,0 +1,11 @@ +# Group 6 Stage + +Helm chart for installing Registration Processor Group 6 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group6 +``` + diff --git a/helm/regproc-group6/templates/NOTES.txt b/helm/regproc-group6/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group6/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group6/templates/_helpers.tpl b/helm/regproc-group6/templates/_helpers.tpl new file mode 100644 index 00000000000..28b6decfa4b --- /dev/null +++ b/helm/regproc-group6/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group6.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group6.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group6.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group6.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group6.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group6.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group6.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group6.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group6/templates/deployment.yaml b/helm/regproc-group6/templates/deployment.yaml new file mode 100644 index 00000000000..477dcada6f2 --- /dev/null +++ b/helm/regproc-group6/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group6.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group6.serviceAccountName" . }} + {{- include "regproc-group6.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group6.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group6 + image: {{ template "regproc-group6.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group6/templates/extra-list.yaml b/helm/regproc-group6/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group6/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group6/templates/service-account.yaml b/helm/regproc-group6/templates/service-account.yaml new file mode 100644 index 00000000000..8a09a582f8c --- /dev/null +++ b/helm/regproc-group6/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group6.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group6/templates/service.yaml b/helm/regproc-group6/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group6/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group6/templates/servicemonitor.yaml b/helm/regproc-group6/templates/servicemonitor.yaml new file mode 100644 index 00000000000..bd01e3b0545 --- /dev/null +++ b/helm/regproc-group6/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + {{- end }} diff --git a/helm/regproc-group6/templates/virtualservice.yaml b/helm/regproc-group6/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group6/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group6/values.yaml b/helm/regproc-group6/values.yaml new file mode 100644 index 00000000000..a78b4840164 --- /dev/null +++ b/helm/regproc-group6/values.yaml @@ -0,0 +1,393 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-6 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8087/registrationprocessor/v1/uploader/actuator/health,http://localhost:8092/registrationprocessor/v1/packetclassifier/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8087/registrationprocessor/v1/uploader/actuator/health,http://localhost:8092/registrationprocessor/v1/packetclassifier/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8087/registrationprocessor/v1/uploader/actuator/health,http://localhost:8092/registrationprocessor/v1/packetclassifier/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +## TODO: Enable when prometheus url is available +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/uploader/actuator/prometheus' + port_name: uploader + port: 8087 + targetPort: 8087 + - endpointPath: '/registrationprocessor/v1/packetclassifier/actuator/prometheus' + port_name: packetclassifier + port: 8092 + targetPort: 8092 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/group6 diff --git a/helm/regproc-group7/.gitignore b/helm/regproc-group7/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-group7/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-group7/.helmignore b/helm/regproc-group7/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-group7/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-group7/Chart.yaml b/helm/regproc-group7/Chart.yaml new file mode 100644 index 00000000000..741553c3073 --- /dev/null +++ b/helm/regproc-group7/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-group7 +description: A Helm chart for MOSIP Registration Processor Group 7 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-group7 + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-group7/README.md b/helm/regproc-group7/README.md new file mode 100644 index 00000000000..c115b1d221c --- /dev/null +++ b/helm/regproc-group7/README.md @@ -0,0 +1,11 @@ +# Group 7 Stage + +Helm chart for installing Registration Processor Group 7 stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-group7 +``` + diff --git a/helm/regproc-group7/templates/NOTES.txt b/helm/regproc-group7/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-group7/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-group7/templates/_helpers.tpl b/helm/regproc-group7/templates/_helpers.tpl new file mode 100644 index 00000000000..bac90d55f7a --- /dev/null +++ b/helm/regproc-group7/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-group7.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-group7.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-group7.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-group7.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-group7.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-group7.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-group7.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-group7.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-group7/templates/deployment.yaml b/helm/regproc-group7/templates/deployment.yaml new file mode 100644 index 00000000000..cfdba592280 --- /dev/null +++ b/helm/regproc-group7/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-group7.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-group7.serviceAccountName" . }} + {{- include "regproc-group7.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-group7.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-group7 + image: {{ template "regproc-group7.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-group7/templates/extra-list.yaml b/helm/regproc-group7/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-group7/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-group7/templates/service-account.yaml b/helm/regproc-group7/templates/service-account.yaml new file mode 100644 index 00000000000..ee6c7da0448 --- /dev/null +++ b/helm/regproc-group7/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-group7.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-group7/templates/service.yaml b/helm/regproc-group7/templates/service.yaml new file mode 100644 index 00000000000..431f126641d --- /dev/null +++ b/helm/regproc-group7/templates/service.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + {{- range $ep := .Values.metrics.endpointPathList }} + - name: {{ $ep.port_name }} + port: {{ $ep.port }} + protocol: TCP + targetPort: {{ $ep.targetPort }} + {{- end }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-group7/templates/servicemonitor.yaml b/helm/regproc-group7/templates/servicemonitor.yaml new file mode 100644 index 00000000000..bd01e3b0545 --- /dev/null +++ b/helm/regproc-group7/templates/servicemonitor.yaml @@ -0,0 +1,38 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + {{- range $ep := .Values.metrics.endpointPathList }} + - port: {{ $ep.port_name }} + path: {{ $ep.endpointPath }} + {{- if $.Values.metrics.serviceMonitor.interval }} + interval: {{ $.Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ $.Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ $.Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if $.Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml $.Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + {{- end }} diff --git a/helm/regproc-group7/templates/virtualservice.yaml b/helm/regproc-group7/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-group7/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-group7/values.yaml b/helm/regproc-group7/values.yaml new file mode 100644 index 00000000000..edbdaed30dd --- /dev/null +++ b/helm/regproc-group7/values.yaml @@ -0,0 +1,393 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-stage-group-7 + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +#### The following probes are not working and are hence disabled. TODO: debug this +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8099/registrationprocessor/v1/uin-generator/actuator/health,http://localhost:8097/registrationprocessor/v1/credentialrequestor-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8099/registrationprocessor/v1/uin-generator/actuator/health,http://localhost:8097/registrationprocessor/v1/credentialrequestor-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - MY_PROBE_CHECK_PATHS="http://localhost:8099/registrationprocessor/v1/uin-generator/actuator/health,http://localhost:8097/registrationprocessor/v1/credentialrequestor-stage/actuator/health"; i=1; for str in $(echo $MY_PROBE_CHECK_PATHS | sed "s/,/\n/g"); do curl_output="$(curl -w %{http_code} -o /dev/null -s $str)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; ((i++)); done + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPathList: + - endpointPath: '/registrationprocessor/v1/uin-generator/actuator/prometheus' + port_name: uin-generator + port: 8099 + targetPort: 8099 + - endpointPath: '/registrationprocessor/v1/credentialrequestor-stage/actuator/prometheus' + port_name: credentialrequestor-stage + port: 8097 + targetPort: 8097 + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/group7 diff --git a/helm/regproc-landingzone/.gitignore b/helm/regproc-landingzone/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-landingzone/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-landingzone/.helmignore b/helm/regproc-landingzone/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-landingzone/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-landingzone/Chart.yaml b/helm/regproc-landingzone/Chart.yaml new file mode 100644 index 00000000000..ea832ca692b --- /dev/null +++ b/helm/regproc-landingzone/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-landingzone +description: A Helm chart for MOSIP Registration Processor Group 7 +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-landingzone + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-landingzone/README.md b/helm/regproc-landingzone/README.md new file mode 100644 index 00000000000..78648ecd62a --- /dev/null +++ b/helm/regproc-landingzone/README.md @@ -0,0 +1,10 @@ +# Regproc Landing Zone Service + +Helm chart for installing Reg.Proc.Landing Zone Service. + +## TL;DR +```console +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-landingzone +``` + diff --git a/helm/regproc-landingzone/templates/NOTES.txt b/helm/regproc-landingzone/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-landingzone/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-landingzone/templates/_helpers.tpl b/helm/regproc-landingzone/templates/_helpers.tpl new file mode 100644 index 00000000000..e7e31e056f1 --- /dev/null +++ b/helm/regproc-landingzone/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-landingzone.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-landingzone.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-landingzone.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-landingzone.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-landingzone.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-landingzone.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-landingzone.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-landingzone.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-landingzone/templates/deployment.yaml b/helm/regproc-landingzone/templates/deployment.yaml new file mode 100644 index 00000000000..3f7d3f19018 --- /dev/null +++ b/helm/regproc-landingzone/templates/deployment.yaml @@ -0,0 +1,142 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-landingzone.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-landingzone.serviceAccountName" . }} + {{- include "regproc-landingzone.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-landingzone.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-landingzone + image: {{ template "regproc-landingzone.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + volumeMounts: + - name: landing-folder + mountPath: {{ .Values.persistence.mountDir }} + ports: [] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} + volumes: + - name: landing-folder + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" .) }} + {{- else }} + emptyDir: {} + {{ end }} diff --git a/helm/regproc-landingzone/templates/extra-list.yaml b/helm/regproc-landingzone/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-landingzone/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-landingzone/templates/service-account.yaml b/helm/regproc-landingzone/templates/service-account.yaml new file mode 100644 index 00000000000..1679a79415f --- /dev/null +++ b/helm/regproc-landingzone/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-landingzone.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-landingzone/templates/service.yaml b/helm/regproc-landingzone/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-landingzone/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-landingzone/templates/servicemonitor.yaml b/helm/regproc-landingzone/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-landingzone/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-landingzone/templates/virtualservice.yaml b/helm/regproc-landingzone/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-landingzone/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-landingzone/values.yaml b/helm/regproc-landingzone/values.yaml new file mode 100644 index 00000000000..79a56de85e4 --- /dev/null +++ b/helm/regproc-landingzone/values.yaml @@ -0,0 +1,381 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-landing-zone + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8098 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## When configuring Probe, please make sure to remove from the url paths that are not required from the probe list +#### The following probes are not working and are hence disabled. TODO: debug this +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/landingzone/actuator/health + port: 8098 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/landingzone/actuator/health + port: 8098 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/landingzone/actuator/health + port: 8098 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms3000M -Xmx3000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: true + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: regproc-group1 + reclaimPolicy: + mountDir: /mnt/landing +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/landingzone/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/landingzone diff --git a/helm/regproc-notifier/.gitignore b/helm/regproc-notifier/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-notifier/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-notifier/.helmignore b/helm/regproc-notifier/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-notifier/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-notifier/Chart.yaml b/helm/regproc-notifier/Chart.yaml new file mode 100644 index 00000000000..88e7f4c2887 --- /dev/null +++ b/helm/regproc-notifier/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-notifier +description: A Helm chart for MOSIP Registration Processor Notification Service +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-notifier + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-notifier/README.md b/helm/regproc-notifier/README.md new file mode 100644 index 00000000000..1f2353f63e5 --- /dev/null +++ b/helm/regproc-notifier/README.md @@ -0,0 +1,11 @@ +# Regproc Notification Service + +Helm chart for installing Reg Proc Notification Service. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-notifier +``` + diff --git a/helm/regproc-notifier/templates/NOTES.txt b/helm/regproc-notifier/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-notifier/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-notifier/templates/_helpers.tpl b/helm/regproc-notifier/templates/_helpers.tpl new file mode 100644 index 00000000000..93a0a5f62ae --- /dev/null +++ b/helm/regproc-notifier/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-notifier.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-notifier.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-notifier.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-notifier.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-notifier.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-notifier.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-notifier.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-notifier.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-notifier/templates/deployment.yaml b/helm/regproc-notifier/templates/deployment.yaml new file mode 100644 index 00000000000..f0d1bf0e7c9 --- /dev/null +++ b/helm/regproc-notifier/templates/deployment.yaml @@ -0,0 +1,133 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-notifier.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-notifier.serviceAccountName" . }} + {{- include "regproc-notifier.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-notifier.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-notifier + image: {{ template "regproc-notifier.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-notifier/templates/extra-list.yaml b/helm/regproc-notifier/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-notifier/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-notifier/templates/service-account.yaml b/helm/regproc-notifier/templates/service-account.yaml new file mode 100644 index 00000000000..76e64c294fd --- /dev/null +++ b/helm/regproc-notifier/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-notifier.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-notifier/templates/service.yaml b/helm/regproc-notifier/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-notifier/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-notifier/templates/servicemonitor.yaml b/helm/regproc-notifier/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-notifier/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-notifier/templates/virtualservice.yaml b/helm/regproc-notifier/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-notifier/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-notifier/values.yaml b/helm/regproc-notifier/values.yaml new file mode 100644 index 00000000000..c94eda68ada --- /dev/null +++ b/helm/regproc-notifier/values.yaml @@ -0,0 +1,377 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-notification-service + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8088 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/notification/actuator/health + port: 8088 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/notification/actuator/health + port: 8088 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/notification/actuator/health + port: 8088 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 200m + memory: 1500Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms750M -Xmx750M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## + +## ConfigMap with extra environment variables that used +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## ConfigMap with extra environment variables that used +## + +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/notification/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/notification diff --git a/helm/regproc-opencrvs/.gitignore b/helm/regproc-opencrvs/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-opencrvs/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-opencrvs/Chart.yaml b/helm/regproc-opencrvs/Chart.yaml new file mode 100644 index 00000000000..e429c400441 --- /dev/null +++ b/helm/regproc-opencrvs/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: regproc-opencrvs +description: A Helm chart for mosip regproc-opencrvs stage. +type: application +version: 12.1.0 +appVersion: "" +home: https://mosip.io +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +keywords: + - mosip + - mosip-opencrvs-mediator + - opencrvs-mediator + - regproc-opencrvs + - regproc-opencrvs-stage + - opencrvs +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-opencrvs/README.md b/helm/regproc-opencrvs/README.md new file mode 100644 index 00000000000..54463a6a005 --- /dev/null +++ b/helm/regproc-opencrvs/README.md @@ -0,0 +1,10 @@ +# MOSIP Regproc Opencrvs Stage + +Helm chart for installing for Regproc Opencrvs Stage. + +## Install + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-opencrvs +``` diff --git a/helm/regproc-opencrvs/templates/NOTES.txt b/helm/regproc-opencrvs/templates/NOTES.txt new file mode 100644 index 00000000000..4f4b86dd60e --- /dev/null +++ b/helm/regproc-opencrvs/templates/NOTES.txt @@ -0,0 +1 @@ +Installation done diff --git a/helm/regproc-opencrvs/templates/_helpers.tpl b/helm/regproc-opencrvs/templates/_helpers.tpl new file mode 100644 index 00000000000..5b95557caad --- /dev/null +++ b/helm/regproc-opencrvs/templates/_helpers.tpl @@ -0,0 +1,58 @@ +{{/* +Return the proper image name +*/}} +{{- define "regprocOpencrvs.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regprocOpencrvs.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regprocOpencrvs.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regprocOpencrvs.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s-foo" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regprocOpencrvs.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regprocOpencrvs.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regprocOpencrvs.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regprocOpencrvs.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} diff --git a/helm/regproc-opencrvs/templates/deployment.yaml b/helm/regproc-opencrvs/templates/deployment.yaml new file mode 100644 index 00000000000..dda98b1b823 --- /dev/null +++ b/helm/regproc-opencrvs/templates/deployment.yaml @@ -0,0 +1,144 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" . }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: + {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: + {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $ ) | nindent 8 }} + {{- end }} + labels: + {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.podLabels "context" $ ) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{- include "regprocOpencrvs.serviceAccountName" . | nindent 8 }} + {{- include "regprocOpencrvs.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: + {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: + {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{- include "regprocOpencrvs.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-opencrvs + image: {{ template "regprocOpencrvs.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + {{- range .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ . }} + {{- end }} + {{- end }} + ports: + - name: container-port + containerPort: {{ .Values.containerPort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-opencrvs/templates/extra-list.yaml b/helm/regproc-opencrvs/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-opencrvs/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-opencrvs/templates/service-account.yaml b/helm/regproc-opencrvs/templates/service-account.yaml new file mode 100644 index 00000000000..f827cd277a0 --- /dev/null +++ b/helm/regproc-opencrvs/templates/service-account.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "regprocOpencrvs.serviceAccountName" . }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-opencrvs/templates/service.yaml b/helm/regproc-opencrvs/templates/service.yaml new file mode 100644 index 00000000000..20cb4931d34 --- /dev/null +++ b/helm/regproc-opencrvs/templates/service.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "common.names.fullname" . }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - name: http + port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.containerPort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-opencrvs/templates/servicemonitor.yaml b/helm/regproc-opencrvs/templates/servicemonitor.yaml new file mode 100644 index 00000000000..64db5089ac8 --- /dev/null +++ b/helm/regproc-opencrvs/templates/servicemonitor.yaml @@ -0,0 +1,39 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- end }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.containerPort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-opencrvs/values.yaml b/helm/regproc-opencrvs/values.yaml new file mode 100644 index 00000000000..078d1e82c37 --- /dev/null +++ b/helm/regproc-opencrvs/values.yaml @@ -0,0 +1,358 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: {} +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-opencrvs-stage + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +containerPort: 4545 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +startupProbe: + enabled: true + httpGet: + path: "/registrationprocessor/v1/opencrvs-stage/actuator/health" + port: 8045 + initialDelaySeconds: 0 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 10 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: "/registrationprocessor/v1/opencrvs-stage/actuator/health" + port: 8045 + initialDelaySeconds: 20 + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 2 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: "/registrationprocessor/v1/opencrvs-stage/actuator/health" + port: 8045 + initialDelaySeconds: 0 + periodSeconds: 20 + timeoutSeconds: 5 + failureThreshold: 2 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: {} + # cpu: 200m + # memory: 256Mi + requests: {} + # cpu: 100m + # memory: 1500Mi +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +priorityClassName: "" +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: [] +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/opencrvs-stage/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] diff --git a/helm/regproc-pktserver/.gitignore b/helm/regproc-pktserver/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-pktserver/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-pktserver/.helmignore b/helm/regproc-pktserver/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-pktserver/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-pktserver/Chart.yaml b/helm/regproc-pktserver/Chart.yaml new file mode 100644 index 00000000000..87002c3c10b --- /dev/null +++ b/helm/regproc-pktserver/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-pktserver +description: A Helm chart for MOSIP Registration Processor Packet Server +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-pktserver + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-pktserver/README.md b/helm/regproc-pktserver/README.md new file mode 100644 index 00000000000..d6c53541a03 --- /dev/null +++ b/helm/regproc-pktserver/README.md @@ -0,0 +1,19 @@ +# Packet server + +Helm chart for installing RegProc Packet Server. This serves packets from landing folder to other stages. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-pktserver +``` +## Persistence +It is assumed PVC created in Receiver is available to be mounted here. + +## Prerequisites +- Kubernetes 1.12+ +- Helm 3.1.0 +- PV provisioner support in the underlying infrastructure +- ReadWriteMany volumes for deployment scaling + diff --git a/helm/regproc-pktserver/templates/NOTES.txt b/helm/regproc-pktserver/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-pktserver/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-pktserver/templates/_helpers.tpl b/helm/regproc-pktserver/templates/_helpers.tpl new file mode 100644 index 00000000000..3f1384a02b2 --- /dev/null +++ b/helm/regproc-pktserver/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-pktserver.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-pktserver.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-pktserver.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-pktserver.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-pktserver.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-pktserver.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-pktserver.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-pktserver.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-pktserver/templates/deployment.yaml b/helm/regproc-pktserver/templates/deployment.yaml new file mode 100644 index 00000000000..0b9f844b771 --- /dev/null +++ b/helm/regproc-pktserver/templates/deployment.yaml @@ -0,0 +1,144 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-pktserver.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-pktserver.serviceAccountName" . }} + {{- include "regproc-pktserver.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-pktserver.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-pktserver + image: {{ template "regproc-pktserver.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + volumeMounts: + - name: landing-folder + mountPath: {{ .Values.persistence.mountDir }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} + volumes: + - name: landing-folder + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim }} + {{- else }} + emptyDir: {} + {{ end }} diff --git a/helm/regproc-pktserver/templates/extra-list.yaml b/helm/regproc-pktserver/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-pktserver/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-pktserver/templates/service-account.yaml b/helm/regproc-pktserver/templates/service-account.yaml new file mode 100644 index 00000000000..f380bd9bc82 --- /dev/null +++ b/helm/regproc-pktserver/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-pktserver.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-pktserver/templates/service.yaml b/helm/regproc-pktserver/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-pktserver/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-pktserver/templates/servicemonitor.yaml b/helm/regproc-pktserver/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-pktserver/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-pktserver/templates/virtualservice.yaml b/helm/regproc-pktserver/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-pktserver/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-pktserver/values.yaml b/helm/regproc-pktserver/values.yaml new file mode 100644 index 00000000000..94ee7faa10f --- /dev/null +++ b/helm/regproc-pktserver/values.yaml @@ -0,0 +1,383 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-dmz-packet-server + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8082 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## TODO: enable probes once health urls are available +startupProbe: + enabled: true + exec: + command: + - /bin/bash + - -c + - echo "regproc packet server is up !!!" > /home/mosip/landing/healthcheck.txt; url=http://localhost:8082/healthcheck.txt; curl_output="$(curl -w %{http_code} -o /dev/null -s $url)"; if ! [ "$curl_output" = "200" ]; then echo "$str failed with status code $curl_output" >> /dev/stderr && exit $i; fi; + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /healthcheck.txt + port: 8082 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /healthcheck.txt + port: 8082 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 1250Mi + requests: + cpu: 100m + memory: 100Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms1000M -Xmx1000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: true + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + accessModes: + - ReadWriteMany + size: 5Gi + ## Asume that this PVC already exists for receiver. + existingClaim: regproc-group1 + # Hardcoded in Dockerfile. + mountDir: /home/mosip/landing +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +## TODO: Enable when prometheus url is available +metrics: + enabled: false + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## pktserver does NOT require any external access. +istio: + enabled: false + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/packetserver diff --git a/helm/regproc-reprocess/.gitignore b/helm/regproc-reprocess/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-reprocess/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-reprocess/.helmignore b/helm/regproc-reprocess/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-reprocess/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-reprocess/Chart.yaml b/helm/regproc-reprocess/Chart.yaml new file mode 100644 index 00000000000..538e4520bfa --- /dev/null +++ b/helm/regproc-reprocess/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-reprocess +description: A Helm chart for MOSIP Registration Processor Reprocess stage +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-reprocess + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-reprocess/README.md b/helm/regproc-reprocess/README.md new file mode 100644 index 00000000000..3c0607f0b57 --- /dev/null +++ b/helm/regproc-reprocess/README.md @@ -0,0 +1,11 @@ +# Packet Reprocess + +Helm chart for installing Registration Processor Reprocess stage. + +## Install +```console +$ kubectl create namespace regproc +$ helm repo add mosip https://mosip.github.io +$ helm -n regproc install my-release mosip/regproc-reprocess +``` + diff --git a/helm/regproc-reprocess/templates/NOTES.txt b/helm/regproc-reprocess/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-reprocess/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-reprocess/templates/_helpers.tpl b/helm/regproc-reprocess/templates/_helpers.tpl new file mode 100644 index 00000000000..895f11fb410 --- /dev/null +++ b/helm/regproc-reprocess/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-reprocess.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-reprocess.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-reprocess.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-reprocess.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-reprocess.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-reprocess.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-reprocess.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-reprocess.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-reprocess/templates/deployment.yaml b/helm/regproc-reprocess/templates/deployment.yaml new file mode 100644 index 00000000000..7f107a87d9e --- /dev/null +++ b/helm/regproc-reprocess/templates/deployment.yaml @@ -0,0 +1,131 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-reprocess.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-reprocess.serviceAccountName" . }} + {{- include "regproc-reprocess.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-reprocess.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-reprocess + image: {{ template "regproc-reprocess.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-reprocess/templates/extra-list.yaml b/helm/regproc-reprocess/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-reprocess/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-reprocess/templates/service-account.yaml b/helm/regproc-reprocess/templates/service-account.yaml new file mode 100644 index 00000000000..b9d73817bc7 --- /dev/null +++ b/helm/regproc-reprocess/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-reprocess.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-reprocess/templates/service.yaml b/helm/regproc-reprocess/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-reprocess/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-reprocess/templates/servicemonitor.yaml b/helm/regproc-reprocess/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-reprocess/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-reprocess/templates/virtualservice.yaml b/helm/regproc-reprocess/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-reprocess/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-reprocess/values.yaml b/helm/regproc-reprocess/values.yaml new file mode 100644 index 00000000000..1d78c290b45 --- /dev/null +++ b/helm/regproc-reprocess/values.yaml @@ -0,0 +1,380 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-reprocessor + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8021 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +## TODO: enable probes once health urls are available +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/reprocessor/actuator/health + port: 8021 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/reprocessor/actuator/health + port: 8021 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/reprocessor/actuator/health + port: 8021 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 2500Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms2000M -Xmx2000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +# true # ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + ## We use EFS storage class as that supports ReadWriteMany. Make sure you have installed the same as given + ## here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html + ## Packet landing zone requires ReadWriteMany + storageClass: + accessModes: + - ReadWriteMany + size: + existingClaim: + reclaimPolicy: + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/reprocessor/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Requires only internal access for swagger +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/reprocessor diff --git a/helm/regproc-salt/.gitignore b/helm/regproc-salt/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-salt/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-salt/.helmignore b/helm/regproc-salt/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-salt/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-salt/Chart.yaml b/helm/regproc-salt/Chart.yaml new file mode 100644 index 00000000000..ce234d7ecca --- /dev/null +++ b/helm/regproc-salt/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-salt +description: A Helm chart to generate keys for Kernel +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-salt + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-salt/README.md b/helm/regproc-salt/README.md new file mode 100644 index 00000000000..89cad517def --- /dev/null +++ b/helm/regproc-salt/README.md @@ -0,0 +1,10 @@ +# Regproc salt generator + +Helm chart for running Regproc Salt Generator + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-salt +``` diff --git a/helm/regproc-salt/templates/NOTES.txt b/helm/regproc-salt/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-salt/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-salt/templates/_helpers.tpl b/helm/regproc-salt/templates/_helpers.tpl new file mode 100644 index 00000000000..e16b1138743 --- /dev/null +++ b/helm/regproc-salt/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-salt.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-salt.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-salt.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-salt.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-salt.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-salt.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-salt.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-salt.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-salt/templates/extra-list.yaml b/helm/regproc-salt/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-salt/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-salt/templates/job.yaml b/helm/regproc-salt/templates/job.yaml new file mode 100644 index 00000000000..b09f743cf8b --- /dev/null +++ b/helm/regproc-salt/templates/job.yaml @@ -0,0 +1,83 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template "common.names.fullname" . }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + "helm.sh/hook-delete-policy": hook-succeeded + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + +spec: + template: + metadata: + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }} + {{- end }} + sidecar.istio.io/inject: "false" + spec: + {{- include "regproc-salt.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: + fsGroup: {{ .Values.podSecurityContext.fsGroup }} + {{- if .Values.podSecurityContext.sysctls }} + sysctls: + {{- toYaml .Values.podSecurityContext.sysctls | nindent 8 }} + {{- end }} + {{- end }} + serviceAccountName: {{ include "regproc-salt.serviceAccountName" . }} + restartPolicy: Never # This is one time job + containers: + - name: regproc-salt + image: {{ template "regproc-salt.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + - name: salt_gen_schema_name_env + value: regprc + - name: salt_gen_db_alias_env + value: mosip.regproc.db + - name: spring_config_name_env + value: registration-processor + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} diff --git a/helm/regproc-salt/templates/service-account.yaml b/helm/regproc-salt/templates/service-account.yaml new file mode 100644 index 00000000000..8c6231a82d3 --- /dev/null +++ b/helm/regproc-salt/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-salt.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-salt/values.yaml b/helm/regproc-salt/values.yaml new file mode 100644 index 00000000000..47f81c0c02b --- /dev/null +++ b/helm/regproc-salt/values.yaml @@ -0,0 +1,262 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +image: + registry: docker.io + repository: mosipid/kernel-salt-generator + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: {} + # cpu: 200m + # memory: 256Mi + requests: {} + # cpu: 200m + # memory: 10Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: diff --git a/helm/regproc-status/.gitignore b/helm/regproc-status/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-status/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-status/.helmignore b/helm/regproc-status/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-status/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-status/Chart.yaml b/helm/regproc-status/Chart.yaml new file mode 100644 index 00000000000..d6a74b3202b --- /dev/null +++ b/helm/regproc-status/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-status +description: A Helm chart for MOSIP Registration Processor Status Service +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-status + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-status/README.md b/helm/regproc-status/README.md new file mode 100644 index 00000000000..5cf08fe41bf --- /dev/null +++ b/helm/regproc-status/README.md @@ -0,0 +1,17 @@ +# Regproc Status Service + +Helm chart for installing Reg Proc Status Service. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-status +``` +## Prerequisites + +- Kubernetes 1.12+ +- Helm 3.1.0 +- PV provisioner support in the underlying infrastructure +- ReadWriteMany volumes for deployment scaling + diff --git a/helm/regproc-status/templates/NOTES.txt b/helm/regproc-status/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-status/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-status/templates/_helpers.tpl b/helm/regproc-status/templates/_helpers.tpl new file mode 100644 index 00000000000..76c02acf098 --- /dev/null +++ b/helm/regproc-status/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-status.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-status.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-status.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-status.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-status.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-status.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-status.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-status.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-status/templates/deployment.yaml b/helm/regproc-status/templates/deployment.yaml new file mode 100644 index 00000000000..6be3e6055d7 --- /dev/null +++ b/helm/regproc-status/templates/deployment.yaml @@ -0,0 +1,143 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-status.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-status.serviceAccountName" . }} + {{- include "regproc-status.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-status.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-status + image: {{ template "regproc-status.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + - name: artifactory_url_env + valueFrom: + configMapKeyRef: + name: artifactory-share + key: artifactory_url_env + - name: iam_adapter_url_env + valueFrom: + configMapKeyRef: + name: artifactory-share + key: iam_adapter_regproc_ext_url_env + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-status/templates/extra-list.yaml b/helm/regproc-status/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-status/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-status/templates/service-account.yaml b/helm/regproc-status/templates/service-account.yaml new file mode 100644 index 00000000000..206512c6a79 --- /dev/null +++ b/helm/regproc-status/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-status.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-status/templates/service.yaml b/helm/regproc-status/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-status/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-status/templates/servicemonitor.yaml b/helm/regproc-status/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-status/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-status/templates/virtualservice.yaml b/helm/regproc-status/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-status/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-status/values.yaml b/helm/regproc-status/values.yaml new file mode 100644 index 00000000000..6e38cf8420f --- /dev/null +++ b/helm/regproc-status/values.yaml @@ -0,0 +1,380 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-registration-status-service + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8083 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationstatus/actuator/health + port: 8083 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationstatus/actuator/health + port: 8083 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationstatus/actuator/health + port: 8083 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 4000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms2000M -Xmx2000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## NOTE: we have removed artifactory from this list and passed artifactory parameters as above +## This is done as auth adapter url required by this service is different from the default. +extraEnvVarsCM: + - global + - config-server-share +## ConfigMap with extra environment variables that used +## + +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +## TODO: Enable once prometheus url is available +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/registrationstatus/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Needs external access as is connected by reg clients +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/registrationstatus diff --git a/helm/regproc-trans/.gitignore b/helm/regproc-trans/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-trans/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-trans/.helmignore b/helm/regproc-trans/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-trans/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-trans/Chart.yaml b/helm/regproc-trans/Chart.yaml new file mode 100644 index 00000000000..f7c7657ba14 --- /dev/null +++ b/helm/regproc-trans/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-trans +description: A Helm chart for MOSIP Registration Processor Transaction Service +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-trans + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-trans/README.md b/helm/regproc-trans/README.md new file mode 100644 index 00000000000..5259cc1fc0c --- /dev/null +++ b/helm/regproc-trans/README.md @@ -0,0 +1,17 @@ +# Regproc Transaction Service + +Helm chart for installing Reg Proc Transaction Service. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-trans +``` +## Prerequisites + +- Kubernetes 1.12+ +- Helm 3.1.0 +- PV provisioner support in the underlying infrastructure +- ReadWriteMany volumes for deployment scaling + diff --git a/helm/regproc-trans/templates/NOTES.txt b/helm/regproc-trans/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-trans/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-trans/templates/_helpers.tpl b/helm/regproc-trans/templates/_helpers.tpl new file mode 100644 index 00000000000..10a1137ad44 --- /dev/null +++ b/helm/regproc-trans/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-trans.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-trans.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-trans.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-trans.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-trans.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-trans.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-trans.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-trans.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-trans/templates/deployment.yaml b/helm/regproc-trans/templates/deployment.yaml new file mode 100644 index 00000000000..b4e08599512 --- /dev/null +++ b/helm/regproc-trans/templates/deployment.yaml @@ -0,0 +1,143 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-trans.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-trans.serviceAccountName" . }} + {{- include "regproc-trans.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-trans.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-trans + image: {{ template "regproc-trans.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + - name: artifactory_url_env + valueFrom: + configMapKeyRef: + name: artifactory-share + key: artifactory_url_env + - name: iam_adapter_url_env + valueFrom: + configMapKeyRef: + name: artifactory-share + key: iam_adapter_regproc_ext_url_env + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-trans/templates/extra-list.yaml b/helm/regproc-trans/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-trans/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-trans/templates/service-account.yaml b/helm/regproc-trans/templates/service-account.yaml new file mode 100644 index 00000000000..fd9d8b7b615 --- /dev/null +++ b/helm/regproc-trans/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-trans.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-trans/templates/service.yaml b/helm/regproc-trans/templates/service.yaml new file mode 100644 index 00000000000..018e6985d05 --- /dev/null +++ b/helm/regproc-trans/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-trans/templates/servicemonitor.yaml b/helm/regproc-trans/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-trans/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-trans/templates/virtualservice.yaml b/helm/regproc-trans/templates/virtualservice.yaml new file mode 100644 index 00000000000..17a2ca4d734 --- /dev/null +++ b/helm/regproc-trans/templates/virtualservice.yaml @@ -0,0 +1,32 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-trans/values.yaml b/helm/regproc-trans/values.yaml new file mode 100644 index 00000000000..18f91fd2e5c --- /dev/null +++ b/helm/regproc-trans/values.yaml @@ -0,0 +1,380 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-registration-transaction-service + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8110 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationtransaction/actuator/health + port: 8110 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationtransaction/actuator/health + port: 8110 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/registrationtransaction/actuator/health + port: 8110 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 2500Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms2000M -Xmx2000M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## +extraEnvVars: [] +## ConfigMap with extra environment variables that used +## NOTE: we have removed artifactory from this list and passed artifactory parameters as above +## This is done as auth adapter url required by this service is different from the default. +extraEnvVarsCM: + - global + - config-server-share +## ConfigMap with extra environment variables that used +## + +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +## TODO: Enable once prometheus url is available +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/registrationtransaction/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +## Needs external access as is connected by reg clients +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/registrationtransaction diff --git a/helm/regproc-workflow/.gitignore b/helm/regproc-workflow/.gitignore new file mode 100644 index 00000000000..b3c94bf6431 --- /dev/null +++ b/helm/regproc-workflow/.gitignore @@ -0,0 +1,2 @@ +charts/ +Charts.lock diff --git a/helm/regproc-workflow/.helmignore b/helm/regproc-workflow/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/helm/regproc-workflow/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/regproc-workflow/Chart.yaml b/helm/regproc-workflow/Chart.yaml new file mode 100644 index 00000000000..a6d80e8ec22 --- /dev/null +++ b/helm/regproc-workflow/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: regproc-workflow +description: A Helm chart for MOSIP Registration Processor Workflow Manager +type: application +version: 12.1.0 +appVersion: "" +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +home: https://mosip.io +keywords: + - mosip + - regproc-workflow + - regproc +maintainers: + - email: info@mosip.io + name: MOSIP diff --git a/helm/regproc-workflow/README.md b/helm/regproc-workflow/README.md new file mode 100644 index 00000000000..3f99644b930 --- /dev/null +++ b/helm/regproc-workflow/README.md @@ -0,0 +1,11 @@ +# Regproc Workflow Manager + +Helm chart for installing Regproc Workflow Manager + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/regproc-workflow +``` + diff --git a/helm/regproc-workflow/templates/NOTES.txt b/helm/regproc-workflow/templates/NOTES.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/helm/regproc-workflow/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/helm/regproc-workflow/templates/_helpers.tpl b/helm/regproc-workflow/templates/_helpers.tpl new file mode 100644 index 00000000000..c55cf38026f --- /dev/null +++ b/helm/regproc-workflow/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Return the proper image name +*/}} +{{- define "regproc-workflow.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "regproc-workflow.volumePermissions.image" -}} +{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "regproc-workflow.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "regproc-workflow.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message. +*/}} +{{- define "regproc-workflow.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "regproc-workflow.validateValues.foo" .) -}} +{{- $messages := append $messages (include "regproc-workflow.validateValues.bar" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message -}} +{{- end -}} +{{- end -}} + +{{/* +Return podAnnotations +*/}} +{{- define "regproc-workflow.podAnnotations" -}} +{{- if .Values.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }} +{{- end }} +{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }} +{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }} +{{- end }} +{{- end -}} + + diff --git a/helm/regproc-workflow/templates/deployment.yaml b/helm/regproc-workflow/templates/deployment.yaml new file mode 100644 index 00000000000..f7934d62696 --- /dev/null +++ b/helm/regproc-workflow/templates/deployment.yaml @@ -0,0 +1,135 @@ +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + {{- include "regproc-workflow.podAnnotations" . | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "regproc-workflow.serviceAccountName" . }} + {{- include "regproc-workflow.imagePullSecrets" . | nindent 6 }} + {{- if .Values.hostAliases }} + hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: {{ include "regproc-workflow.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: + - %%commands%% + securityContext: + runAsUser: 0 + {{- if .Values.volumePermissions.resources }} + resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: foo + mountPath: bar + {{- end }} + {{- if .Values.initContainers }} + {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: regproc-workflow + image: {{ template "regproc-workflow.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + {{- if .Values.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} + {{- end }} + env: + - name: container_user + value: {{ .Values.containerSecurityContext.runAsUser }} + - name: JDK_JAVA_OPTIONS + value: {{ .Values.additionalResources.javaOpts }} + {{- if .Values.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + {{- range .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + {{- end }} + ports: + - name: spring-service + containerPort: {{ .Values.springServicePort }} + - name: workflow-action + containerPort: {{ .Values.workflowActionPort }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} diff --git a/helm/regproc-workflow/templates/extra-list.yaml b/helm/regproc-workflow/templates/extra-list.yaml new file mode 100644 index 00000000000..9ac65f9e16f --- /dev/null +++ b/helm/regproc-workflow/templates/extra-list.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraDeploy }} +--- +{{ include "common.tplvalues.render" (dict "value" . "context" $) }} +{{- end }} diff --git a/helm/regproc-workflow/templates/service-account.yaml b/helm/regproc-workflow/templates/service-account.yaml new file mode 100644 index 00000000000..b15418b41ac --- /dev/null +++ b/helm/regproc-workflow/templates/service-account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "regproc-workflow.serviceAccountName" . }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} diff --git a/helm/regproc-workflow/templates/service.yaml b/helm/regproc-workflow/templates/service.yaml new file mode 100644 index 00000000000..64f2debdd60 --- /dev/null +++ b/helm/regproc-workflow/templates/service.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: Service +metadata: + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + name: {{ template "common.names.fullname" . }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{ if eq .Values.service.type "LoadBalancer" }} + loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} + {{ end }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + ports: + - name: spring-service + port: {{ .Values.service.port }} + protocol: TCP + targetPort: {{ .Values.springServicePort }} + - name: http-workflow-action + port: {{ .Values.workflowActionPort }} + protocol: TCP + targetPort: {{ .Values.workflowActionPort }} + selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/helm/regproc-workflow/templates/servicemonitor.yaml b/helm/regproc-workflow/templates/servicemonitor.yaml new file mode 100644 index 00000000000..15f48fdeecf --- /dev/null +++ b/helm/regproc-workflow/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }} + {{- end }} +spec: + endpoints: + - targetPort: {{ .Values.springServicePort }} + path: {{ .Values.metrics.endpointPath }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + selector: + matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/helm/regproc-workflow/templates/virtualservice.yaml b/helm/regproc-workflow/templates/virtualservice.yaml new file mode 100644 index 00000000000..1808be3c634 --- /dev/null +++ b/helm/regproc-workflow/templates/virtualservice.yaml @@ -0,0 +1,43 @@ +{{- if .Values.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + hosts: + - "*" + gateways: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.gateways "context" $ ) | nindent 4 }} + http: + - match: + {{- include "common.tplvalues.render" ( dict "value" .Values.istio.workflowAction "context" $ ) | nindent 4 }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.workflowActionPort }} + headers: + request: + set: + x-forwarded-proto: https + - match: + - uri: + prefix: {{ .Values.istio.prefix }} + route: + - destination: + host: {{ template "common.names.fullname" . }} + port: + number: {{ .Values.service.port }} + headers: + request: + set: + x-forwarded-proto: https +{{- end }} diff --git a/helm/regproc-workflow/values.yaml b/helm/regproc-workflow/values.yaml new file mode 100644 index 00000000000..836ba8eded0 --- /dev/null +++ b/helm/regproc-workflow/values.yaml @@ -0,0 +1,385 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Add labels to all the deployed resources +## +commonLabels: + app.kubernetes.io/component: mosip +## Add annotations to all the deployed resources +## +commonAnnotations: {} +## Kubernetes Cluster Domain +## +clusterDomain: cluster.local +## Extra objects to deploy (value evaluated as a template) +## +extraDeploy: [] +## Number of nodes +## +replicaCount: 1 +service: + type: ClusterIP + port: 80 + ## loadBalancerIP for the SuiteCRM Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: + ## + ## nodePorts: + ## http: + ## https: + ## + + nodePorts: + http: "" + https: "" + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster +image: + registry: docker.io + repository: mosipid/registration-processor-workflow-manager-service + tag: 1.2.1.0 + ## 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 + ## + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName +## Port on which this particular spring service module is running. +springServicePort: 8026 +workflowActionPort: 8023 +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## +startupProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/workflowmanager/actuator/health + port: 8026 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 +livenessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/workflowmanager/actuator/health + port: 8026 + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + httpGet: + path: /registrationprocessor/v1/workflowmanager/actuator/health + port: 8026 + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +## +# existingConfigmap: + +## Command and args for running the container (set to default if not set). Use array form +## +command: [] +args: [] +## Deployment pod host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: [] +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: + cpu: 500m + memory: 3000Mi + requests: + cpu: 100m + memory: 1000Mi +additionalResources: + ## Specify any JAVA_OPTS string here. These typically will be specified in conjunction with above resources + ## Example: java_opts: "-Xms500M -Xmx500M" + javaOpts: "-Xms2250M -Xmx2250M" +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container +## Clamav container already runs as 'mosip' user, so we may not need to enable this +containerSecurityContext: + enabled: false + runAsUser: mosip + runAsNonRoot: true +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## +podSecurityContext: + enabled: false + fsGroup: 1001 +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + ## + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] +## Affinity for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## Pod extra labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## Annotations for server pods. +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + +## lifecycleHooks for the container to automate configuration before or after startup. +## +lifecycleHooks: {} +## Custom Liveness probes for +## +customLivenessProbe: {} +## Custom Rediness probes +## +customReadinessProbe: {} +## Update strategy - only really applicable for deployments with RWO PVs attached +## If replicas = 1, an update can get "stuck", as the previous pod remains attached to the +## PV, and the "incoming" pod can never start. Changing the strategy to "Recreate" will +## terminate the single previous pod, so that the new, incoming pod can attach to the PV +## +updateStrategy: + type: RollingUpdate +## Additional environment variables to set +## Example: +## extraEnvVars: +## - name: FOO +## value: "bar" +## + +## ConfigMap with extra environment variables that used +extraEnvVarsCM: + - global + - config-server-share + - artifactory-share +## ConfigMap with extra environment variables that used +## + +## Secret with extra environment variables +## +extraEnvVarsSecret: +## Extra volumes to add to the deployment +## +extraVolumes: [] +## Extra volume mounts to add to the container +## +extraVolumeMounts: [] +## Add init containers to the pods. +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +initContainers: {} +## Add sidecars to the pods. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: {} +persistence: + enabled: false + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack). + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## ReadWriteMany not supported by AWS gp2 + storageClass: + accessModes: + - ReadWriteOnce + size: 10M + existingClaim: + # Dir where config and keys are written inside container + mountDir: +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/bitnami-shell + tag: "10" + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + pullSecrets: [] + ## - myRegistryKeySecretName + ## Init containers' resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## + limits: {} + ## cpu: 100m + ## memory: 128Mi + ## + requests: {} + ## cpu: 100m + ## memory: 128Mi + ## +## Specifies whether RBAC resources should be created +## +rbac: + create: true +## Specifies whether a ServiceAccount should be created +## +serviceAccount: + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + ## + name: +## Prometheus Metrics +## +metrics: + enabled: true + ## Prometheus pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: + prometheus.io/scrape: "true" + endpointPath: /registrationprocessor/v1/workflowmanager/actuator/prometheus + ## Prometheus Service Monitor + ## ref: https://github.com/coreos/prometheus-operator + ## + serviceMonitor: + ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## + enabled: true + ## Specify the namespace in which the serviceMonitor resource will be created + ## + # namespace: "" + ## Specify the interval at which metrics should be scraped + ## + interval: 10s + ## Specify the timeout after which the scrape is ended + ## + # scrapeTimeout: 30s + ## Specify Metric Relabellings to add to the scrape endpoint + ## + # relabellings: + ## Specify honorLabels parameter to add the scrape endpoint + ## + honorLabels: false + ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## + additionalLabels: {} + ## Custom PrometheusRule to be defined + ## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart + ## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions + ## + prometheusRule: + enabled: false + additionalLabels: {} + namespace: '' + ## List of rules, used as template by Helm. + ## These are just examples rules inspired from https://awesome-prometheus-alerts.grep.to/rules.html + # rules: + # - alert: RabbitmqDown + # expr: rabbitmq_up{service="{{ template "rabbitmq.fullname" . }}"} == 0 + # for: 5m + # labels: + # severity: error + rules: [] +istio: + enabled: true + gateways: + - istio-system/internal + prefix: /registrationprocessor/v1/workflowmanager + workflowAction: + - uri: + prefix: /registrationprocessor/v1/workflowmanager/workflowaction + - uri: + prefix: /registrationprocessor/v1/workflowmanager/workflow/search + - uri: + prefix: /registrationprocessor/v1/workflowmanager/workflowinstance diff --git a/registration-processor/core-processor/pom.xml b/registration-processor/core-processor/pom.xml index fa91c1f0578..c39163f93e1 100644 --- a/registration-processor/core-processor/pom.xml +++ b/registration-processor/core-processor/pom.xml @@ -5,9 +5,9 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 - 1.2.0.1 + 1.2.1.0 core-processor core-processor diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml index a37de58feed..b379b6e2304 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-abis-handler-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml index fa7793ec1ea..885e5673538 100644 --- a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-abis-middleware-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis/Dockerfile b/registration-processor/core-processor/registration-processor-abis/Dockerfile index ee5b26edf18..f05538e215d 100644 --- a/registration-processor/core-processor/registration-processor-abis/Dockerfile +++ b/registration-processor/core-processor/registration-processor-abis/Dockerfile @@ -1,5 +1,14 @@ FROM openjdk:11 +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + #Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image #FROM openjdk:8-jdk-alpine diff --git a/registration-processor/core-processor/registration-processor-abis/pom.xml b/registration-processor/core-processor/registration-processor-abis/pom.xml index 6c2b745f082..18171911280 100644 --- a/registration-processor/core-processor/registration-processor-abis/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-abis - 1.2.0.1 + 1.2.1.0 registration-processor-abis UTF-8 diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml index 56ff425b0df..10fcd910e80 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-bio-dedupe-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml index 23d4521323a..ec504aca885 100644 --- a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-biometric-authentication-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/pom.xml b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/pom.xml index b520f750e72..52f20d5c548 100644 --- a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-biometric-extraction-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml index 81de309f801..b2b39ad81a1 100644 --- a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-demo-dedupe-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-finalization-stage/pom.xml b/registration-processor/core-processor/registration-processor-finalization-stage/pom.xml index adb6556ca2c..1974f689d8b 100644 --- a/registration-processor/core-processor/registration-processor-finalization-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-finalization-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-finalization-stage registration-processor-finalization-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-manual-adjudication-stage/pom.xml b/registration-processor/core-processor/registration-processor-manual-adjudication-stage/pom.xml index b2cb336df8c..bd014fb94a9 100644 --- a/registration-processor/core-processor/registration-processor-manual-adjudication-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-manual-adjudication-stage/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-manual-adjudication-stage - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml index f6ffd9f8f5c..0d11c316115 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml @@ -4,10 +4,10 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-uin-generator-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java index 63c05ac64ac..4d5d4d90264 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java @@ -155,6 +155,9 @@ public class UinGeneratorStage extends MosipVerticleAPIManager { @Value("${mosip.regproc.uin.generator.trim-whitespaces.simpleType-value:false}") private boolean trimWhitespaces; + @Value("#{${registration.processor.additional-process.category-mapping:{:}}}") + private Map additionalProcessCategoryMapping; + /** The core audit request builder. */ @Autowired private AuditLogRequestBuilder auditLogRequestBuilder; @@ -240,16 +243,13 @@ public MessageDTO process(MessageDTO object) { regProcLogger.info("Match for lostPacketRegId"+lostPacketRegId +"is "+matchedRegId); lostAndUpdateUin(lostPacketRegId, matchedRegId, registrationStatusDto.getRegistrationType(), object, description); } - } else { - IdResponseDTO idResponseDTO = new IdResponseDTO(); String schemaVersion = packetManagerService.getFieldByMappingJsonKey(registrationId, MappingJsonConstants.IDSCHEMA_VERSION, registrationStatusDto.getRegistrationType(), ProviderStageName.UIN_GENERATOR); Map fieldMap = packetManagerService.getFields(registrationId, idSchemaUtil.getDefaultFields(Double.valueOf(schemaVersion)), registrationStatusDto.getRegistrationType(), ProviderStageName.UIN_GENERATOR); - String uinField = fieldMap.get(utility.getMappingJsonValue(MappingJsonConstants.UIN, MappingJsonConstants.IDENTITY)); - + String uinField = utility.getUIn(registrationId, registrationStatusDto.getRegistrationType(), ProviderStageName.UIN_GENERATOR); JSONObject demographicIdentity = new JSONObject(); demographicIdentity.put(MappingJsonConstants.IDSCHEMA_VERSION, convertIdschemaToDouble ? Double.valueOf(schemaVersion) : schemaVersion); @@ -320,8 +320,8 @@ public MessageDTO process(MessageDTO object) { idResponseDTO = deactivateUin(registrationId, uinField, object, demographicIdentity, description); } else if (RegistrationType.UPDATE.toString().equalsIgnoreCase(object.getReg_type()) - || (RegistrationType.RES_UPDATE.toString() - .equalsIgnoreCase(object.getReg_type()))) { + || (RegistrationType.RES_UPDATE.toString().equalsIgnoreCase(object.getReg_type())) + || (RegistrationType.UPDATE.toString().equalsIgnoreCase(utility.getInternalProcess(additionalProcessCategoryMapping, object.getReg_type())))) { isTransactionSuccessful = uinUpdate(registrationId, registrationStatusDto.getRegistrationType(), uinField, object, demographicIdentity, description); } @@ -463,35 +463,48 @@ public MessageDTO process(MessageDTO object) { return object; } - private void loadDemographicIdentity(Map fieldMap, JSONObject demographicIdentity) throws IOException, JSONException { - for (Map.Entry e : fieldMap.entrySet()) { - if (e.getValue() != null) { - String value = e.getValue().toString(); - if (value != null) { - Object json = new JSONTokener(value).nextValue(); - if (json instanceof org.json.JSONObject) { - HashMap hashMap = objectMapper.readValue(value, HashMap.class); - demographicIdentity.putIfAbsent(e.getKey(), hashMap); - } - else if (json instanceof JSONArray) { - List jsonList = new ArrayList<>(); - JSONArray jsonArray = new JSONArray(value); - for (int i = 0; i < jsonArray.length(); i++) { - Object obj = jsonArray.get(i); - HashMap hashMap = objectMapper.readValue(obj.toString(), HashMap.class); - if(trimWhitespaces && hashMap.get("value") instanceof String) { - hashMap.put("value",((String)hashMap.get("value")).trim()); - } - jsonList.add(hashMap); - } - demographicIdentity.putIfAbsent(e.getKey(), jsonList); - } else - demographicIdentity.putIfAbsent(e.getKey(), value); - } else - demographicIdentity.putIfAbsent(e.getKey(), value); - } - } - } + private void loadDemographicIdentity(Map fieldMap, JSONObject demographicIdentity) throws IOException, JSONException { + for (Map.Entry e : fieldMap.entrySet()) { + if (e.getValue() == null) { + continue; + } + + String value = e.getValue().toString(); + if (value == null) { + demographicIdentity.putIfAbsent(e.getKey(), value); + continue; + } + + Object json = new JSONTokener(value).nextValue(); + if (json instanceof org.json.JSONObject) { + HashMap hashMap = objectMapper.readValue(value, HashMap.class); + demographicIdentity.putIfAbsent(e.getKey(), hashMap); + continue; + } + + if (json instanceof JSONArray) { + List jsonList = new ArrayList<>(); + JSONArray jsonArray = new JSONArray(value); + for (int i = 0; i < jsonArray.length(); i++) { + Object obj = jsonArray.get(i); + if (obj instanceof String) { + jsonList.add(obj); + } else { + HashMap hashMap = objectMapper.readValue(obj.toString(), HashMap.class); + + if (trimWhitespaces && hashMap.containsKey("value") && hashMap.get("value") instanceof String) { + hashMap.put("value", ((String) hashMap.get("value")).trim()); + } + jsonList.add(hashMap); + } + } + demographicIdentity.putIfAbsent(e.getKey(), jsonList); + } + else { + demographicIdentity.putIfAbsent(e.getKey(), value); + } + } + } /** * Send id repo with uin. diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/test/java/io/mosip/registration/processor/stages/uigenerator/UinGeneratorStageTest.java b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/test/java/io/mosip/registration/processor/stages/uigenerator/UinGeneratorStageTest.java index 02e944677cb..a13fba3ae9b 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/test/java/io/mosip/registration/processor/stages/uigenerator/UinGeneratorStageTest.java +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/test/java/io/mosip/registration/processor/stages/uigenerator/UinGeneratorStageTest.java @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode; import io.mosip.kernel.core.util.DateUtils; +import io.mosip.registration.processor.core.constant.ProviderStageName; import io.mosip.registration.processor.packet.manager.dto.IdRequestDto; import io.mosip.registration.processor.stages.uingenerator.dto.VidResponseDto; import org.apache.commons.io.IOUtils; @@ -128,13 +129,13 @@ public Vertx getEventbus() { @Override public void consume(MessageBusAddress fromAddress, - EventHandler>> eventHandler) { + EventHandler>> eventHandler) { } @Override public void consumeAndSend(MessageBusAddress fromAddress, MessageBusAddress toAddress, - EventHandler>> eventHandler) { + EventHandler>> eventHandler) { } @@ -316,7 +317,7 @@ public void setup() throws Exception { demographicIdentity.put("UIN", Long.parseLong("9403107397")); when(idRepoService.getUinByRid(anyString(), anyString())).thenReturn("9403107397"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn(null); List birTypeList = new ArrayList<>(); BIR birType1 = new BIR.BIRBuilder().build(); BDBInfo bdbInfoType1 = new BDBInfo.BDBInfoBuilder().build(); @@ -413,12 +414,12 @@ public void testUinGenerationIDRepoDraftException() throws Exception { @Test public void testUinGenerationIDRepoDraftAPiResourceException() throws Exception { - + ApisResourceAccessException apisResourceAccessException = Mockito.mock(ApisResourceAccessException.class); HttpServerErrorException httpServerErrorException = new HttpServerErrorException( HttpStatus.INTERNAL_SERVER_ERROR, "KER-FSE-004:encrypted data is corrupted or not base64 encoded"); when(apisResourceAccessException.getCause()).thenReturn(httpServerErrorException); - + Map fieldMap = new HashMap<>(); fieldMap.put("UIN", "123456"); fieldMap.put("name", "mono"); @@ -430,11 +431,11 @@ public void testUinGenerationIDRepoDraftAPiResourceException() throws Exception defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); - + MessageDTO messageDTO = new MessageDTO(); messageDTO.setRid("27847657360002520181210094052"); messageDTO.setReg_type(RegistrationType.UPDATE.name()); @@ -449,7 +450,7 @@ public void testUinGenerationIDRepoDraftAPiResourceException() throws Exception assertTrue(result.getInternalError()); assertTrue(result.getIsValid()); } - + @Test public void testUinReActivationifAlreadyActivatedSuccess() throws Exception { @@ -477,7 +478,7 @@ public void testUinReActivationifAlreadyActivatedSuccess() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -511,7 +512,7 @@ public void testUinReActivationResponseStatusAsActivated() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -551,6 +552,7 @@ public void testUinReActivationIDraftResponseActivated() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -605,7 +607,7 @@ public void testUinReActivationWithoutResponseDTO() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -662,7 +664,7 @@ public void testUinReActivationWithResponseDTONull() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -707,7 +709,7 @@ public void testUinReActivationWithStatusAsAny() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMaps); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -788,6 +790,7 @@ public void testUinReActivationIfNotActivatedSuccess() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); @@ -821,7 +824,7 @@ public void testUinReActivationIfNotGotActivatedStaus() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -876,7 +879,7 @@ public void testUinReActivationFailure() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -985,6 +988,7 @@ public void deactivateTestSuccess() throws ApisResourceAccessException, IOExcept defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); @@ -1034,7 +1038,7 @@ public void checkIsUinDeactivatedSuccess() throws ApisResourceAccessException, I defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1072,7 +1076,7 @@ public void deactivateTestWithDeactivate() throws ApisResourceAccessException, I defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1123,7 +1127,7 @@ public void deactivateTestWithNullResponseDTO() defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1194,7 +1198,8 @@ public void deactivateTestForExistingUinTestSuccess() defaultFields.add("UIN"); when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); - + + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1224,7 +1229,7 @@ public void deactivateTestFailure() throws ApisResourceAccessException, PacketMa defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1346,7 +1351,7 @@ public void testUinGenerationHttpClientErrorException() throws Exception { MessageDTO messageDTO = new MessageDTO(); messageDTO.setRid("27847657360002520181210094052"); String str = "{\"id\":\"mosip.id.read\",\"version\":\"1.0\",\"responsetime\":\"2019-04-05\",\"metadata\":null,\"response\":{\"uin\":\"2812936908\"},\"errors\":[{\"errorCode\":null,\"errorMessage\":null}]}"; - + ApisResourceAccessException apisResourceAccessException = Mockito.mock(ApisResourceAccessException.class); HttpClientErrorException httpClientErrorException = new HttpClientErrorException( HttpStatus.INTERNAL_SERVER_ERROR, "KER-FSE-004:encrypted data is corrupted or not base64 encoded"); @@ -1369,7 +1374,7 @@ public void testUinGenerationHttpServerErrorException() throws Exception { MessageDTO messageDTO = new MessageDTO(); messageDTO.setRid("27847657360002520181210094052"); String str = "{\"id\":\"mosip.id.read\",\"version\":\"1.0\",\"responsetime\":\"2019-04-05\",\"metadata\":null,\"response\":{\"uin\":\"2812936908\"},\"errors\":[{\"errorCode\":null,\"errorMessage\":null}]}"; - + ApisResourceAccessException apisResourceAccessException = Mockito.mock(ApisResourceAccessException.class); HttpServerErrorException httpServerErrorException = new HttpServerErrorException( HttpStatus.INTERNAL_SERVER_ERROR, "KER-FSE-004:encrypted data is corrupted or not base64 encoded"); @@ -1468,7 +1473,7 @@ public void testApisResourceAccessExceptionPostApi() ApisResourceAccessException exc = new ApisResourceAccessException(); MessageDTO messageDTO = new MessageDTO(); messageDTO.setRid("27847657360002520181210094052"); - + when(registrationProcessorRestClientService.putApi(any(), any(), any(), any(), any(), any(), any())) .thenThrow(exc); @@ -1503,7 +1508,7 @@ public void testLinkSuccessForLostUin() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(anyString(),anyList(),anyString(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1556,7 +1561,7 @@ public void testLinkSuccessForLostUinAndUpdateContactInfo() throws Exception { defaultFields.add("UIN"); when(idRepoService.getUinByRid(anyString(), anyString())).thenReturn("9403107397"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(anyString(),anyList(),anyString(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1611,6 +1616,7 @@ public void updateTestSuccess() throws ApisResourceAccessException, IOException, defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); @@ -1733,6 +1739,7 @@ public void testUpdateSuccess() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); @@ -1790,6 +1797,7 @@ public void testUpdateDraftFailed() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); @@ -1834,7 +1842,7 @@ public void testUinAlreadyExists() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(anyString(),anyList(),anyString(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -1948,7 +1956,7 @@ public void testUinReActivationWithoutIDResponseDTO() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2007,7 +2015,7 @@ public void deactivateTestWithNullResponseDTOBeforeDeactivate() throws ApisResou defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2057,7 +2065,7 @@ public void deactivateTesApiResourceClientException() throws ApisResourceAccessE defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2108,7 +2116,7 @@ public void deactivateTesApiResourceServerException() throws ApisResourceAccessE defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2157,7 +2165,7 @@ public void deactivateTesApiResourceException() throws ApisResourceAccessExcepti defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2206,7 +2214,7 @@ public void deactivateTestAlreadyDeactivated() throws ApisResourceAccessExceptio defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(), anyString(), any(), any())).thenReturn("0.1"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2286,6 +2294,7 @@ public void testUinAlreadyDeactivated() throws ApisResourceAccessException, Pack .thenReturn(idResponseDTO); Mockito.when(registrationStatusMapperUtil .getStatusCode(RegistrationExceptionTypeCode.PACKET_UIN_GENERATION_REPROCESS)).thenReturn("REPROCESS"); + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldsMap); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); @@ -2311,7 +2320,7 @@ public void testUinUpdationFaliure() throws Exception { defaultFields.add("gender"); defaultFields.add("UIN"); - + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); @@ -2475,4 +2484,144 @@ public void testUinGenerationSuccessWithEmptyName() throws Exception { assertFalse(result.getInternalError()); assertTrue(result.getIsValid()); } + + @Test + public void testUinGenerationSuccessWithSelectedHanhle() throws Exception { + ReflectionTestUtils.setField(uinGeneratorStage,"trimWhitespaces",true); + Map fieldMap = new HashMap<>(); + fieldMap.put("selectedHandles","[\n" + + " \"nrcId\",\n" + + " \"email\",\n" + + " \"phoneNumber\"\n" + + " ]"); + fieldMap.put("email", "mono@mono.com"); + fieldMap.put("phoneNumber", "23456"); + fieldMap.put("dob", "11/11/2011"); + when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(IdRequestDto.class); + + MessageDTO messageDTO = new MessageDTO(); + messageDTO.setRid("27847657360002520181210094052"); + messageDTO.setReg_type(RegistrationType.NEW.name()); + + IdResponseDTO idResponseDTO = new IdResponseDTO(); + ResponseDTO responseDTO = new ResponseDTO(); + responseDTO.setStatus("ACTIVATED"); + idResponseDTO.setErrors(null); + idResponseDTO.setId("mosip.id.update"); + idResponseDTO.setResponse(responseDTO); + idResponseDTO.setResponsetime("2019-01-17T06:29:01.940Z"); + idResponseDTO.setVersion("1.0"); + + when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY)).thenReturn(identityObj); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.DOCUMENT)).thenReturn(documentObj); + + MessageDTO result = uinGeneratorStage.process(messageDTO); + verify(idrepoDraftService).idrepoUpdateDraft(any(), any(), argumentCaptor.capture()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonobject=objectMapper.writeValueAsString(argumentCaptor.getAllValues().get(0).getRequest().getIdentity()); + JsonNode jsonNode=objectMapper.readTree(jsonobject); + + assertEquals("nrcId",jsonNode.get("selectedHandles").get(0).asText()); + assertEquals("email",jsonNode.get("selectedHandles").get(1).asText()); + assertEquals("phoneNumber",jsonNode.get("selectedHandles").get(2).asText()); + assertFalse(result.getInternalError()); + assertTrue(result.getIsValid()); + } + + @Test + public void testUinGenerationSuccessWithObjectDataType () throws Exception { + ReflectionTestUtils.setField(uinGeneratorStage,"trimWhitespaces",true); + Map fieldMap = new HashMap<>(); + fieldMap.put("individualBiometrics","{\n" + + " \"format\": \"cbeff\",\n" + + " \"value\": \"individualBiometrics_bio_CBEFF\",\n" + + " \"version\": 1\n" + + " }"); + fieldMap.put("email", "mono@mono.com"); + fieldMap.put("phoneNumber", "23456"); + fieldMap.put("dob", "11/11/2011"); + when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(IdRequestDto.class); + + MessageDTO messageDTO = new MessageDTO(); + messageDTO.setRid("27847657360002520181210094052"); + messageDTO.setReg_type(RegistrationType.NEW.name()); + + IdResponseDTO idResponseDTO = new IdResponseDTO(); + ResponseDTO responseDTO = new ResponseDTO(); + responseDTO.setStatus("ACTIVATED"); + idResponseDTO.setErrors(null); + idResponseDTO.setId("mosip.id.update"); + idResponseDTO.setResponse(responseDTO); + idResponseDTO.setResponsetime("2019-01-17T06:29:01.940Z"); + idResponseDTO.setVersion("1.0"); + + when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY)).thenReturn(identityObj); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.DOCUMENT)).thenReturn(documentObj); + + MessageDTO result = uinGeneratorStage.process(messageDTO); + verify(idrepoDraftService).idrepoUpdateDraft(any(), any(), argumentCaptor.capture()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonobject=objectMapper.writeValueAsString(argumentCaptor.getAllValues().get(0).getRequest().getIdentity()); + JsonNode jsonNode=objectMapper.readTree(jsonobject); + + assertEquals("cbeff",jsonNode.get("individualBiometrics").get("format").asText()); + assertFalse(result.getInternalError()); + assertTrue(result.getIsValid()); + } + + @Test + public void updateTestWithAdditionalProcess() throws ApisResourceAccessException, IOException, JsonProcessingException, + PacketManagerException, JSONException, IdrepoDraftException, IdrepoDraftReprocessableException { + Map externalInternalMap = new HashMap<>(); + externalInternalMap.put("CRVS_UPDATE", "UPDATE"); + ReflectionTestUtils.setField(uinGeneratorStage, "additionalProcessCategoryMapping", externalInternalMap); + Map fieldMap = new HashMap<>(); + fieldMap.put("UIN", "123456"); + fieldMap.put("name", "mono"); + fieldMap.put("email", "mono@mono.com"); + + List defaultFields = new ArrayList<>(); + defaultFields.add("name"); + defaultFields.add("dob"); + defaultFields.add("gender"); + defaultFields.add("UIN"); + + when(utility.getUIn(any(),any(),any(ProviderStageName.class))).thenReturn("123456"); + when(packetManagerService.getFields(any(), any(), any(), any())).thenReturn(fieldMap); + + when(packetManagerService.getFieldByMappingJsonKey(anyString(),anyString(),any(),any())).thenReturn("0.1"); + when(packetManagerService.getFields(anyString(),anyList(),anyString(),any())).thenReturn(fieldMap); + when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); + + when(idSchemaUtil.getDefaultFields(anyDouble())).thenReturn(defaultFields); + MessageDTO messageDTO = new MessageDTO(); + messageDTO.setRid("10031100110005020190313110030"); + messageDTO.setReg_type("CRVS_UPDATE"); + IdResponseDTO responsedto = new IdResponseDTO(); + + IdResponseDTO idResponseDTO = new IdResponseDTO(); + ResponseDTO responseDTO = new ResponseDTO(); + idResponseDTO.setErrors(null); + idResponseDTO.setId("mosip.id.update"); + responseDTO.setStatus("ACTIVATED"); + idResponseDTO.setResponse(responseDTO); + idResponseDTO.setResponsetime("2019-03-12T06:49:30.779Z"); + idResponseDTO.setVersion("1.0"); + + when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); + when(registrationProcessorRestClientService.getApi(any(), any(), anyString(), any(), any())) + .thenReturn(responsedto); + when(registrationProcessorRestClientService.patchApi(any(), any(), any(), any(), any(), any())) + .thenReturn(idResponseDTO); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY)).thenReturn(identityObj); + when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.DOCUMENT)).thenReturn(documentObj); + + MessageDTO result = uinGeneratorStage.process(messageDTO); + assertTrue(result.getIsValid()); + assertFalse(result.getInternalError()); + } } \ No newline at end of file diff --git a/registration-processor/core-processor/registration-processor-verification-stage/pom.xml b/registration-processor/core-processor/registration-processor-verification-stage/pom.xml index 5be0233fbd7..9ad66ec787c 100644 --- a/registration-processor/core-processor/registration-processor-verification-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-verification-stage/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor core-processor - 1.2.0.1 + 1.2.1.0 registration-processor-verification-stage - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/init/pom.xml b/registration-processor/init/pom.xml index 3070a69db67..3bc6a680694 100644 --- a/registration-processor/init/pom.xml +++ b/registration-processor/init/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 init - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/init/registration-processor-dmz-packet-server/Dockerfile b/registration-processor/init/registration-processor-dmz-packet-server/Dockerfile index a0ded0a963d..038adefd911 100644 --- a/registration-processor/init/registration-processor-dmz-packet-server/Dockerfile +++ b/registration-processor/init/registration-processor-dmz-packet-server/Dockerfile @@ -1,11 +1,20 @@ -FROM nginx - -VOLUME /home/mosip - -COPY nginx.conf /etc/nginx/nginx.conf - -COPY healthcheck.txt /home/mosip/landing/healthcheck.txt - -EXPOSE 8082 - -CMD ["nginx", "-g", "daemon off;"] +FROM nginx + +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + +VOLUME /home/mosip + +COPY nginx.conf /etc/nginx/nginx.conf + +COPY healthcheck.txt /home/mosip/landing/healthcheck.txt + +EXPOSE 8082 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/registration-processor/init/registration-processor-dmz-packet-server/version.xml b/registration-processor/init/registration-processor-dmz-packet-server/version.xml index 0caefe39b1b..d3f718fd285 100644 --- a/registration-processor/init/registration-processor-dmz-packet-server/version.xml +++ b/registration-processor/init/registration-processor-dmz-packet-server/version.xml @@ -1,2 +1,2 @@ -1.2.0.1-SNAPSHOT +1.2.1.0-SNAPSHOT diff --git a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml index dc7fd87d24e..08043904157 100644 --- a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml +++ b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor init - 1.2.0.1 + 1.2.1.0 registration-processor-packet-receiver-stage - 1.2.0.1 + 1.2.1.0 jar registration-processor-packet-receiver-stage diff --git a/registration-processor/init/registration-processor-packet-receiver-stage/src/main/java/io/mosip/registration/processor/packet/receiver/service/impl/PacketReceiverServiceImpl.java b/registration-processor/init/registration-processor-packet-receiver-stage/src/main/java/io/mosip/registration/processor/packet/receiver/service/impl/PacketReceiverServiceImpl.java index 7964727284c..dceb4550962 100644 --- a/registration-processor/init/registration-processor-packet-receiver-stage/src/main/java/io/mosip/registration/processor/packet/receiver/service/impl/PacketReceiverServiceImpl.java +++ b/registration-processor/init/registration-processor-packet-receiver-stage/src/main/java/io/mosip/registration/processor/packet/receiver/service/impl/PacketReceiverServiceImpl.java @@ -523,7 +523,8 @@ public MessageDTO processPacket(File file) { DirectoryPathDto.LANDING_ZONE); } else if(landingZoneType.equalsIgnoreCase(LandingZoneTypeConstant.OBJECT_STORE)) { - boolean result =objectStoreAdapter.putObject(landingZoneAccount, registrationId, null, null, packetId, encryptedInputStream); + boolean result = objectStoreAdapter.putObject(landingZoneAccount, registrationId, null, null, + packetId, new ByteArrayInputStream(encryptedByteArray)); if(!result) { throw new ObjectStoreNotAccessibleException("Failed to store packet : " + packetId); } diff --git a/registration-processor/init/registration-processor-registration-status-service/Dockerfile b/registration-processor/init/registration-processor-registration-status-service/Dockerfile index 6f4b8b88b67..5d1c142e1c0 100644 --- a/registration-processor/init/registration-processor-registration-status-service/Dockerfile +++ b/registration-processor/init/registration-processor-registration-status-service/Dockerfile @@ -1,5 +1,14 @@ FROM openjdk:11 +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + #Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image #FROM openjdk:8-jdk-alpine diff --git a/registration-processor/init/registration-processor-registration-status-service/pom.xml b/registration-processor/init/registration-processor-registration-status-service/pom.xml index 9ac761be270..ea7e57bc8a6 100644 --- a/registration-processor/init/registration-processor-registration-status-service/pom.xml +++ b/registration-processor/init/registration-processor-registration-status-service/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor init - 1.2.0.1 + 1.2.1.0 registration-processor-registration-status-service - 1.2.0.1 + 1.2.1.0 registration-processor-registration-status-service diff --git a/registration-processor/mosip-stage-executor/pom.xml b/registration-processor/mosip-stage-executor/pom.xml index 5253f7e9848..b06bd619d10 100644 --- a/registration-processor/mosip-stage-executor/pom.xml +++ b/registration-processor/mosip-stage-executor/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 mosip-stage-executor - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/pom.xml b/registration-processor/pom.xml index 108513e41b8..4e045a541b5 100644 --- a/registration-processor/pom.xml +++ b/registration-processor/pom.xml @@ -23,7 +23,7 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 pom registration-processor @@ -122,13 +122,13 @@ 0.1.55 - 1.2.0.1 - 1.2.0.1 - 1.2.0.1 - 1.2.0.1 - 1.2.0.1 - 1.2.0.1 - 1.2.0.1 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 1.2.0.1 @@ -147,6 +147,7 @@ 1.2.0.1 1.2.0.1 1.2.0.1 + 1.2.0.1 **/dto/**, **/exception/*Exception.java, **/config/*Config.java, diff --git a/registration-processor/post-processor/pom.xml b/registration-processor/post-processor/pom.xml index 1cb6d98e72b..bf874cccdce 100644 --- a/registration-processor/post-processor/pom.xml +++ b/registration-processor/post-processor/pom.xml @@ -1,22 +1,22 @@ - - - 4.0.0 - pom - - io.mosip.registrationprocessor - registration-processor - 1.2.0.1 - - 1.2.0.1 - post-processor - post-processor - - UTF-8 - - - registration-processor-message-sender-stage - registration-processor-credential-requestor-stage - registration-processor-registration-transaction-service - - + + + 4.0.0 + pom + + io.mosip.registrationprocessor + registration-processor + 1.2.1.0 + + 1.2.1.0 + post-processor + post-processor + + UTF-8 + + + registration-processor-message-sender-stage + registration-processor-credential-requestor-stage + registration-processor-registration-transaction-service + + diff --git a/registration-processor/post-processor/registration-processor-credential-requestor-stage/pom.xml b/registration-processor/post-processor/registration-processor-credential-requestor-stage/pom.xml index 42b6df248be..efec552509e 100644 --- a/registration-processor/post-processor/registration-processor-credential-requestor-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-credential-requestor-stage/pom.xml @@ -1,111 +1,111 @@ - - - 4.0.0 - - io.mosip.registrationprocessor - post-processor - 1.2.0.1 - - registration-processor-credential-requestor-stage - 1.2.0.1 - - UTF-8 - UTF-8 - - - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-config.version} - - - org.mockito - mockito-core - ${mockito.version} - test - - - com.h2database - h2 - ${h2.version} - - - - - - org.springframework - spring-context - ${spring-framework.version} - - - org.springframework - spring-tx - ${spring-framework.version} - - - io.vertx - vertx-unit - ${vertx.version} - test - - - io.vertx - vertx-web-client - ${vertx.version} - - - org.apache.httpcomponents - httpmime - 4.3.1 - - - io.mosip.registrationprocessor - registration-processor-core - ${registration.processor.core.version} - - - io.mosip.registrationprocessor - registration-processor-registration-status-service-impl - ${registration.status.service.version} - - - io.mosip.registrationprocessor - registration-processor-rest-client - ${registration.processor.rest.client.version} - - - org.mvel - mvel2 - 2.4.12.Final - - - junit - junit - test - - - org.powermock - powermock-module-junit4 - ${powermock.module.junit4.version} - test - - - org.powermock - powermock-api-mockito2 - ${powermock.api.mockito.version} - test - - - io.mosip.registrationprocessor - registration-processor-info-storage-service - ${packet.info.storage.service.version} - - - - - - - + + + 4.0.0 + + io.mosip.registrationprocessor + post-processor + 1.2.1.0 + + registration-processor-credential-requestor-stage + 1.2.1.0 + + UTF-8 + UTF-8 + + + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-config.version} + + + org.mockito + mockito-core + ${mockito.version} + test + + + com.h2database + h2 + ${h2.version} + + + + + + org.springframework + spring-context + ${spring-framework.version} + + + org.springframework + spring-tx + ${spring-framework.version} + + + io.vertx + vertx-unit + ${vertx.version} + test + + + io.vertx + vertx-web-client + ${vertx.version} + + + org.apache.httpcomponents + httpmime + 4.3.1 + + + io.mosip.registrationprocessor + registration-processor-core + ${registration.processor.core.version} + + + io.mosip.registrationprocessor + registration-processor-registration-status-service-impl + ${registration.status.service.version} + + + io.mosip.registrationprocessor + registration-processor-rest-client + ${registration.processor.rest.client.version} + + + org.mvel + mvel2 + 2.4.12.Final + + + junit + junit + test + + + org.powermock + powermock-module-junit4 + ${powermock.module.junit4.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.api.mockito.version} + test + + + io.mosip.registrationprocessor + registration-processor-info-storage-service + ${packet.info.storage.service.version} + + + + + + + diff --git a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml index 7c564fced35..8a3ce7fd460 100644 --- a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor post-processor - 1.2.0.1 + 1.2.1.0 registration-processor-message-sender-stage - 1.2.0.1 + 1.2.1.0 UTF-8 UTF-8 diff --git a/registration-processor/post-processor/registration-processor-registration-transaction-service/Dockerfile b/registration-processor/post-processor/registration-processor-registration-transaction-service/Dockerfile index 1d6dfc2031a..f4f55286b62 100644 --- a/registration-processor/post-processor/registration-processor-registration-transaction-service/Dockerfile +++ b/registration-processor/post-processor/registration-processor-registration-transaction-service/Dockerfile @@ -1,5 +1,14 @@ FROM openjdk:11 +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + #Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image #FROM openjdk:8-jdk-alpine diff --git a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml index 035c98fe7e2..ff5a7ba1830 100644 --- a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml +++ b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor post-processor - 1.2.0.1 + 1.2.1.0 registration-processor-registration-transaction-service - 1.2.0.1 + 1.2.1.0 registration-processor-registration-transaction-service UTF-8 diff --git a/registration-processor/pre-processor/pom.xml b/registration-processor/pre-processor/pom.xml index cb84ff3c167..ff673e7161c 100644 --- a/registration-processor/pre-processor/pom.xml +++ b/registration-processor/pre-processor/pom.xml @@ -7,9 +7,9 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 - 1.2.0.1 + 1.2.1.0 pre-processor pre-processor diff --git a/registration-processor/pre-processor/registration-processor-cmd-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-cmd-validator-stage/pom.xml index 511ddba8e67..208b3580438 100644 --- a/registration-processor/pre-processor/registration-processor-cmd-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-cmd-validator-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-cmd-validator-stage - 1.2.0.1 + 1.2.1.0 registration-processor-cmd-validator-stage UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-introducer-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-introducer-validator-stage/pom.xml index 75dd868d51d..c072bc7247d 100644 --- a/registration-processor/pre-processor/registration-processor-introducer-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-introducer-validator-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-introducer-validator-stage - 1.2.0.1 + 1.2.1.0 registration-processor-introducer-validator-stage UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-operator-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-operator-validator-stage/pom.xml index 7fc3d0804fe..ede28a82945 100644 --- a/registration-processor/pre-processor/registration-processor-operator-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-operator-validator-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-operator-validator-stage - 1.2.0.1 + 1.2.1.0 registration-processor-operator-validator-stage UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml index d0a172f2f3f..42d9cf15405 100644 --- a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-packet-classifier-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml index 35cd8db8546..7a5bd5906f8 100644 --- a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml @@ -9,9 +9,9 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml index d3e4625cc80..feef5818997 100644 --- a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-packet-validator-stage - 1.2.0.1 + 1.2.1.0 jar UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-validator-stage/src/main/java/io/mosip/registration/processor/stages/utils/NotificationUtility.java b/registration-processor/pre-processor/registration-processor-packet-validator-stage/src/main/java/io/mosip/registration/processor/stages/utils/NotificationUtility.java index 92881b9ea38..3ac3bcd2dac 100644 --- a/registration-processor/pre-processor/registration-processor-packet-validator-stage/src/main/java/io/mosip/registration/processor/stages/utils/NotificationUtility.java +++ b/registration-processor/pre-processor/registration-processor-packet-validator-stage/src/main/java/io/mosip/registration/processor/stages/utils/NotificationUtility.java @@ -95,6 +95,10 @@ public class NotificationUtility { @Value("${mosip.default.user-preferred-language-attribute:#{null}}") private String userPreferredLanguageAttribute; + + @Value("#{${registration.processor.notification.additional-process.category-mapping:{:}}}") + private Map additionalProcessCategoryForNotification; + /** The env. */ @Autowired private Environment env; @@ -394,10 +398,10 @@ private ResponseDto sendEmail(String mailTo, String subjectArtifact, String arti String apiHost = env.getProperty(ApiName.EMAILNOTIFIER.name()); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiHost); - builder.queryParam("mailTo", mailTo); + params.add("mailTo", mailTo); - builder.queryParam("mailSubject", subjectArtifact); - builder.queryParam("mailContent", artifact); + params.add("mailSubject", subjectArtifact); + params.add("mailContent", artifact); params.add("attachments", null); @@ -416,12 +420,15 @@ private ResponseDto sendEmail(String mailTo, String subjectArtifact, String arti } private NotificationTemplateType setNotificationTemplateType(InternalRegistrationStatusDto registrationStatusDto, - NotificationTemplateType type) { + NotificationTemplateType type) { + String internalProcess = utility.getInternalProcess(additionalProcessCategoryForNotification, registrationStatusDto.getRegistrationType()); if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.LOST.getValue())) type = NotificationTemplateType.LOST_UIN; - else if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.NEW.getValue())) + else if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.NEW.getValue()) || + internalProcess.equalsIgnoreCase(SyncTypeDto.NEW.getValue())) type = NotificationTemplateType.NEW_REG; - else if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.UPDATE.getValue())) + else if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.UPDATE.getValue())|| + internalProcess.equalsIgnoreCase(SyncTypeDto.UPDATE.getValue())) type = NotificationTemplateType.UIN_UPDATE; else if (registrationStatusDto.getRegistrationType().equalsIgnoreCase(SyncTypeDto.RES_REPRINT.getValue())) type = NotificationTemplateType.REPRINT_UIN; diff --git a/registration-processor/pre-processor/registration-processor-quality-classifier-stage/pom.xml b/registration-processor/pre-processor/registration-processor-quality-classifier-stage/pom.xml index 348c648df3d..91e47e50a71 100644 --- a/registration-processor/pre-processor/registration-processor-quality-classifier-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-quality-classifier-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-quality-classifier-stage - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml index d3ce4310014..930b7fae2e0 100644 --- a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml @@ -5,10 +5,10 @@ pre-processor io.mosip.registrationprocessor - 1.2.0.1 + 1.2.1.0 4.0.0 - 1.2.0.1 + 1.2.1.0 registration-processor-securezone-notification-stage diff --git a/registration-processor/pre-processor/registration-processor-supervisor-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-supervisor-validator-stage/pom.xml index 78fd91d1ec6..87f51d7d09f 100644 --- a/registration-processor/pre-processor/registration-processor-supervisor-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-supervisor-validator-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor pre-processor - 1.2.0.1 + 1.2.1.0 registration-processor-supervisor-validator-stage - 1.2.0.1 + 1.2.1.0 registration-processor-supervisor-validator-stage UTF-8 diff --git a/registration-processor/qc-users-manger/pom.xml b/registration-processor/qc-users-manger/pom.xml index c18da4a005b..422bc601174 100644 --- a/registration-processor/qc-users-manger/pom.xml +++ b/registration-processor/qc-users-manger/pom.xml @@ -5,11 +5,11 @@ qc-users-manger - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml index 46d9250b4f7..9bf24c3c3a8 100644 --- a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml +++ b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-bio-dedupe-service-impl - 1.2.0.1 + 1.2.1.0 registration-processor-bio-dedupe-service-impl @@ -44,7 +44,7 @@ commons-io commons-io - 2.6 + 2.14.0 com.h2database diff --git a/registration-processor/registration-processor-common-camel-bridge/dependency-reduced-pom.xml b/registration-processor/registration-processor-common-camel-bridge/dependency-reduced-pom.xml index 69896df6196..e6faed12b17 100644 --- a/registration-processor/registration-processor-common-camel-bridge/dependency-reduced-pom.xml +++ b/registration-processor/registration-processor-common-camel-bridge/dependency-reduced-pom.xml @@ -3,11 +3,11 @@ registration-processor io.mosip.registrationprocessor - 1.2.0.1 + 1.2.1.0 4.0.0 registration-processor-common-camel-bridge - 1.2.0.1 + 1.2.1.0 @@ -102,7 +102,7 @@ io.mosip.registration.processor.camel.bridge.MosipCamelBridge 1.0.5 - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/registration-processor-common-camel-bridge/pom.xml b/registration-processor/registration-processor-common-camel-bridge/pom.xml index 42de8bd5870..ed8a2a56bfa 100644 --- a/registration-processor/registration-processor-common-camel-bridge/pom.xml +++ b/registration-processor/registration-processor-common-camel-bridge/pom.xml @@ -6,16 +6,16 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-common-camel-bridge - 1.2.0.1 + 1.2.1.0 jar io.mosip.registration.processor.camel.bridge.MosipCamelBridge 1.0.5 - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/registration-processor-core/pom.xml b/registration-processor/registration-processor-core/pom.xml index 3f7ea3481ac..a934cc00744 100644 --- a/registration-processor/registration-processor-core/pom.xml +++ b/registration-processor/registration-processor-core/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-core - 1.2.0.1 + 1.2.1.0 org.mockito diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/code/ModuleName.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/code/ModuleName.java index 701e706dc11..fda90feda5c 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/code/ModuleName.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/code/ModuleName.java @@ -77,7 +77,11 @@ public enum ModuleName { WORKFLOW_ACTION_SERVICE, + WORKFLOW_INSTANCE_SERVICE, + WORKFLOW_ACTION_API, + WORKFLOW_INSTANCE_API, + WORKFLOW_ACTION_JOB; } diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/APIAuthorityList.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/APIAuthorityList.java index b3bc7bf14f6..e5cf8405e5d 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/APIAuthorityList.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/APIAuthorityList.java @@ -34,6 +34,8 @@ public enum APIAuthorityList { WORKFLOWSEARCH(new String[] { "REGISTRATION_PROCESSOR", "GLOBAL_ADMIN" }), + WORKFLOWINSTANCE(new String[] { "ONLINE_REGISTRATION_CLIENT","REGISTRATION_PROCESSOR", "GLOBAL_ADMIN" }), + PACKETEXTERNALSTATUS( new String[] { "REGISTRATION_ADMIN", "REGISTRATION_OFFICER", "REGISTRATION_SUPERVISOR", "RESIDENT" }); diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceException.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceException.java new file mode 100644 index 00000000000..f55148e9d47 --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceException.java @@ -0,0 +1,35 @@ +package io.mosip.registration.processor.core.exception; + + +import io.mosip.kernel.core.exception.BaseCheckedException; + + +/** + * The Class WorkflowInstanceException. + */ +public class WorkflowInstanceException extends BaseCheckedException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new workflow instance exception. + * + * @param errorCode the error code + * @param message the message + */ + public WorkflowInstanceException(String errorCode, String message) { + super(errorCode, message); + } + + /** + * Instantiates a new workflow instance exception. + * + * @param errorCode the error code + * @param message the message + * @param t the t + */ + public WorkflowInstanceException(String errorCode, String message, Throwable t) { + super(errorCode, message, t); + } +} \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceRequestValidationException.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceRequestValidationException.java new file mode 100644 index 00000000000..203d149f1a0 --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/WorkflowInstanceRequestValidationException.java @@ -0,0 +1,30 @@ +package io.mosip.registration.processor.core.exception; + +import io.mosip.kernel.core.exception.BaseCheckedException; + +public class WorkflowInstanceRequestValidationException extends BaseCheckedException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new WorkflowInstanceRequestValidationException + * + * @param errorCode the error code + * @param message the message + */ + public WorkflowInstanceRequestValidationException(String errorCode, String message) { + super(errorCode, message); + } + + /** + * Instantiates a new WorkflowInstanceRequestValidationException + * + * @param errorCode the error code + * @param message the message + * @param t the t + */ + public WorkflowInstanceRequestValidationException(String errorCode, String message, Throwable t) { + super(errorCode, message, t); + } +} \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformConstants.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformConstants.java index 11e9e4657b2..f41379b5989 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformConstants.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformConstants.java @@ -132,9 +132,12 @@ public final class PlatformConstants { public static final String RPR_WORKFLOW_SEARCH_API = RPR_REGISTRATION_PROCESSOR_PREFIX + "WAA-"; + public static final String RPR_WORKFLOW_INSTANCE_API = RPR_REGISTRATION_PROCESSOR_PREFIX + "WIN-"; public static final String RPR_WORKFLOW_ACTION_SERVICE = RPR_REGISTRATION_PROCESSOR_PREFIX + "WAS-"; + public static final String RPR_WORKFLOW_INSTANCE_SERVICE = RPR_REGISTRATION_PROCESSOR_PREFIX + "WIS-"; + public static final String RPR_WORKFLOW_ACTION_JOB = RPR_REGISTRATION_PROCESSOR_PREFIX + "WAJ-"; public static final String RPR_FINALIZATION_STAGE = RPR_REGISTRATION_PROCESSOR_PREFIX + "FIN-"; diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java index 78ce28d105a..c2c6e72c589 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java @@ -1,7 +1,5 @@ package io.mosip.registration.processor.core.exception.util; -import io.mosip.registration.processor.core.status.util.StatusConstants; - // TODO: Auto-generated Javadoc /** * The Enum RPRPlatformErrorMessages. @@ -1322,8 +1320,16 @@ public enum PlatformErrorMessages { RPR_WAA_INVALID_INPUT_PARAMETER(PlatformConstants.RPR_WORKFLOW_ACTION_API + "001", "Invalid Request Value - %s"), + RPR_WIN_MISSING_INPUT_PARAMETER(PlatformConstants.RPR_WORKFLOW_INSTANCE_API + "000", + "Missing Request Value - %s"), + + RPR_WIN_INVALID_INPUT_PARAMETER(PlatformConstants.RPR_WORKFLOW_INSTANCE_API + "001", + "Invalid Request Value - %s"), + RPR_WAA_UNKNOWN_EXCEPTION(PlatformConstants.RPR_WORKFLOW_ACTION_API + "002", "Unknown Exception"), + RPR_WIN_UNKNOWN_EXCEPTION(PlatformConstants.RPR_WORKFLOW_INSTANCE_API + "002", "Unknown Exception"), + RPR_WAS_UNKNOWN_WORKFLOW_ACTION(PlatformConstants.RPR_WORKFLOW_ACTION_SERVICE + "000", "Workflow Action not supported"), @@ -1335,12 +1341,19 @@ public enum PlatformErrorMessages { RPR_WAS_UNKNOWN_EXCEPTION(PlatformConstants.RPR_WORKFLOW_ACTION_SERVICE + "003", "Unknown Exception"), + RPR_WIS_UNKNOWN_EXCEPTION(PlatformConstants.RPR_WORKFLOW_INSTANCE_SERVICE + "000", "Unknown Exception"), + + RPR_WIS_ALREADY_PRESENT_EXCEPTION(PlatformConstants.RPR_WORKFLOW_INSTANCE_SERVICE + "001", "WorkflowInstance already present"), + RPR_WAS_REPROCESS_FAILED(PlatformConstants.RPR_WORKFLOW_ACTION_SERVICE + "004", "When REPROCESS_FAILED then Resume should not occur"), + RPR_WAA_NOT_PAUSED(PlatformConstants.RPR_WORKFLOW_ACTION_API + "004", "Workflow id %s is not PAUSED"), + RPR_WIN_VALIDATION_SUCCESS(PlatformConstants.RPR_WORKFLOW_INSTANCE_API + "002", "Workflow instance request validated successfully"), + RPR_WAA_VALIDATION_SUCCESS(PlatformConstants.RPR_WORKFLOW_ACTION_API + "005", "Workflow id validated successfully"), RPR_WORKFLOW_ACTION_JOB_FAILED(PlatformConstants.RPR_WORKFLOW_ACTION_JOB, "Workflow action job failed"), diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformSuccessMessages.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformSuccessMessages.java index 51956273957..a1ee1f5586f 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformSuccessMessages.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformSuccessMessages.java @@ -88,8 +88,15 @@ public enum PlatformSuccessMessages { RPR_WORKFLOW_ACTION_SERVICE_SUCCESS(PlatformConstants.RPR_WORKFLOW_ACTION_SERVICE + "000", "Processed the workflow action - %s"), + RPR_WORKFLOW_INSTANCE_SERVICE_SUCCESS(PlatformConstants.RPR_WORKFLOW_INSTANCE_SERVICE + "000", + "Processed the workflow instance"), + RPR_WORKFLOW_ACTION_API_SUCCESS(PlatformConstants.RPR_WORKFLOW_ACTION_API + "000", "Process the workflow action success"), + + RPR_WORKFLOW_INSTANCE_API_SUCCESS(PlatformConstants.RPR_WORKFLOW_INSTANCE_API + "000", + "Process the workflow instance success"), + RPR_WORKFLOW_SEARCH_API_SUCCESS(PlatformConstants.RPR_WORKFLOW_SEARCH_API + "000", "Process the workflow search success"), RPR_WORKFLOW_ACTION_JOB_SUCCESS(PlatformConstants.RPR_WORKFLOW_ACTION_JOB + "000", "Workflow action job success"), diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java index c12c17cad5a..9151293328d 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java @@ -136,6 +136,8 @@ public final class StatusConstants { public static final String WORKFLOW_ACTION_SERVICE = RPR_REGISTRATION_PROCESSOR_PREFIX + "WAS-"; + public static final String WORKFLOW_INSTANCE_SERVICE = RPR_REGISTRATION_PROCESSOR_PREFIX + "WIS-"; + public static final String VERIFICATION_STAGE = RPR_REGISTRATION_PROCESSOR_PREFIX + "VER-"; diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java index 768420770d7..c10f3e97f11 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java @@ -364,6 +364,9 @@ public enum StatusUtil { WORKFLOW_ACTION_SERVICE_SUCCESS(StatusConstants.WORKFLOW_ACTION_SERVICE + "001", "Packet workflow resume successfully"), + + WORKFLOW_INSTANCE_SERVICE_SUCCESS(StatusConstants.WORKFLOW_INSTANCE_SERVICE + "001", + "Packet workflow instance created successfully"), MANUAL_ADJUDICATION_FAILED(PlatformConstants.RPR_MANUAL_ADJUDICATION_MODULE + "000", "manual verification failed -"), MANUAL_ADJUDICATION_RID_SHOULD_NOT_EMPTY_OR_NULL(PlatformConstants.RPR_MANUAL_ADJUDICATION_MODULE + "001", diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/token/validation/TokenValidator.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/token/validation/TokenValidator.java index 82e9fd12c39..0b387915c34 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/token/validation/TokenValidator.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/token/validation/TokenValidator.java @@ -115,6 +115,8 @@ else if (url.contains("workflowaction")) return String.join(",", APIAuthorityList.WORKFLOWACTION.getList()); else if (url.contains("workflow/search")) return String.join(",", APIAuthorityList.WORKFLOWSEARCH.getList()); + else if (url.contains("workflowinstance")) + return String.join(",", APIAuthorityList.WORKFLOWINSTANCE.getList()); return null; } @@ -187,7 +189,14 @@ else if (url.contains("workflowaction")) { if (role.contains(assignedRole)) return true; } - } else if (url.contains("packetexternalstatus")) { + } + else if (url.contains("workflowinstance")) { + for (String assignedRole : APIAuthorityList.WORKFLOWINSTANCE.getList()) { + if (role.contains(assignedRole)) + return true; + } + } + else if (url.contains("packetexternalstatus")) { for (String assignedRole : APIAuthorityList.PACKETEXTERNALSTATUS.getList()) { if (role.contains(assignedRole)) return true; diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/NotificationInfoDTO.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/NotificationInfoDTO.java new file mode 100644 index 00000000000..1f4f0bccd77 --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/NotificationInfoDTO.java @@ -0,0 +1,18 @@ +package io.mosip.registration.processor.core.workflow.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class NotificationInfoDTO implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 5493632810187324004L; + + private String name; + private String phone; + private String email; + } \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceDTO.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceDTO.java new file mode 100644 index 00000000000..ecc5709d40c --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceDTO.java @@ -0,0 +1,19 @@ +package io.mosip.registration.processor.core.workflow.dto; + + +import io.mosip.registration.processor.core.common.rest.dto.BaseRestRequestDTO; + +import lombok.Data; +import lombok.EqualsAndHashCode; +@EqualsAndHashCode(callSuper = true) +@Data +public class WorkflowInstanceDTO extends BaseRestRequestDTO { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private WorkflowInstanceRequestDTO request; + +} \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceRequestDTO.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceRequestDTO.java new file mode 100644 index 00000000000..2af57e7f83f --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceRequestDTO.java @@ -0,0 +1,19 @@ +package io.mosip.registration.processor.core.workflow.dto; + +import org.json.JSONObject; + +import lombok.Data; +@Data +public class WorkflowInstanceRequestDTO { + + private String registrationId; + + private String process; + + private String source; + + private String additionalInfoReqId; + + private NotificationInfoDTO notificationInfo; + +} \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponse.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponse.java new file mode 100644 index 00000000000..c325667722f --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponse.java @@ -0,0 +1,10 @@ +package io.mosip.registration.processor.core.workflow.dto; + +import lombok.Data; + +@Data +public class WorkflowInstanceResponse { + + private String workflowInstanceId; + +} \ No newline at end of file diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponseDTO.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponseDTO.java new file mode 100644 index 00000000000..9af941bf87a --- /dev/null +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/workflow/dto/WorkflowInstanceResponseDTO.java @@ -0,0 +1,20 @@ +package io.mosip.registration.processor.core.workflow.dto; + +import java.util.List; + +import io.mosip.registration.processor.core.common.rest.dto.BaseRestResponseDTO; +import io.mosip.registration.processor.core.common.rest.dto.ErrorDTO; +import lombok.Data; +@Data +public class WorkflowInstanceResponseDTO extends BaseRestResponseDTO { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private WorkflowInstanceResponse response; + + /** The error. */ + private List errors; +} \ No newline at end of file diff --git a/registration-processor/registration-processor-info-storage-service/pom.xml b/registration-processor/registration-processor-info-storage-service/pom.xml index c2ab483f216..bf513f8e9af 100644 --- a/registration-processor/registration-processor-info-storage-service/pom.xml +++ b/registration-processor/registration-processor-info-storage-service/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-info-storage-service - 1.2.0.1 + 1.2.1.0 registration-processor-info-storage-service UTF-8 @@ -139,5 +139,10 @@ kernel-biosdk-provider ${kernel-biosdk-provider.version} + + io.mosip.kernel + kernel-idvalidator-vid + ${kernel-idvalidator-vid.version} + diff --git a/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/config/PacketStorageBeanConfig.java b/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/config/PacketStorageBeanConfig.java index 7e8cf408d72..bc36fd2f08d 100644 --- a/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/config/PacketStorageBeanConfig.java +++ b/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/config/PacketStorageBeanConfig.java @@ -8,6 +8,8 @@ import javax.annotation.PostConstruct; import javax.crypto.SecretKey; +import io.mosip.kernel.core.idvalidator.spi.VidValidator; +import io.mosip.kernel.idvalidator.vid.impl.VidValidatorImpl; import io.mosip.registration.processor.packet.storage.helper.PacketManagerHelper; import io.mosip.registration.processor.packet.storage.utils.PacketManagerService; import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; @@ -127,4 +129,7 @@ public PacketManagerHelper packetManagerHelper() { public IdSchemaUtil getIdSchemaUtil() { return new IdSchemaUtil(); } + + @Bean + public VidValidator vidValidator(){return new VidValidatorImpl();} } diff --git a/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/utils/Utilities.java b/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/utils/Utilities.java index b4418f83811..264f26f2bf5 100644 --- a/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/utils/Utilities.java +++ b/registration-processor/registration-processor-info-storage-service/src/main/java/io/mosip/registration/processor/packet/storage/utils/Utilities.java @@ -4,16 +4,21 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.Duration; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.Period; +import java.time.*; import java.util.ArrayList; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import io.mosip.kernel.core.idvalidator.exception.InvalidIDException; +import io.mosip.kernel.core.idvalidator.spi.VidValidator; +import io.mosip.registration.processor.core.constant.AbisConstant; +import io.mosip.registration.processor.core.exception.*; +import io.mosip.registration.processor.core.idrepo.dto.IdResponseDTO; +import io.mosip.registration.processor.core.packet.dto.AdditionalInfoRequestDto; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceRequestDTO; +import io.mosip.registration.processor.status.service.AdditionalInfoRequestService; import org.apache.commons.lang.StringUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -34,10 +39,6 @@ import io.mosip.registration.processor.core.constant.LoggerFileConstant; import io.mosip.registration.processor.core.constant.MappingJsonConstants; import io.mosip.registration.processor.core.constant.ProviderStageName; -import io.mosip.registration.processor.core.exception.ApisResourceAccessException; -import io.mosip.registration.processor.core.exception.PacketManagerException; -import io.mosip.registration.processor.core.exception.RegistrationProcessorCheckedException; -import io.mosip.registration.processor.core.exception.RegistrationProcessorUnCheckedException; import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; import io.mosip.registration.processor.core.idrepo.dto.IdResponseDTO1; import io.mosip.registration.processor.core.idrepo.dto.ResponseDTO; @@ -160,6 +161,12 @@ public class Utilities { @Value("#{'${registration.processor.queue.trusted.packages}'.split(',')}") private List trustedPackages; + @Value("#{'${registration.processor.main-processes}'.split(',')}") + private List mainProcesses; + + @Value("${registration.processor.vid-support-for-update:false}") + private Boolean isVidSupportedForUpdate; + @Autowired private PacketInfoDao packetInfoDao; @@ -174,6 +181,14 @@ public class Utilities { @Autowired private PacketInfoManager packetInfoManager; + @Autowired + private AdditionalInfoRequestService additionalInfoRequestService; + + /** The vid validator. */ + @Autowired + private VidValidator vidValidator; + + /** The Constant INBOUNDQUEUENAME. */ private static final String INBOUNDQUEUENAME = "inboundQueueName"; @@ -593,11 +608,16 @@ public String getUIn(String id, String process, ProviderStageName stageName) regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), id, "Utilities::getUIn()::entry"); String UIN = packetManagerService.getFieldByMappingJsonKey(id, MappingJsonConstants.UIN, process, stageName); + if(isVidSupportedForUpdate && StringUtils.isNotEmpty(UIN) && validateVid(UIN)) { + regProcLogger.debug("VID structure validated successfully"); + JSONObject responseJson = retrieveIdrepoJson(UIN); + if (responseJson != null) { + UIN = JsonUtil.getJSONValue(responseJson, AbisConstant.UIN); + } + } regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), id, "Utilities::getUIn()::exit"); - return UIN; - } /** @@ -856,4 +876,30 @@ public String getRefId(String id, String refId) { return centerId + "_" + machineId; } +public String getInternalProcess(Map additionalProcessMap, String externalProcess){ + if (externalProcess == null) return ""; + String internalProcess = additionalProcessMap.get(externalProcess); + return internalProcess != null ? internalProcess : ""; + } + + public int getIterationForSyncRecord(Map additionalProcessMap, String process, String additionalRequestId) throws IOException { + if(mainProcesses.contains(process) || mainProcesses.contains(getInternalProcess(additionalProcessMap, process))) + return 1; + AdditionalInfoRequestDto additionalInfoRequestDto = additionalInfoRequestService + .getAdditionalInfoRequestByReqId(additionalRequestId); + if (additionalInfoRequestDto == null) + throw new AdditionalInfoIdNotFoundException(); + + return additionalInfoRequestDto.getAdditionalInfoIteration(); + } + + public boolean validateVid(String vid) { + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + "Utilities::validateVid()::entry"); + try { + return vidValidator.validateId(vid); + } catch (InvalidIDException e) { + return false; + } + } } \ No newline at end of file diff --git a/registration-processor/registration-processor-landing-zone/Dockerfile b/registration-processor/registration-processor-landing-zone/Dockerfile index b9e4a372aab..c1104542707 100644 --- a/registration-processor/registration-processor-landing-zone/Dockerfile +++ b/registration-processor/registration-processor-landing-zone/Dockerfile @@ -1,85 +1,94 @@ -FROM openjdk:11 - -#Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image -#FROM openjdk:8-jdk-alpine - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG spring_config_label - -# can be passed during Docker build as build time environment for spring profiles active -ARG active_profile - -# can be passed during Docker build as build time environment for config server URL -ARG spring_config_url - -# can be passed during Docker build as build time environment management rmi server hostname -ARG management_rmi_server_hostname - -# can be passed during Docker build as build time environment management rmi server port -ARG management_jmxremote_rmi_port - -# environment variable to pass active profile such as DEV, QA etc at docker runtime -ENV active_profile_env=${active_profile} - -# environment variable to pass github branch to pickup configuration from, at docker runtime -ENV spring_config_label_env=${spring_config_label} - -# environment variable to pass github branch to pickup configuration from, at docker runtime -ENV spring_config_label_env=${spring_config_label} - -# environment variable to pass iam_adapter url, at docker runtime -ENV iam_adapter_url_env=${iam_adapter_url} - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user=mosip -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_gid=1001 - -RUN apt-get -y update \ -&& apt-get install -y unzip sudo \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& adduser ${container_user} sudo - -# set working directory for the user -WORKDIR /home/${container_user} - -ENV work_dir=/home/${container_user} - -ARG loader_path=${work_dir}/additional_jars/ - -RUN mkdir -p ${loader_path} - -ENV loader_path_env=${loader_path} - -# change volume to whichever storage directory you want to use for this container. -VOLUME /home/ftp1/ARCHIVE_PACKET_LOCATION /home/ftp1/LANDING_ZONE ${work_dir}/logs ${work_dir}/Glowroot - -ADD ./target/registration-processor-landing-zone-*.jar registration-processor-landing-zone.jar - -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} - -# select container user for all tasks -USER ${container_user_uid}:${container_user_gid} - -CMD if [ "$active_profile_env" = "preprod" ]; then \ - wget 'http://13.71.87.138:8040/artifactory/libs-release-local/io/mosip/testing/glowroot.zip' ; \ - wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ - #java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar; \ - unzip glowroot.zip ; \ - rm -rf glowroot.zip ; \ - sed -i 's//registration-processor-registration-status-service/g' glowroot/glowroot.properties ; \ - java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -XX:+UseStringDeduplication -jar -javaagent:glowroot/glowroot.jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar ; \ - else \ - wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ - java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar; \ - fi - -#CMD ["java","-Dspring.cloud.config.label=${spring_config_label_env}","-Dspring.profiles.active=${active_profile_env}","-Dspring.cloud.config.uri=${spring_config_url_env}","-jar","-javaagent:/home/Glowroot/glowroot.jar","registration-processor-landing-zone.jar"] +FROM openjdk:11 + +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + +#Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image +#FROM openjdk:8-jdk-alpine + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG spring_config_label + +# can be passed during Docker build as build time environment for spring profiles active +ARG active_profile + +# can be passed during Docker build as build time environment for config server URL +ARG spring_config_url + +# can be passed during Docker build as build time environment management rmi server hostname +ARG management_rmi_server_hostname + +# can be passed during Docker build as build time environment management rmi server port +ARG management_jmxremote_rmi_port + +# environment variable to pass active profile such as DEV, QA etc at docker runtime +ENV active_profile_env=${active_profile} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# environment variable to pass iam_adapter url, at docker runtime +ENV iam_adapter_url_env=${iam_adapter_url} + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user=mosip +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_group=mosip + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_uid=1001 + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_gid=1001 + +RUN apt-get -y update \ +&& apt-get install -y unzip sudo \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& adduser ${container_user} sudo + +# set working directory for the user +WORKDIR /home/${container_user} + +ENV work_dir=/home/${container_user} + +ARG loader_path=${work_dir}/additional_jars/ + +RUN mkdir -p ${loader_path} + +ENV loader_path_env=${loader_path} + +# change volume to whichever storage directory you want to use for this container. +VOLUME /home/ftp1/ARCHIVE_PACKET_LOCATION /home/ftp1/LANDING_ZONE ${work_dir}/logs ${work_dir}/Glowroot + +ADD ./target/registration-processor-landing-zone-*.jar registration-processor-landing-zone.jar + +# change permissions of file inside working dir +RUN chown -R ${container_user}:${container_user} /home/${container_user} + +# select container user for all tasks +USER ${container_user_uid}:${container_user_gid} + +CMD if [ "$active_profile_env" = "preprod" ]; then \ + wget 'http://13.71.87.138:8040/artifactory/libs-release-local/io/mosip/testing/glowroot.zip' ; \ + wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ + #java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar; \ + unzip glowroot.zip ; \ + rm -rf glowroot.zip ; \ + sed -i 's//registration-processor-registration-status-service/g' glowroot/glowroot.properties ; \ + java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -XX:+UseStringDeduplication -jar -javaagent:glowroot/glowroot.jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar ; \ + else \ + wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ + java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" registration-processor-landing-zone.jar; \ + fi + +#CMD ["java","-Dspring.cloud.config.label=${spring_config_label_env}","-Dspring.profiles.active=${active_profile_env}","-Dspring.cloud.config.uri=${spring_config_url_env}","-jar","-javaagent:/home/Glowroot/glowroot.jar","registration-processor-landing-zone.jar"] diff --git a/registration-processor/registration-processor-landing-zone/pom.xml b/registration-processor/registration-processor-landing-zone/pom.xml index ed97ba99ef2..950a8201a9e 100644 --- a/registration-processor/registration-processor-landing-zone/pom.xml +++ b/registration-processor/registration-processor-landing-zone/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-landing-zone registration-processor-landing-zone - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/registration-processor-message-sender-impl/pom.xml b/registration-processor/registration-processor-message-sender-impl/pom.xml index bb35f136232..433ad1df4ca 100644 --- a/registration-processor/registration-processor-message-sender-impl/pom.xml +++ b/registration-processor/registration-processor-message-sender-impl/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-message-sender-impl - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/registration-processor-notification-service/pom.xml b/registration-processor/registration-processor-notification-service/pom.xml index de69ecf163a..07b02ea65a5 100644 --- a/registration-processor/registration-processor-notification-service/pom.xml +++ b/registration-processor/registration-processor-notification-service/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-notification-service - 1.2.0.1 + 1.2.1.0 UTF-8 UTF-8 diff --git a/registration-processor/registration-processor-notification-service/src/main/java/io/mosip/registration/processor/notification/service/impl/NotificationServiceImpl.java b/registration-processor/registration-processor-notification-service/src/main/java/io/mosip/registration/processor/notification/service/impl/NotificationServiceImpl.java index dfb19f608fb..86b390dc283 100644 --- a/registration-processor/registration-processor-notification-service/src/main/java/io/mosip/registration/processor/notification/service/impl/NotificationServiceImpl.java +++ b/registration-processor/registration-processor-notification-service/src/main/java/io/mosip/registration/processor/notification/service/impl/NotificationServiceImpl.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +import io.mosip.registration.processor.packet.storage.utils.Utilities; import org.json.JSONException; import org.json.simple.parser.ParseException; import org.springframework.beans.factory.annotation.Autowired; @@ -93,8 +94,6 @@ public class NotificationServiceImpl implements NotificationService { private static final String DUPLICATE_UIN=NOTIFICATION_TEMPLATE_CODE+"duplicate.uin."; private static final String TECHNICAL_ISSUE=NOTIFICATION_TEMPLATE_CODE+"technical.issue."; private static final String PAUSED_FOR_ADDITIONAL_INFO=NOTIFICATION_TEMPLATE_CODE+"paused.for.additional.info."; - - /** The core audit request builder. */ @Autowired private AuditLogRequestBuilder auditLogRequestBuilder; @@ -102,6 +101,9 @@ public class NotificationServiceImpl implements NotificationService { @Autowired private ObjectMapper mapper; + @Autowired + Utilities utilities; + /** The notification emails. */ @Value("${registration.processor.notification.emails}") private String notificationEmails; @@ -130,6 +132,10 @@ public class NotificationServiceImpl implements NotificationService { @Value("${registration.processor.notification_service_pausedforadditonalinfo_subscriber_callback_url}") private String pausedForAdditonalInfoCallbackURL; + + @Value("#{${registration.processor.notification.additional-process.category-mapping:{:}}}") + private Map additionalProcessCategoryForNotification; + /** The rest client service. */ @Autowired private RegistrationProcessorRestClientService restClientService; @@ -274,14 +280,17 @@ public ResponseEntity process(@RequestBody WorkflowCompletedEventDTO objec } - private NotificationTemplateType setNotificationTemplateType(String regtype) { + private NotificationTemplateType setNotificationTemplateType(String regtype){ NotificationTemplateType type=null; + String internalProcess= utilities.getInternalProcess(additionalProcessCategoryForNotification, regtype); if (regtype.equalsIgnoreCase(RegistrationType.LOST.toString())) type = NotificationTemplateType.LOST_UIN; - else if (regtype.equalsIgnoreCase(RegistrationType.NEW.toString())) + else if (regtype.equalsIgnoreCase(RegistrationType.NEW.toString())|| + internalProcess.equalsIgnoreCase(RegistrationType.NEW.toString())) type = NotificationTemplateType.UIN_CREATED; else if (regtype.equalsIgnoreCase(RegistrationType.UPDATE.toString()) - || regtype.equalsIgnoreCase(RegistrationType.RES_UPDATE.toString())) + || regtype.equalsIgnoreCase(RegistrationType.RES_UPDATE.toString()) + ||internalProcess.equalsIgnoreCase(RegistrationType.UPDATE.toString())) type = NotificationTemplateType.UIN_UPDATE; else if (regtype.equalsIgnoreCase(RegistrationType.ACTIVATED.toString())) type = NotificationTemplateType.UIN_UPDATE; @@ -450,6 +459,7 @@ private boolean sendSms(String id, String process, Map attribute */ private void setTemplateAndSubject(NotificationTemplateType templatetype, String regType, MessageSenderDto messageSenderDto) { + String internalProcess= utilities.getInternalProcess(additionalProcessCategoryForNotification, regType); switch (templatetype) { case LOST_UIN: messageSenderDto.setSmsTemplateCode(env.getProperty(LOST_UIN+SMS)); @@ -480,7 +490,8 @@ private void setTemplateAndSubject(NotificationTemplateType templatetype, String messageSenderDto.setIdType(IdType.UIN); messageSenderDto.setSubjectCode(env.getProperty(UIN_DEACTIVATE+SUB)); } else if (regType.equalsIgnoreCase(RegistrationType.UPDATE.name()) - || regType.equalsIgnoreCase(RegistrationType.RES_UPDATE.name())) { + || regType.equalsIgnoreCase(RegistrationType.RES_UPDATE.name()) + || internalProcess.equalsIgnoreCase(RegistrationType.UPDATE.toString())){ messageSenderDto.setSmsTemplateCode(env.getProperty(UIN_UPDATE+SMS)); messageSenderDto.setEmailTemplateCode(env.getProperty(UIN_UPDATE+EMAIL)); messageSenderDto.setIdType(IdType.UIN); diff --git a/registration-processor/registration-processor-packet-manager/pom.xml b/registration-processor/registration-processor-packet-manager/pom.xml index 7fc4de5a7a4..b46b197f65a 100644 --- a/registration-processor/registration-processor-packet-manager/pom.xml +++ b/registration-processor/registration-processor-packet-manager/pom.xml @@ -7,12 +7,12 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-packet-manager registration-processor-packet-manager - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/registration-processor-registration-status-service-impl/pom.xml b/registration-processor/registration-processor-registration-status-service-impl/pom.xml index 5be0a472f78..cf32cb532c6 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/pom.xml +++ b/registration-processor/registration-processor-registration-status-service-impl/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-registration-status-service-impl - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/RegistrationStatusDao.java b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/RegistrationStatusDao.java index f163a009799..e5810589190 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/RegistrationStatusDao.java +++ b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/RegistrationStatusDao.java @@ -1,7 +1,6 @@ package io.mosip.registration.processor.status.dao; import java.time.LocalDateTime; -import java.time.ZoneId; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -14,7 +13,6 @@ import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Component; -import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; import io.mosip.registration.processor.core.workflow.dto.FilterInfo; import io.mosip.registration.processor.core.workflow.dto.PaginationInfo; import io.mosip.registration.processor.core.workflow.dto.SortInfo; @@ -244,4 +242,9 @@ public List getResumablePackets(Integer fetchSize) { return registrationStatusRepositary.getResumablePackets(RegistrationStatusCode.RESUMABLE.toString(), fetchSize); } + + public List findByIdAndProcessAndIteration(String id, String process, int iteration) + { + return registrationStatusRepositary.getByIdAndProcessAndIteration(id, process, iteration); + } } \ No newline at end of file diff --git a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/SyncRegistrationDao.java b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/SyncRegistrationDao.java index 861f2080076..58ddb829410 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/SyncRegistrationDao.java +++ b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/dao/SyncRegistrationDao.java @@ -127,6 +127,14 @@ public SyncRegistrationEntity findByRegistrationIdIdAndRegType(String registrati } + public SyncRegistrationEntity findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(String registrationId, String registrationType, String additionalInfoReqId) { + List syncRegistrationEntityList = syncRegistrationRepository.findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(registrationId, + registrationType, additionalInfoReqId); + + return !CollectionUtils.isEmpty(syncRegistrationEntityList) ? syncRegistrationEntityList.get(0) : null; + + } + /** * Gets the by ids. * diff --git a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/RegistrationRepositary.java b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/RegistrationRepositary.java index 2a53a40c226..a7ac6db3ee7 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/RegistrationRepositary.java +++ b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/RegistrationRepositary.java @@ -61,5 +61,8 @@ public List getProcessedOrProcessingRegIds(@Param("regIds") List @Query(value ="SELECT * FROM registration r WHERE r.status_code =:statusCode order by r.upd_dtimes LIMIT :fetchSize ", nativeQuery = true) public List getResumablePackets(@Param("statusCode") String statusCode,@Param("fetchSize") Integer fetchSize); + + @Query("SELECT registration FROM RegistrationStatusEntity registration WHERE registration.regId = :regId AND registration.registrationType = :registrationType AND registration.iteration = :iteration") + public List getByIdAndProcessAndIteration(@Param("regId") String regId, @Param("registrationType") String process, @Param("iteration") int iteration); } diff --git a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/SyncRegistrationRepository.java b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/SyncRegistrationRepository.java index 52cc0fee07a..89cfe23fcf7 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/SyncRegistrationRepository.java +++ b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/repositary/SyncRegistrationRepository.java @@ -8,7 +8,6 @@ import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository; import io.mosip.registration.processor.status.entity.BaseSyncRegistrationEntity; -import io.mosip.registration.processor.status.entity.RegistrationStatusEntity; import io.mosip.registration.processor.status.entity.SyncRegistrationEntity; @Repository @@ -43,4 +42,7 @@ public List getSyncRecordsByRegIdANDRegType(@Param("regI @Query("SELECT registrationList FROM SyncRegistrationEntity registrationList WHERE registrationList.workflowInstanceId = :workflowInstanceId AND registrationList.isDeleted =false ") public List findByworkflowInstanceId(@Param("workflowInstanceId") String workflowInstanceId); + @Query("SELECT registrationList FROM SyncRegistrationEntity registrationList WHERE registrationList.registrationId = :registrationId AND registrationList.registrationType = :registrationType AND registrationList.additionalInfoReqId = :additionalInfoReqId AND registrationList.isDeleted =false ") + public List findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(@Param("registrationId") String registrationId, @Param("registrationType") String registrationType, @Param("additionalInfoReqId") String additionalInfoReqId); + } \ No newline at end of file diff --git a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/service/impl/RegistrationStatusServiceImpl.java b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/service/impl/RegistrationStatusServiceImpl.java index 76647932140..a6c3e1cc4cd 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/service/impl/RegistrationStatusServiceImpl.java +++ b/registration-processor/registration-processor-registration-status-service-impl/src/main/java/io/mosip/registration/processor/status/service/impl/RegistrationStatusServiceImpl.java @@ -215,7 +215,7 @@ public void addRegistrationStatus(InternalRegistrationStatusDto registrationStat registrationStatusDto.setLatestRegistrationTransactionId(transactionId); registrationStatusDto.setCreateDateTime(LocalDateTime.now(ZoneId.of("UTC"))); RegistrationStatusEntity entity = convertDtoToEntity(registrationStatusDto, null, false); - entity.setStatusCode(RegistrationTransactionStatusCode.PROCESSING.toString()); + entity.setStatusCode(registrationStatusDto.getStatusCode()); registrationStatusDao.save(entity); isTransactionSuccessful = true; description.setMessage("Registration status added successfully"); diff --git a/registration-processor/registration-processor-rest-client/pom.xml b/registration-processor/registration-processor-rest-client/pom.xml index 9333d20cd69..8939636a70f 100644 --- a/registration-processor/registration-processor-rest-client/pom.xml +++ b/registration-processor/registration-processor-rest-client/pom.xml @@ -9,12 +9,12 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 registration-processor-rest-client registration-processor-rest-client - 1.2.0.1 + 1.2.1.0 UTF-8 diff --git a/registration-processor/stage-groups/pom.xml b/registration-processor/stage-groups/pom.xml index 9cd56ab6468..580495b5bfe 100644 --- a/registration-processor/stage-groups/pom.xml +++ b/registration-processor/stage-groups/pom.xml @@ -7,9 +7,9 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 - 1.2.0.1 + 1.2.1.0 stage-groups stage-groups diff --git a/registration-processor/stage-groups/registration-processor-stage-group-1/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-1/pom.xml index 6fd025521cd..ea053fd8e53 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-1/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-1/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-1 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,14 +21,14 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-packet-receiver-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-2/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-2/pom.xml index c691dc33a0e..7d03540f9b4 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-2/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-2/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-2 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,24 +21,24 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-quality-classifier-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-securezone-notification-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-message-sender-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-3/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-3/pom.xml index 9564721fe7d..0d65485f477 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-3/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-3/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-3 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,29 +21,29 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-abis-handler-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-abis-middleware-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-bio-dedupe-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-manual-adjudication-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-4/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-4/pom.xml index 073f75ad8e8..60392ccfc20 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-4/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-4/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-4 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,19 +21,19 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-biometric-authentication-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-demo-dedupe-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-5/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-5/pom.xml index 568b76c0274..1aa55476656 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-5/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-5/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-5 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,34 +21,34 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-cmd-validator-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-operator-validator-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-supervisor-validator-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-introducer-validator-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-packet-validator-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-6/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-6/pom.xml index 860cf10a48e..89deb0a4fc3 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-6/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-6/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor stage-groups - 1.2.0.1 + 1.2.1.0 registration-processor-stage-group-6 - 1.2.0.1 + 1.2.1.0 UTF-8 @@ -21,24 +21,24 @@ io.mosip.registrationprocessor mosip-stage-executor - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-packet-uploader-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-packet-classifier-stage - 1.2.0.1 + 1.2.1.0 io.mosip.registrationprocessor registration-processor-verification-stage - 1.2.0.1 + 1.2.1.0 diff --git a/registration-processor/stage-groups/registration-processor-stage-group-7/pom.xml b/registration-processor/stage-groups/registration-processor-stage-group-7/pom.xml index ec539470a35..a49c2b72c86 100644 --- a/registration-processor/stage-groups/registration-processor-stage-group-7/pom.xml +++ b/registration-processor/stage-groups/registration-processor-stage-group-7/pom.xml @@ -1,74 +1,74 @@ - - - 4.0.0 - - io.mosip.registrationprocessor - stage-groups - 1.2.0.1 - - - registration-processor-stage-group-7 - 1.2.0.1 - - - UTF-8 - - - - - - - io.mosip.registrationprocessor - mosip-stage-executor - 1.2.0.1 - - - - - io.mosip.registrationprocessor - registration-processor-uin-generator-stage - 1.2.0.1 - - - io.mosip.registrationprocessor - registration-processor-biometric-extraction-stage - 1.2.0.1 - - - io.mosip.registrationprocessor - registration-processor-finalization-stage - 1.2.0.1 - - - io.mosip.registrationprocessor - registration-processor-credential-requestor-stage - 1.2.0.1 - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - true - io.mosip.registration.processor.stages.executor.MosipStageExecutorApplication - ZIP - - - - - build-info - repackage - - - - - - + + + 4.0.0 + + io.mosip.registrationprocessor + stage-groups + 1.2.1.0 + + + registration-processor-stage-group-7 + 1.2.1.0 + + + UTF-8 + + + + + + + io.mosip.registrationprocessor + mosip-stage-executor + 1.2.1.0 + + + + + io.mosip.registrationprocessor + registration-processor-uin-generator-stage + 1.2.1.0 + + + io.mosip.registrationprocessor + registration-processor-biometric-extraction-stage + 1.2.1.0 + + + io.mosip.registrationprocessor + registration-processor-finalization-stage + 1.2.1.0 + + + io.mosip.registrationprocessor + registration-processor-credential-requestor-stage + 1.2.1.0 + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + io.mosip.registration.processor.stages.executor.MosipStageExecutorApplication + ZIP + + + + + build-info + repackage + + + + + + \ No newline at end of file diff --git a/registration-processor/workflow-engine/pom.xml b/registration-processor/workflow-engine/pom.xml index 49b52d674ad..39efc491702 100644 --- a/registration-processor/workflow-engine/pom.xml +++ b/registration-processor/workflow-engine/pom.xml @@ -5,9 +5,9 @@ io.mosip.registrationprocessor registration-processor - 1.2.0.1 + 1.2.1.0 - 1.2.0.1 + 1.2.1.0 workflow-engine workflow-engine diff --git a/registration-processor/workflow-engine/registration-processor-reprocessor/Dockerfile b/registration-processor/workflow-engine/registration-processor-reprocessor/Dockerfile index 2585338e371..85087966f15 100644 --- a/registration-processor/workflow-engine/registration-processor-reprocessor/Dockerfile +++ b/registration-processor/workflow-engine/registration-processor-reprocessor/Dockerfile @@ -1,96 +1,105 @@ -FROM openjdk:11 - -#Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image -#FROM openjdk:8-jdk-alpine - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG spring_config_label - -# can be passed during Docker build as build time environment for spring profiles active -ARG active_profile - -# can be passed during Docker build as build time environment for config server URL -ARG spring_config_url - -# can be passed during Docker build as build time environment for glowroot -ARG is_glowroot - -# can be passed during Docker build as build time environment for artifactory URL -ARG artifactory_url - -# environment variable to pass active profile such as DEV, QA etc at docker runtime -ENV active_profile_env=${active_profile} - -# environment variable to pass github branch to pickup configuration from, at docker runtime -ENV spring_config_label_env=${spring_config_label} - -# environment variable to pass github branch to pickup configuration from, at docker runtime -ENV spring_config_label_env=${spring_config_label} - -# environment variable to pass glowroot, at docker runtime -ENV is_glowroot_env=${is_glowroot} - -# environment variable to pass artifactory url, at docker runtime -ENV artifactory_url_env=${artifactory_url} - -# environment variable to pass iam_adapter url, at docker runtime -ENV iam_adapter_url_env=${iam_adapter_url} - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_gid=1001 - -RUN apt-get -y update \ -&& apt-get install -y unzip sudo \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& adduser ${container_user} sudo - -# set working directory for the user -WORKDIR /home/${container_user} - -ENV work_dir=/home/${container_user} - -ARG loader_path=${work_dir}/additional_jars/ - -RUN mkdir -p ${loader_path} - -ENV loader_path_env=${loader_path} - -# change volume to whichever storage directory you want to use for this container. -VOLUME ${work_dir}/logs ${work_dir}/Glowroot - -ADD ./target/registration-processor-reprocessor-*.jar registration-processor-reprocessor.jar - -#Below 4 lines is added only as a temporary fix to downloaded the ceylon dependencies for chime scheduler -#later this chime to be replaced with something else -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} - -# select container user for all tasks -USER ${container_user_uid}:${container_user_gid} - -CMD wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/regproc-reprocessor-ceylon-cache-repo.zip ; \ - unzip regproc-reprocessor-ceylon-cache-repo.zip ; \ - rm -rf regproc-reprocessor-ceylon-cache-repo.zip ; \ - if [ "$is_glowroot_env" = "present" ]; then \ - wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ - wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/glowroot.zip ; \ - unzip glowroot.zip ; \ - rm -rf glowroot.zip ; \ - sed -i 's//registration-processor-reprocessor/g' glowroot/glowroot.properties ; \ - java -jar -Dloader.path="${loader_path_env}" -javaagent:glowroot/glowroot.jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dceylon.cache.repo=./regproc-reprocessor-ceylon-cache-repo registration-processor-reprocessor.jar ; \ - else \ - wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ - java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dceylon.cache.repo=./regproc-reprocessor-ceylon-cache-repo registration-processor-reprocessor.jar ; \ - fi - -#CMD ["java","-Dspring.cloud.config.label=${spring_config_label_env}","-Dspring.profiles.active=${active_profile_env}","-Dspring.cloud.config.uri=${spring_config_url_env}","-jar","registration-processor-reprocessor.jar"] +FROM openjdk:11 + +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + +#Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image +#FROM openjdk:8-jdk-alpine + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG spring_config_label + +# can be passed during Docker build as build time environment for spring profiles active +ARG active_profile + +# can be passed during Docker build as build time environment for config server URL +ARG spring_config_url + +# can be passed during Docker build as build time environment for glowroot +ARG is_glowroot + +# can be passed during Docker build as build time environment for artifactory URL +ARG artifactory_url + +# environment variable to pass active profile such as DEV, QA etc at docker runtime +ENV active_profile_env=${active_profile} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# environment variable to pass glowroot, at docker runtime +ENV is_glowroot_env=${is_glowroot} + +# environment variable to pass artifactory url, at docker runtime +ENV artifactory_url_env=${artifactory_url} + +# environment variable to pass iam_adapter url, at docker runtime +ENV iam_adapter_url_env=${iam_adapter_url} + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user=mosip + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_group=mosip + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_uid=1001 + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user_gid=1001 + +RUN apt-get -y update \ +&& apt-get install -y unzip sudo \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& adduser ${container_user} sudo + +# set working directory for the user +WORKDIR /home/${container_user} + +ENV work_dir=/home/${container_user} + +ARG loader_path=${work_dir}/additional_jars/ + +RUN mkdir -p ${loader_path} + +ENV loader_path_env=${loader_path} + +# change volume to whichever storage directory you want to use for this container. +VOLUME ${work_dir}/logs ${work_dir}/Glowroot + +ADD ./target/registration-processor-reprocessor-*.jar registration-processor-reprocessor.jar + +#Below 4 lines is added only as a temporary fix to downloaded the ceylon dependencies for chime scheduler +#later this chime to be replaced with something else +# change permissions of file inside working dir +RUN chown -R ${container_user}:${container_user} /home/${container_user} + +# select container user for all tasks +USER ${container_user_uid}:${container_user_gid} + +CMD wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/regproc-reprocessor-ceylon-cache-repo.zip ; \ + unzip regproc-reprocessor-ceylon-cache-repo.zip ; \ + rm -rf regproc-reprocessor-ceylon-cache-repo.zip ; \ + if [ "$is_glowroot_env" = "present" ]; then \ + wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ + wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/glowroot.zip ; \ + unzip glowroot.zip ; \ + rm -rf glowroot.zip ; \ + sed -i 's//registration-processor-reprocessor/g' glowroot/glowroot.properties ; \ + java -jar -Dloader.path="${loader_path_env}" -javaagent:glowroot/glowroot.jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dceylon.cache.repo=./regproc-reprocessor-ceylon-cache-repo registration-processor-reprocessor.jar ; \ + else \ + wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \ + java -Dloader.path="${loader_path_env}" -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dceylon.cache.repo=./regproc-reprocessor-ceylon-cache-repo registration-processor-reprocessor.jar ; \ + fi + +#CMD ["java","-Dspring.cloud.config.label=${spring_config_label_env}","-Dspring.profiles.active=${active_profile_env}","-Dspring.cloud.config.uri=${spring_config_url_env}","-jar","registration-processor-reprocessor.jar"] diff --git a/registration-processor/workflow-engine/registration-processor-reprocessor/pom.xml b/registration-processor/workflow-engine/registration-processor-reprocessor/pom.xml index 9b76dffed6e..175214f1101 100644 --- a/registration-processor/workflow-engine/registration-processor-reprocessor/pom.xml +++ b/registration-processor/workflow-engine/registration-processor-reprocessor/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor workflow-engine - 1.2.0.1 + 1.2.1.0 registration-processor-reprocessor - 1.2.0.1 + 1.2.1.0 registration-processor-reprocessor UTF-8 diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/Dockerfile b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/Dockerfile index 869902c1ee6..cdeafeb63a7 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/Dockerfile +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/Dockerfile @@ -1,5 +1,14 @@ FROM openjdk:11 +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + #Uncomment below and Comment above line(i.e. FROM openjdk:8) for OS specific (e.g. Alpine OS ) docker base image #FROM openjdk:8-jdk-alpine diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/pom.xml b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/pom.xml index 9923d3e4dc1..d79eee61e7c 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/pom.xml +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor workflow-engine - 1.2.0.1 + 1.2.1.0 registration-processor-workflow-manager-service - 1.2.0.1 + 1.2.1.0 registration-processor-workflow-manager-service UTF-8 diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/config/WorkflowManagerConfigBeans.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/config/WorkflowManagerConfigBeans.java index 46547cf52eb..5ced6c145ce 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/config/WorkflowManagerConfigBeans.java +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/config/WorkflowManagerConfigBeans.java @@ -1,5 +1,8 @@ package io.mosip.registration.processor.workflowmanager.config; +import io.mosip.registration.processor.workflowmanager.service.WorkflowInstanceService; +import io.mosip.registration.processor.workflowmanager.validator.WorkflowInstanceRequestValidator; +import io.mosip.registration.processor.workflowmanager.verticle.*; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @@ -17,10 +20,6 @@ import io.mosip.registration.processor.workflowmanager.util.WebSubUtil; import io.mosip.registration.processor.workflowmanager.validator.WorkflowActionRequestValidator; import io.mosip.registration.processor.workflowmanager.validator.WorkflowSearchRequestValidator; -import io.mosip.registration.processor.workflowmanager.verticle.WorkflowActionApi; -import io.mosip.registration.processor.workflowmanager.verticle.WorkflowActionJob; -import io.mosip.registration.processor.workflowmanager.verticle.WorkflowInternalActionVerticle; -import io.mosip.registration.processor.workflowmanager.verticle.WorkflowSearchApi; @PropertySource("classpath:bootstrap.properties") @Configuration @@ -40,6 +39,10 @@ public WorkflowSearchApi getWorkflowSearchApi() { return new WorkflowSearchApi(); } + @Bean + public WorkflowInstanceApi getWorkFlowInstanceApi() { + return new WorkflowInstanceApi(); + } @Bean public WorkflowActionRequestValidator getWorkflowActionRequestValidator() { return new WorkflowActionRequestValidator(); @@ -49,12 +52,22 @@ public WorkflowActionRequestValidator getWorkflowActionRequestValidator() { public WorkflowSearchRequestValidator getWorkflowSearchRequestValidator() { return new WorkflowSearchRequestValidator(); } + @Bean + public WorkflowInstanceRequestValidator getWorkflowInstanceRequestValidator() { + return new WorkflowInstanceRequestValidator(); + } + @Bean public WorkflowActionService getWorkflowActionService() { return new WorkflowActionService(); } + + @Bean + public WorkflowInstanceService getWorkFlowInstanceService() { + return new WorkflowInstanceService(); + } @Bean public WorkflowSearchService getWorkflowSearchService() { return new WorkflowSearchService(); diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/service/WorkflowInstanceService.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/service/WorkflowInstanceService.java new file mode 100644 index 00000000000..c84b461aceb --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/service/WorkflowInstanceService.java @@ -0,0 +1,236 @@ +package io.mosip.registration.processor.workflowmanager.service; + +import java.io.IOException; +import java.math.BigInteger; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.List; +import java.util.Map; +import java.util.UUID; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.mosip.kernel.core.util.exception.JsonProcessingException; +import io.mosip.registration.processor.core.code.*; +import io.mosip.registration.processor.core.exception.ApisResourceAccessException; +import io.mosip.registration.processor.core.status.util.StatusUtil; +import io.mosip.registration.processor.status.code.RegistrationStatusCode; +import io.mosip.registration.processor.status.dao.RegistrationStatusDao; +import io.mosip.registration.processor.status.dto.*; +import io.mosip.registration.processor.status.entity.RegistrationStatusEntity; +import io.mosip.registration.processor.status.exception.EncryptionFailureException; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.DateUtils; +import io.mosip.kernel.core.util.JsonUtils; +import io.mosip.registration.processor.core.exception.WorkflowInstanceException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; +import io.mosip.registration.processor.core.logger.LogDescription; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceRequestDTO; +import io.mosip.registration.processor.packet.storage.utils.Utilities; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.dao.SyncRegistrationDao; +import io.mosip.registration.processor.status.encryptor.Encryptor; +import io.mosip.registration.processor.status.entity.SyncRegistrationEntity; +import io.mosip.registration.processor.status.exception.TablenotAccessibleException; +import io.mosip.registration.processor.status.service.AdditionalInfoRequestService; +import io.mosip.registration.processor.status.service.RegistrationStatusService; + +/** + * The Class WorkflowInstanceService. + */ +@Component +public class WorkflowInstanceService { + + /** The registration status service. */ + @Autowired + RegistrationStatusService registrationStatusService; + + /** The sync registration dao. */ + @Autowired + private SyncRegistrationDao syncRegistrationDao; + + @Autowired + private RegistrationStatusDao registrationStatusDao; + + /** The core audit request builder. */ + @Autowired + AuditLogRequestBuilder auditLogRequestBuilder; + + @Autowired + private AdditionalInfoRequestService additionalInfoRequestService; + + /** The resume from beginning stage. */ + @Value("${mosip.regproc.workflow-manager.instance-beginning-stage:PacketValidatorStage}") + private String beginningStage; + + + @Value("#{${registration.processor.additional-process.category-mapping:{:}}}") + private Map additionalProcessCategoryMapping; + + + @Autowired + private Utilities utility; + + @Autowired + ObjectMapper mapper; + + /** The encryptor. */ + @Autowired + private Encryptor encryptor; + + + /** The module name. */ + public static String MODULE_NAME = ModuleName.WORKFLOW_INSTANCE_SERVICE.toString(); + + /** The module id. */ + public static String MODULE_ID = PlatformSuccessMessages.RPR_WORKFLOW_INSTANCE_SERVICE_SUCCESS.getCode(); + + /** The reg proc logger. */ + private static Logger regProcLogger = RegProcessorLogger.getLogger(WorkflowInstanceService.class); + + /** + * Add record to registration table + * @throws WorkflowInstanceException + */ + public InternalRegistrationStatusDto createWorkflowInstance(WorkflowInstanceRequestDTO regRequest, String user) throws WorkflowInstanceException, Exception { + regProcLogger.debug("createWorkflowInstance called for request {}", regRequest.toString()); + LogDescription description = new LogDescription(); + boolean isTransactionSuccessful = false; + String rid = regRequest.getRegistrationId(); + InternalRegistrationStatusDto dto = new InternalRegistrationStatusDto(); + try { + int iteration = utility.getIterationForSyncRecord(additionalProcessCategoryMapping, regRequest.getProcess(), regRequest.getAdditionalInfoReqId()); + String workflowInstanceId = UUID.randomUUID().toString(); + validateWorkflowInstanceAlreadyAvailable(rid, regRequest.getProcess(), regRequest.getAdditionalInfoReqId(), iteration); + SyncRegistrationEntity syncRegistrationEntity = createSyncRegistrationEntity(regRequest, workflowInstanceId, rid, user); + syncRegistrationDao.save(syncRegistrationEntity); + dto = getInternalRegistrationStatusDto(regRequest, user, workflowInstanceId, iteration); + registrationStatusService.addRegistrationStatus(dto, MODULE_ID, MODULE_NAME); + description + .setMessage(PlatformSuccessMessages.RPR_WORKFLOW_INSTANCE_SERVICE_SUCCESS.getMessage()); + isTransactionSuccessful = true; + } catch (TablenotAccessibleException e) { + logAndThrowError(e, e.getErrorCode(), e.getMessage(), rid, description); + } + catch (WorkflowInstanceException e){ + logAndThrowError(e, e.getErrorCode(), e.getMessage(), rid, description); + } + catch (Exception e){ + logAndThrowError(e, PlatformErrorMessages.RPR_WIS_UNKNOWN_EXCEPTION.getCode(), + PlatformErrorMessages.RPR_WIS_UNKNOWN_EXCEPTION.getMessage(), rid, description); + } finally { + regProcLogger.debug("WorkflowInstanceService status for registration id {} {}", rid, + description.getMessage()); + updateAudit(description, rid, isTransactionSuccessful); + } + regProcLogger.debug("createWorkflowInstance call ended for request {}", regRequest.toString()); + return dto; + } + + + /** + * Update audit. + * + * @param description the description + * @param registrationId the registration id + * @param isTransactionSuccessful the is transaction successful + */ + private void updateAudit(LogDescription description, String registrationId, boolean isTransactionSuccessful) { + String moduleId = isTransactionSuccessful ? MODULE_ID : description.getCode(); + String eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); + String eventName = isTransactionSuccessful ? EventName.UPDATE.toString() : EventName.EXCEPTION.toString(); + String eventType = isTransactionSuccessful ? EventType.BUSINESS.toString() : EventType.SYSTEM.toString(); + auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, + moduleId, MODULE_NAME, registrationId); + } + + /** + * Log and throw error. + * + * @param e the e + * @param errorCode the error code + * @param errorMessage the error message + * @param registrationId the registration id + * @param description the description + * @throws WorkflowInstanceException the workflow instance exception + */ + private void logAndThrowError(Exception e, String errorCode, String errorMessage, String registrationId, + LogDescription description) throws WorkflowInstanceException { + description.setCode(errorCode); + description.setMessage(errorMessage); + regProcLogger.error("Error in createWorkflowInstance for registration id {} {} {} {}", registrationId, + errorMessage, e.getMessage(), ExceptionUtils.getStackTrace(e)); + throw new WorkflowInstanceException(errorCode, errorMessage); + } + + private InternalRegistrationStatusDto getInternalRegistrationStatusDto(WorkflowInstanceRequestDTO regRequest, String user,String workflowInstanceId, int iteration) throws IOException { + regProcLogger.debug("getInternalRegistrationStatusDto :: entry {}", regRequest.toString()); + InternalRegistrationStatusDto dto = new InternalRegistrationStatusDto(); + dto.setRegistrationId(regRequest.getRegistrationId()); + dto.setLatestTransactionTypeCode(RegistrationTransactionTypeCode.WORKFLOW_RESUME.toString()); + dto.setRegistrationStageName(beginningStage); + dto.setRegistrationType(regRequest.getProcess()); + dto.setReferenceRegistrationId(null); + dto.setStatusCode(RegistrationStatusCode.RESUMABLE.toString()); + dto.setLangCode("eng"); + dto.setStatusComment(PlatformSuccessMessages.RPR_WORKFLOW_INSTANCE_SERVICE_SUCCESS.getMessage()); + dto.setSubStatusCode(StatusUtil.WORKFLOW_INSTANCE_SERVICE_SUCCESS.getCode()); + dto.setReProcessRetryCount(0); + dto.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.REPROCESS.toString()); + dto.setIsActive(true); + dto.setCreatedBy(user); + dto.setUpdatedBy(user); + dto.setIsDeleted(false); + dto.setSource(regRequest.getSource()); + dto.setIteration(iteration); + dto.setWorkflowInstanceId(workflowInstanceId); + regProcLogger.debug("getInternalRegistrationStatusDto ::exit {}", regRequest.toString()); + return dto; + } + + public SyncRegistrationEntity createSyncRegistrationEntity(WorkflowInstanceRequestDTO regRequest,String workflowInstanceId,String rid, String user) throws EncryptionFailureException, ApisResourceAccessException, JsonProcessingException { + regProcLogger.debug("createSyncRegistrationEntity :: entry {}", regRequest.toString()); + String referenceId = utility.getRefId(regRequest.getRegistrationId(), null); + String timeStamp=DateUtils.formatToISOString(LocalDateTime.now()); + String additionalInfo = JsonUtils.javaObjectToJsonString(regRequest.getNotificationInfo()); + byte[] encryptedInfo = encryptor.encrypt(additionalInfo, referenceId, timeStamp); + SyncRegistrationEntity syncRegistrationEntity = new SyncRegistrationEntity(); + syncRegistrationEntity.setWorkflowInstanceId(workflowInstanceId); + syncRegistrationEntity.setRegistrationId(rid); + syncRegistrationEntity.setSupervisorStatus("APPROVED"); + syncRegistrationEntity.setRegistrationType(regRequest.getProcess()); + syncRegistrationEntity.setLangCode("eng"); + syncRegistrationEntity.setCreatedBy(user); + syncRegistrationEntity.setCreateDateTime(LocalDateTime.now(ZoneId.of("UTC"))); + syncRegistrationEntity.setIsDeleted(false); + syncRegistrationEntity.setPacketHashValue(""); + syncRegistrationEntity.setPacketSize(BigInteger.valueOf(0)); + syncRegistrationEntity.setOptionalValues(encryptedInfo); + syncRegistrationEntity.setSource(regRequest.getSource()); + regProcLogger.debug("createSyncRegistrationEntity :: exit {}", regRequest.toString()); + return syncRegistrationEntity; + } + + public void validateWorkflowInstanceAlreadyAvailable(String regId, String type, String additionalInfoReqId, int iteration) throws WorkflowInstanceException { + regProcLogger.debug("validateWorkflowInstanceAlreadyAvailable :: entry {}", regId); + List registrationStatusEntities = registrationStatusDao.findByIdAndProcessAndIteration(regId, type, iteration); + if (!registrationStatusEntities.isEmpty()) { + regProcLogger.error("RegistrationStatus Entities found for RID {}", regId); + throw new WorkflowInstanceException(PlatformErrorMessages.RPR_WIS_ALREADY_PRESENT_EXCEPTION.getCode(), PlatformErrorMessages.RPR_WIS_ALREADY_PRESENT_EXCEPTION.getMessage()); + } + SyncRegistrationEntity syncRegistrationEntity = syncRegistrationDao.findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(regId, type,additionalInfoReqId); + if (syncRegistrationEntity != null) { + regProcLogger.error("SyncRegistration Entity found for RID {}", regId); + throw new WorkflowInstanceException(PlatformErrorMessages.RPR_WIS_ALREADY_PRESENT_EXCEPTION.getCode(), PlatformErrorMessages.RPR_WIS_ALREADY_PRESENT_EXCEPTION.getMessage()); + } + regProcLogger.debug("validateWorkflowInstanceAlreadyAvailable :: exit {}", regId); + } + +} \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/validator/WorkflowInstanceRequestValidator.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/validator/WorkflowInstanceRequestValidator.java new file mode 100644 index 00000000000..dc8ec124ffe --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/validator/WorkflowInstanceRequestValidator.java @@ -0,0 +1,145 @@ +package io.mosip.registration.processor.workflowmanager.validator; + +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import io.mosip.kernel.core.exception.ExceptionUtils; +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.DateUtils; +import io.mosip.registration.processor.core.exception.WorkflowActionRequestValidationException; +import io.mosip.registration.processor.core.exception.WorkflowInstanceRequestValidationException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.workflow.dto.WorkflowActionDTO; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceDTO; + + +/** + * The Class WorkflowInstanceRequestValidator. + */ +@Component +public class WorkflowInstanceRequestValidator { + + /** The Constant VER. */ + private static final String VER = "version"; + + /** The Constant TIMESTAMP. */ + private static final String TIMESTAMP = "requesttime"; + + /** The Constant ID_FIELD. */ + private static final String ID_FIELD = "id"; + + /** The Constant WORKFLOW_INSTANCE_ID. */ + private static final String WORKFLOW_INSTANCE_ID = "mosip.regproc.workflow-manager.instance.api-id"; + + /** The Constant WORKFLOW_INSTANCE_VERSION. */ + private static final String WORKFLOW_INSTANCE_VERSION = "mosip.regproc.workflow-manager.instance.version"; + + Logger regProcLogger = RegProcessorLogger.getLogger(WorkflowInstanceRequestValidator.class); + + /** The env. */ + @Autowired + private Environment env; + + /** + * Validate. + * + * @param workflowInstanceDTO the workflow instance DTO + * @param errors the errors + * @return true, if successful + * @throws WorkflowInstanceRequestValidationException + */ + public void validate(WorkflowInstanceDTO workflowInstanceDTO) + throws WorkflowInstanceRequestValidationException { + regProcLogger.debug("WorkflowInstanceRequestValidator validate entry"); + + validateId(workflowInstanceDTO.getId()); + validateVersion(workflowInstanceDTO.getVersion()); + validateReqTime(workflowInstanceDTO.getRequesttime()); + + regProcLogger.debug("WorkflowInstanceRequestValidator validate exit"); + + } + + /** + * Validate version. + * + * @param version the version + * @param errors the errors + * @return true, if successful + * @throws WorkflowInstanceRequestValidationException + */ + private void validateVersion(String version) + throws WorkflowInstanceRequestValidationException { + if (Objects.isNull(version)) { + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getMessage(), VER)); + + + } else if (!version.equalsIgnoreCase(env.getProperty(WORKFLOW_INSTANCE_VERSION))) { + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getMessage(), VER)); + + + } + } + + /** + * Validate id. + * + * @param id the id + * @param errors the errors + * @return true, if successful + * @throws WorkflowInstanceRequestValidationException + */ + private void validateId(String id) throws WorkflowInstanceRequestValidationException { + if (Objects.isNull(id)) { + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getMessage(), ID_FIELD)); + + } else if (!id.equalsIgnoreCase(env.getProperty(WORKFLOW_INSTANCE_ID))) { + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getMessage(), ID_FIELD)); + + } + } + + /** + * Validate req time. + * + * @param requesttime the requesttime + * @param errors the errors + * @return true, if successful + * @throws WorkflowInstanceRequestValidationException + */ + private void validateReqTime(String requesttime) + throws WorkflowInstanceRequestValidationException { + + if (Objects.isNull(requesttime)) { + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_MISSING_INPUT_PARAMETER.getMessage(), TIMESTAMP)); + + } else { + try { + DateUtils.parseToLocalDateTime(requesttime); + + + } catch (Exception e) { + regProcLogger.error("Exception while parsing date {}", ExceptionUtils.getStackTrace(e)); + throw new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getCode(), + String.format(PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getMessage(), TIMESTAMP)); + + } + } + + } +} \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApi.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApi.java index eb3464cc8fe..8d08eb013aa 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApi.java +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApi.java @@ -55,6 +55,8 @@ public class WorkflowActionApi extends MosipVerticleAPIManager { @Autowired WorkflowSearchApi workflowSearchApi; + @Autowired + WorkflowInstanceApi workflowInstanceApi; /** worker pool size. */ @Value("${worker.pool.size}") private Integer workerPoolSize; @@ -121,6 +123,7 @@ public void start() { // like workflowSearchApi and call both setApiRoute method from the common // verticle class workflowSearchApi.setApiRoute(router.getRouter()); + workflowInstanceApi.setApiRoute(router.getRouter()); this.createServer(router.getRouter(), Integer.parseInt(port)); } diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApi.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApi.java new file mode 100644 index 00000000000..797dbfff92d --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApi.java @@ -0,0 +1,214 @@ +package io.mosip.registration.processor.workflowmanager.verticle; + + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.DateUtils; +import io.mosip.registration.processor.core.abstractverticle.MosipRouter; +import io.mosip.registration.processor.core.code.EventId; +import io.mosip.registration.processor.core.code.EventName; +import io.mosip.registration.processor.core.code.EventType; +import io.mosip.registration.processor.core.code.ModuleName; +import io.mosip.registration.processor.core.common.rest.dto.ErrorDTO; +import io.mosip.registration.processor.core.exception.WorkflowInstanceException; +import io.mosip.registration.processor.core.exception.WorkflowInstanceRequestValidationException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; +import io.mosip.registration.processor.core.logger.LogDescription; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.util.JsonUtil; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceResponse; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceDTO; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceResponseDTO; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.service.RegistrationStatusService; +import io.mosip.registration.processor.workflowmanager.service.WorkflowInstanceService; +import io.mosip.registration.processor.workflowmanager.validator.WorkflowInstanceRequestValidator; +import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.RoutingContext; + +public class WorkflowInstanceApi extends MosipRouter { + + @Value("${mosip.registration.processor.datetime.pattern}") + private String dateTimePattern; + + @Value("${mosip.regproc.workflow-manager.instance.api-id}") + private String id; + + @Value("${mosip.regproc.workflow-manager.instance.version}") + private String version; + + @Autowired + private WorkflowInstanceRequestValidator validator; + + @Autowired + private WorkflowInstanceService workflowInstanceService; + /** + * The context path. + */ + @Value("${server.servlet.path}") + private String contextPath; + + /** The reg proc logger. */ + private static Logger regProcLogger = RegProcessorLogger.getLogger(WorkflowInstanceApi.class); + + /** The registration status service. */ + @Autowired + RegistrationStatusService registrationStatusService; + + /** The module id. */ + public static String MODULE_ID = PlatformSuccessMessages.RPR_WORKFLOW_INSTANCE_API_SUCCESS.getCode(); + + /** The module name. */ + public static String MODULE_NAME = ModuleName.WORKFLOW_INSTANCE_API.toString(); + + /** The core audit request builder. */ + @Autowired + AuditLogRequestBuilder auditLogRequestBuilder; + + public void setApiRoute(Router router) { + setRoute(router); + routes(this); + } + + /** + * contains all the routes in this stage + * + * @param router + */ + private void routes(MosipRouter router) { + router.post(contextPath + "/workflowinstance"); + router.handler(this::processURL, this::failure); + } + + /** + * method to process the context received. + * + * @param ctx the ctx + */ + public void processURL(RoutingContext ctx) { + String regId = null; + boolean isTransactionSuccessful = false; + LogDescription description = new LogDescription(); + String user = null; + try { + JsonObject obj = ctx.getBodyAsJson(); + WorkflowInstanceDTO workflowInstanceDTO = JsonUtil.readValueWithUnknownProperties(obj.toString(), + WorkflowInstanceDTO.class); + regId = workflowInstanceDTO.getRequest().getRegistrationId(); + regProcLogger.debug("WorkflowInstanceApi:processURL called for registration id {}", regId); + validator.validate(workflowInstanceDTO); + user = getUser(ctx); + + InternalRegistrationStatusDto dto = workflowInstanceService + .createWorkflowInstance(workflowInstanceDTO.getRequest(), user); + + isTransactionSuccessful = true; + description.setMessage(PlatformErrorMessages.RPR_WIN_VALIDATION_SUCCESS.getMessage()); + updateAudit(description, regId, isTransactionSuccessful, + user); + + regProcLogger.info("Process the WorkflowInstance successfully for registration id {}", regId); + buildResponse(ctx, dto.getWorkflowInstanceId(), null); + + regProcLogger.debug("WorkflowInstanceApi:processURL ended for registration id {}", regId); + + } catch (WorkflowInstanceException e) { + description.setMessage(e.getMessage()); + description.setCode(e.getErrorCode()); + updateAudit(description, "", isTransactionSuccessful, user); + logError(regId,e.getErrorCode(), e.getMessage(), e, ctx); + + } catch (WorkflowInstanceRequestValidationException e) { + description.setMessage(PlatformErrorMessages.RPR_WAA_UNKNOWN_EXCEPTION.getMessage()); + description.setCode(PlatformErrorMessages.RPR_WAA_UNKNOWN_EXCEPTION.getCode()); + updateAudit(description, "", isTransactionSuccessful, user); + logError(regId, e.getErrorCode(), e.getMessage(), e, ctx); + } catch (Exception e) { + description.setMessage(PlatformErrorMessages.RPR_WIN_UNKNOWN_EXCEPTION.getMessage()); + description.setCode(PlatformErrorMessages.RPR_WIN_UNKNOWN_EXCEPTION.getCode()); + updateAudit(description, "", isTransactionSuccessful, user); + logError(regId, PlatformErrorMessages.RPR_WIN_UNKNOWN_EXCEPTION.getCode(), + PlatformErrorMessages.RPR_WIN_UNKNOWN_EXCEPTION.getMessage(), e, ctx); + } + } + + private String getUser(RoutingContext ctx) { + String user = ""; + if (Objects.nonNull(ctx.user()) && Objects.nonNull(ctx.user().principal())) + user = ctx.user().principal().getString("username"); + return user; + } + + private void logError(String regId, String errorCode, String errorMessage, Exception e, RoutingContext ctx) { + if (e != null) { + regProcLogger.error("Error in WorkflowInstanceApi:processURL for registration id {} {} {} {}", regId, + errorMessage, e.getMessage(), ExceptionUtils.getStackTrace(e)); + } + + List errors = new ArrayList(); + ErrorDTO errorDTO = new ErrorDTO(); + errorDTO.setErrorCode(errorCode); + errorDTO.setMessage(errorMessage); + errors.add(errorDTO); + buildResponse(ctx, null, errors); + } + + private void failure(RoutingContext routingContext) { + this.setResponse(routingContext, routingContext.failure().getMessage()); + } + + public void setResponse(RoutingContext ctx, Object object) { + ctx.response().putHeader("content-type", "application/json").putHeader("Access-Control-Allow-Origin", "*") + .putHeader("Access-Control-Allow-Methods", "GET, POST").setStatusCode(200) + .end(Json.encodePrettily(object)); + }; + + private void buildResponse(RoutingContext routingContext, String workflowInstanceId, List errors) { + WorkflowInstanceResponseDTO workflowInstanceResponseDTO = new WorkflowInstanceResponseDTO(); + workflowInstanceResponseDTO.setId(id); + workflowInstanceResponseDTO.setVersion(version); + workflowInstanceResponseDTO.setResponsetime(DateUtils.getUTCCurrentDateTimeString(dateTimePattern)); + if (workflowInstanceId == null) { + workflowInstanceResponseDTO.setErrors(errors); + } else { + WorkflowInstanceResponse responseDTO = new WorkflowInstanceResponse(); + responseDTO.setWorkflowInstanceId(workflowInstanceId); + workflowInstanceResponseDTO.setResponse(responseDTO); + } + this.setResponse(routingContext, workflowInstanceResponseDTO); + + } + + /** + * Update audit. + * + * @param description the description + * @param registrationId the registration id + * @param isTransactionSuccessful the is transaction successful + */ + private void updateAudit(LogDescription description, String registrationId, boolean isTransactionSuccessful, + String user) { + + String moduleId = isTransactionSuccessful ? MODULE_ID : description.getCode(); + + String eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); + String eventName = isTransactionSuccessful ? EventName.UPDATE.toString() : EventName.EXCEPTION.toString(); + String eventType = isTransactionSuccessful ? EventType.BUSINESS.toString() : EventType.SYSTEM.toString(); + + auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, + moduleId, MODULE_NAME, registrationId, user); + } + +} \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/resources/logback.xml b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/resources/logback.xml index e928ad7ac14..c9058695db6 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/resources/logback.xml +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/main/resources/logback.xml @@ -1,10 +1,10 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowActionServiceTest.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowActionServiceTest.java index b0ae601d62b..f1e52830cbe 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowActionServiceTest.java +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowActionServiceTest.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; +import io.mosip.registration.processor.workflowmanager.verticle.WorkflowInstanceApi; import org.apache.commons.collections.map.HashedMap; import org.junit.Before; import org.junit.Test; diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceRequestValidatorTest.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceRequestValidatorTest.java new file mode 100644 index 00000000000..b04b7b4c257 --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceRequestValidatorTest.java @@ -0,0 +1,98 @@ +package io.mosip.registration.processor.workflowmanager.service.test; + +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.core.env.Environment; +import org.springframework.test.context.junit4.SpringRunner; + +import io.mosip.registration.processor.core.exception.WorkflowInstanceRequestValidationException; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceDTO; +import io.mosip.registration.processor.workflowmanager.validator.WorkflowInstanceRequestValidator; + +@RunWith(SpringRunner.class) +public class WorkflowInstanceRequestValidatorTest { + @Mock + private Environment env; + + @InjectMocks + WorkflowInstanceRequestValidator workflowInstanceRequestValidator; + + @Before + public void setup() { + when(env.getProperty("mosip.regproc.workflow-manager.instance.api-id")) + .thenReturn("mosip.registration.processor.workflow.create"); + when(env.getProperty("mosip.regproc.workflow-manager.instance.version")).thenReturn("1.0"); + } + + @Test + public void testValidateSuccess() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow.create"); + workflowInstanceDTO.setVersion("1.0"); + workflowInstanceDTO.setRequesttime("2021-03-15T10:02:45.474Z"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testMissingId() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + + workflowInstanceDTO.setVersion("1.0"); + workflowInstanceDTO.setRequesttime("2021-03-15T10:02:45.474Z"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testMissingVersion() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow.create"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testMissingRequesttime() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow.create"); + workflowInstanceDTO.setVersion("1.0"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testInValidId() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testInValidVersion() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow.create"); + workflowInstanceDTO.setVersion("1"); + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + + } + + @Test(expected = WorkflowInstanceRequestValidationException.class) + public void testInValidRequestTime() throws WorkflowInstanceRequestValidationException { + WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO(); + workflowInstanceDTO.setId("mosip.registration.processor.workflow.create"); + workflowInstanceDTO.setVersion("1.0"); + workflowInstanceDTO.setRequesttime("2021-03-15T10:02:474Z"); + + workflowInstanceRequestValidator.validate(workflowInstanceDTO); + + } +} \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceServiceTest.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceServiceTest.java new file mode 100644 index 00000000000..077828da021 --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/service/test/WorkflowInstanceServiceTest.java @@ -0,0 +1,139 @@ +package io.mosip.registration.processor.workflowmanager.service.test; + +import io.mosip.registration.processor.status.dao.RegistrationStatusDao; +import io.mosip.registration.processor.status.entity.RegistrationStatusEntity; +import io.mosip.registration.processor.status.entity.SyncRegistrationEntity; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestContext; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.web.context.WebApplicationContext; + +import io.mosip.registration.processor.core.exception.WorkflowInstanceException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.workflow.dto.NotificationInfoDTO; +import io.mosip.registration.processor.core.workflow.dto.WorkflowInstanceRequestDTO; +import io.mosip.registration.processor.packet.storage.utils.Utilities; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.dao.SyncRegistrationDao; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.encryptor.Encryptor; +import io.mosip.registration.processor.status.exception.TablenotAccessibleException; +import io.mosip.registration.processor.status.service.RegistrationStatusService; +import io.mosip.registration.processor.workflowmanager.service.WorkflowInstanceService; + +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.ArgumentMatchers.*; + + +@RunWith(SpringRunner.class) +@WebMvcTest +@ContextConfiguration(classes = { TestContext.class, WebApplicationContext.class }) +public class WorkflowInstanceServiceTest { + /** The registration status service. */ + @Mock + RegistrationStatusService registrationStatusService; + + /** The core audit request builder. */ + @Mock + AuditLogRequestBuilder auditLogRequestBuilder; + + @Mock + private SyncRegistrationDao syncRegistrationDao; + + @InjectMocks + WorkflowInstanceService workflowInstanceService; + + @Mock + private Encryptor encryptor; + + @Mock + private Utilities utility; + + @Mock + private RegistrationStatusDao registrationStatusDao; + + + private WorkflowInstanceRequestDTO workflowInstanceRequestDto; + + + @Before + public void setUp() + throws Exception { + workflowInstanceRequestDto = new WorkflowInstanceRequestDTO(); + workflowInstanceRequestDto.setRegistrationId("10003100030001520190422074511"); + workflowInstanceRequestDto.setProcess("NEW"); + workflowInstanceRequestDto.setSource("REGISTRATION_CLIENT"); + workflowInstanceRequestDto.setAdditionalInfoReqId(""); + NotificationInfoDTO notificationInfoDto = new NotificationInfoDTO(); + notificationInfoDto.setName("testName"); + notificationInfoDto.setEmail("Email"); + notificationInfoDto.setPhone("123456789"); + workflowInstanceRequestDto.setNotificationInfo(notificationInfoDto); + Mockito.when(syncRegistrationDao.save(any())).thenReturn(null); + ReflectionTestUtils.setField(workflowInstanceService, "beginningStage", "PacketValidatorStage"); + Mockito.when(utility.getIterationForSyncRecord(anyMap(),any(),any())).thenReturn(1); + Mockito.doNothing().when(registrationStatusService).addRegistrationStatus(any(), anyString(), + anyString()); + Mockito.when(auditLogRequestBuilder.createAuditRequestBuilder(any(), any(), any(), any(), any(), any(), any())) + .thenReturn(null); + Mockito.when(registrationStatusDao.findByIdAndProcessAndIteration(any(),any(),anyInt())).thenReturn(new ArrayList()); + } + + @Test + public void testAddRegistrationProcess() throws Exception { + workflowInstanceService.createWorkflowInstance(workflowInstanceRequestDto, "USER"); + } + + @Test(expected = WorkflowInstanceException.class) + public void testAddRegistrationProcessTablenotAccessibleException() throws Exception { + TablenotAccessibleException tablenotAccessibleException = new TablenotAccessibleException( + PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.getMessage()); + Mockito.doThrow(tablenotAccessibleException).when(registrationStatusService) + .addRegistrationStatus(any(), anyString(), + anyString()); + workflowInstanceService.createWorkflowInstance(workflowInstanceRequestDto, "USER"); + } + + @Test(expected = Exception.class) + public void testAddRegistrationProcessException() throws Exception { + Exception exp=new Exception(PlatformErrorMessages.UNKNOWN_EXCEPTION.getMessage()); + Mockito.doThrow(exp).when(registrationStatusService) + .addRegistrationStatus(any(), anyString(), + anyString()); + workflowInstanceService.createWorkflowInstance(workflowInstanceRequestDto, "USER"); + } + + @Test(expected = WorkflowInstanceException.class) + public void testValidateWorkflowInstanceAlreadyAvailableForRegistrationStatusEntity() throws Exception { + RegistrationStatusEntity registrationStatusEntity=new RegistrationStatusEntity(); + registrationStatusEntity.setRegId("10007100070014420250319152546"); + List registrationStatusEntities=new ArrayList(); + registrationStatusEntities.add(registrationStatusEntity); + SyncRegistrationEntity syncRegistrationEntity = new SyncRegistrationEntity(); + Mockito.when(registrationStatusDao.findByIdAndProcessAndIteration(any(),any(),anyInt())).thenReturn(registrationStatusEntities); + Mockito.when(syncRegistrationDao.findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(anyString(),any(),any())).thenReturn(syncRegistrationEntity); + workflowInstanceService.createWorkflowInstance(workflowInstanceRequestDto, "USER"); + } + + @Test(expected = WorkflowInstanceException.class) + public void testValidateWorkflowInstanceAlreadyAvailableForSyncRegistrationEntity() throws Exception { + List registrationStatusEntities=new ArrayList(); + SyncRegistrationEntity syncRegistrationEntity = new SyncRegistrationEntity(); + syncRegistrationEntity.setRegistrationId("10007100070014420250319152546"); + Mockito.when(registrationStatusDao.findByIdAndProcessAndIteration(any(),any(),anyInt())).thenReturn(registrationStatusEntities); + Mockito.when(syncRegistrationDao.findByRegistrationIdAndRegTypeAndAdditionalInfoReqId(anyString(),any(), anyString())).thenReturn(syncRegistrationEntity); + workflowInstanceService.createWorkflowInstance(workflowInstanceRequestDto, "USER"); + } + +} \ No newline at end of file diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApiTest.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApiTest.java index 7f64c4ff413..ff49cfec530 100644 --- a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApiTest.java +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowActionApiTest.java @@ -86,6 +86,9 @@ public class WorkflowActionApiTest { @Mock WorkflowSearchApi workflowSearchApi; + @Mock + WorkflowInstanceApi workflowInstanceApi; + @InjectMocks WorkflowActionApi workflowActionApi = new WorkflowActionApi() { diff --git a/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApiTest.java b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApiTest.java new file mode 100644 index 00000000000..fe94d22e6f8 --- /dev/null +++ b/registration-processor/workflow-engine/registration-processor-workflow-manager-service/src/test/java/io/mosip/registration/processor/workflowmanager/verticle/WorkflowInstanceApiTest.java @@ -0,0 +1,412 @@ +package io.mosip.registration.processor.workflowmanager.verticle; + +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import io.mosip.kernel.core.exception.NullPointerException; +import io.mosip.registration.processor.core.abstractverticle.EventDTO; +import io.mosip.registration.processor.core.abstractverticle.HealthCheckDTO; +import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress; +import io.mosip.registration.processor.core.abstractverticle.MessageDTO; +import io.mosip.registration.processor.core.abstractverticle.MosipEventBus; +import io.mosip.registration.processor.core.abstractverticle.MosipRouter; +import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; +import io.mosip.registration.processor.core.exception.WorkflowActionException; +import io.mosip.registration.processor.core.exception.WorkflowActionRequestValidationException; +import io.mosip.registration.processor.core.exception.WorkflowInstanceException; +import io.mosip.registration.processor.core.exception.WorkflowInstanceRequestValidationException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.spi.eventbus.EventHandler; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.code.RegistrationStatusCode; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.service.RegistrationStatusService; +import io.mosip.registration.processor.workflowmanager.service.WorkflowActionService; +import io.mosip.registration.processor.workflowmanager.service.WorkflowInstanceService; +import io.mosip.registration.processor.workflowmanager.validator.WorkflowActionRequestValidator; +import io.mosip.registration.processor.workflowmanager.validator.WorkflowInstanceRequestValidator; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpMethod; +import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.json.JsonArray; +import io.vertx.core.json.JsonObject; +import io.vertx.ext.auth.User; +import io.vertx.ext.web.Cookie; +import io.vertx.ext.web.FileUpload; +import io.vertx.ext.web.Locale; +import io.vertx.ext.web.ParsedHeaderValues; +import io.vertx.ext.web.Route; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.RoutingContext; +import io.vertx.ext.web.Session; + +@RunWith(SpringRunner.class) +public class WorkflowInstanceApiTest { + @Mock + private MosipRouter router; + @Mock + MosipEventBus mosipEventBus; + + private Boolean responseObject; + + @Mock + private WorkflowInstanceRequestValidator validator; + + @Mock + private WorkflowInstanceService workflowInstanceService; + + private RoutingContext ctx; + + private InternalRegistrationStatusDto registrationStatusDto; + + @Mock + AuditLogRequestBuilder auditLogRequestBuilder; + + + @InjectMocks + WorkflowInstanceApi workflowInstanceApi = new WorkflowInstanceApi() { + @Override + public void setResponse(RoutingContext ctx, Object object) { + responseObject = Boolean.TRUE; + } + }; + + private RoutingContext setContext() { + return new RoutingContext() { + + @Override + public Set fileUploads() { + return null; + } + + @Override + public Vertx vertx() { + return null; + } + + @Override + public User user() { + return null; + } + + @Override + public int statusCode() { + return 0; + } + + @Override + public void setUser(User user) { + + } + + @Override + public void setSession(Session session) { + } + + @Override + public void setBody(Buffer body) { + } + + @Override + public void setAcceptableContentType(String contentType) { + } + + @Override + public Session session() { + return null; + } + + @Override + public HttpServerResponse response() { + return null; + } + + @Override + public void reroute(HttpMethod method, String path) { + } + + @Override + public HttpServerRequest request() { + return null; + } + + @Override + public boolean removeHeadersEndHandler(int handlerID) { + return false; + } + + @Override + public Cookie removeCookie(String name, boolean invalidate) { + return null; + } + + @Override + public boolean removeBodyEndHandler(int handlerID) { + return false; + } + + @Override + public T remove(String key) { + return null; + } + + @Override + public MultiMap queryParams() { + return null; + } + + @Override + public List queryParam(String query) { + return null; + } + + @Override + public RoutingContext put(String key, Object obj) { + return null; + } + + @Override + public Map pathParams() { + return null; + } + + @Override + public String pathParam(String name) { + return null; + } + + @Override + public ParsedHeaderValues parsedHeaders() { + return null; + } + + @Override + public String normalisedPath() { + return null; + } + + @Override + public void next() { + } + + @Override + public String mountPoint() { + return null; + } + + @Override + public Cookie getCookie(String name) { + return null; + } + + @Override + public String getBodyAsString(String encoding) { + return null; + } + + @Override + public String getBodyAsString() { + return null; + } + + @Override + public JsonArray getBodyAsJsonArray() { + return null; + } + + @Override + public JsonObject getBodyAsJson() { + JsonObject obj = new JsonObject(); + obj.put("id", "mosip.registration.processor.workflow.create"); + obj.put("version", "1.0"); + obj.put("requesttime", "2021-03-15T10:02:45.474Z"); + JsonObject requestObject = new JsonObject(); + requestObject.put("registrationId", "10001104360003820230721101145"); + requestObject.put("process", "NEW"); + requestObject.put("source", "REGISTRATION_CLIENT"); + requestObject.put("additionalInfoReqId", "string"); + obj.put("request", requestObject); + return obj; + } + + @Override + public Buffer getBody() { + return null; + } + + @Override + public String getAcceptableContentType() { + return null; + } + + @Override + public T get(String key) { + return null; + } + + @Override + public Throwable failure() { + return null; + } + + @Override + public boolean failed() { + return false; + } + + @Override + public void fail(Throwable throwable) { + } + + @Override + public void fail(int statusCode) { + } + + @Override + public Map data() { + return null; + } + + @Override + public Route currentRoute() { + return null; + } + + @Override + public Set cookies() { + return null; + } + + @Override + public int cookieCount() { + return 0; + } + + @Override + public void clearUser() { + } + + @Override + public int addHeadersEndHandler(Handler handler) { + return 0; + } + + @Override + public RoutingContext addCookie(Cookie cookie) { + return null; + } + + @Override + public int addBodyEndHandler(Handler handler) { + return 0; + } + + @Override + public List acceptableLocales() { + return null; + } + + @Override + public RoutingContext addCookie(io.vertx.core.http.Cookie arg0) { + return null; + } + + @Override + public int addEndHandler(Handler> arg0) { + return 0; + } + + @Override + public Map cookieMap() { + return null; + } + + @Override + public void fail(int arg0, Throwable arg1) { + + } + + @Override + public boolean isSessionAccessed() { + return false; + } + + @Override + public boolean removeEndHandler(int arg0) { + return false; + } + + + }; + } + + @Before + public void setup() throws Exception { + ReflectionTestUtils.setField(workflowInstanceApi, "dateTimePattern", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + ReflectionTestUtils.setField(workflowInstanceApi, "version", "v1'"); + ReflectionTestUtils.setField(workflowInstanceApi, "id", "mosip.registration.processor.workflow.instance"); + ctx = setContext(); + registrationStatusDto = new InternalRegistrationStatusDto(); + + Mockito.when(auditLogRequestBuilder.createAuditRequestBuilder(any(), any(), any(), any(), any(), any(), any())) + .thenReturn(null); + Mockito.when(workflowInstanceService.createWorkflowInstance(Mockito.any(), Mockito.anyString())) + .thenReturn(registrationStatusDto); + } + + @Test + public void testProcessURL() { + workflowInstanceApi.processURL(ctx); + assertTrue(responseObject); + } + + @Test + public void testWorkflowInstanceRequestValidationException() throws WorkflowInstanceRequestValidationException { + Mockito.doThrow(new WorkflowInstanceRequestValidationException( + PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getCode(), + PlatformErrorMessages.RPR_WIN_INVALID_INPUT_PARAMETER.getMessage())).when(validator).validate(any()); + + workflowInstanceApi.processURL(ctx); + assertTrue(responseObject); + } + + @Test + public void testWorkflowInstanceException() throws Exception { + + Mockito.doThrow(new WorkflowInstanceException(PlatformErrorMessages.RPR_WIS_UNKNOWN_EXCEPTION.getCode(), + PlatformErrorMessages.RPR_WIS_UNKNOWN_EXCEPTION.getMessage())).when(workflowInstanceService) + .createWorkflowInstance(any(), any()); + + workflowInstanceApi.processURL(ctx); + assertTrue(responseObject); + } + + @Test + public void testException() throws WorkflowInstanceRequestValidationException { + Mockito.doThrow(new NullPointerException("", "")).when(validator).validate(any()); + + workflowInstanceApi.processURL(ctx); + assertTrue(responseObject); + } + +} \ No newline at end of file