Skip to content

Commit

Permalink
Merge pull request #1896 from ckm007/develop
Browse files Browse the repository at this point in the history
[MOSIP-34233]
  • Loading branch information
ckm007 authored Jul 18, 2024
2 parents dd583f1 + b5d7020 commit 6f4632c
Show file tree
Hide file tree
Showing 232 changed files with 13,596 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/chart-lint-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 16 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -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
```
24 changes: 24 additions & 0 deletions deploy/copy_cm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination namespace

function copying_cm() {
UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh
COPY_UTIL=./copy_cm_func.sh
DST_NS=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
39 changes: 39 additions & 0 deletions deploy/delete.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions deploy/group1_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
persistence:
storageClass: longhorn
size: 5Gi
84 changes: 84 additions & 0 deletions deploy/install.sh
Original file line number Diff line number Diff line change
@@ -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=0.0.1-develop

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
25 changes: 25 additions & 0 deletions deploy/restart.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions deploy/topic/create_topics.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions deploy/upgrade/README.md
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions deploy/upgrade/dmz-landing-pv.yaml
Original file line number Diff line number Diff line change
@@ -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: <nfs-server-ip>
path: <nfs-server-path>
14 changes: 14 additions & 0 deletions deploy/upgrade/dmz-landing-pvc.yaml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions deploy/upgrade/dmz-pkt-pv.yaml
Original file line number Diff line number Diff line change
@@ -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: <nfs-server-ip>
path: <nfs-server-directory>
15 changes: 15 additions & 0 deletions deploy/upgrade/dmz-pkt-pvc.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions deploy/upgrade/dmz-sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: manual
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
2 changes: 2 additions & 0 deletions helm/regproc-camel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
Charts.lock
21 changes: 21 additions & 0 deletions helm/regproc-camel/.helmignore
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 6f4632c

Please sign in to comment.