-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from ckm007/develop
[MOSIP-34233]
- Loading branch information
Showing
20 changed files
with
1,032 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Pre-Registration Module | ||
|
||
## Install | ||
|
||
* Make sure your prereg UI domain name is set in [global configmap](../../cluster/global_configmap.yaml.sample) | ||
* Make sure this domain points to the public load balancer as PreReg UI is exposed to public. | ||
* Install | ||
```sh | ||
./install.sh | ||
``` | ||
|
||
## Uninstall | ||
|
||
```sh | ||
./delete.sh | ||
``` | ||
|
||
## Test | ||
On a browser open `https://<prereg ui domain>/pre-registration-ui/`. Example `https://prereg.sandbox.xyz.net/pre-registration-ui`. Follow the instructions. You may use [sample documents](samples/) to upload during pre-registration. | ||
|
||
## Rate Control Using Envoyfilter | ||
|
||
- Using Envoyfilter one can limit the rate of http requests coming in to a resource. Reference: [Istio Policty Enforcement](https://istio.io/latest/docs/tasks/policy-enforcement/rate-limit/#local-rate-limit) and [Rate Limit Filter](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/local_rate_limit_filter). | ||
- Edit the envoyfilter [here](./rate-control-envoyfilter.yaml) | ||
- Edit these values in the envoyfilter accordingly. | ||
``` | ||
token_bucket: | ||
max_tokens: <preferred same as tokens_per_fill> | ||
tokens_per_fill: <no of reqeust allowed in "fill_internal" ammount of time> | ||
fill_interval: <minimum_50ms> | ||
``` | ||
- Edit the workload selector label properly, like; | ||
``` | ||
workloadSelector: | ||
labels: | ||
app.kubernetes.io/instance: <prereg-ui or prereg-application, etc> | ||
``` | ||
- Apply the envoyfilter in the prereg namespace. | ||
``` | ||
kubectl apply -n prereg -f rate-control-envoyfilter.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=prereg | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# Uninstalls all prereg ui helm charts | ||
function deleting_prereg_ui() { | ||
while true; do | ||
read -p "Are you sure you want to delete all prereg ui helm charts?(Y/n) " yn | ||
if [ $yn = "Y" ] | ||
then | ||
helm -n prereg delete prereg-gateway | ||
helm -n prereg delete prereg-ui | ||
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_prereg_ui # calling function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# Installs all prereg-ui helm charts | ||
## Usage: ./install.sh [kubeconfig] | ||
|
||
if [ $# -ge 1 ] ; then | ||
export KUBECONFIG=$1 | ||
fi | ||
|
||
NS=prereg | ||
CHART_VERSION=0.0.1-develop | ||
|
||
echo Create $NS namespace | ||
kubectl create ns $NS | ||
|
||
function installing_prereg_ui() { | ||
echo Istio label | ||
## TODO: Istio proxy disabled for now as prereui does not come up if | ||
## envoy filter container gets installed after prereg-uicontainer. | ||
kubectl label ns $NS istio-injection=disabled --overwrite | ||
helm repo update | ||
|
||
echo Copy configmaps | ||
sed -i 's/\r$//' copy_cm.sh | ||
./copy_cm.sh | ||
|
||
API_HOST=`kubectl get cm global -o jsonpath={.data.mosip-api-host}` | ||
PREREG_HOST=`kubectl get cm global -o jsonpath={.data.mosip-prereg-host}` | ||
|
||
echo Install prereg-gateway | ||
helm -n $NS install prereg-gateway mosip/prereg-gateway --set istio.hosts[0]=$PREREG_HOST --version $CHART_VERSION | ||
|
||
echo Installing prereg-ui | ||
helm -n $NS install prereg-ui mosip/prereg-ui --set prereg.apiHost=$PREREG_HOST --version $CHART_VERSION | ||
|
||
kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status | ||
|
||
echo Installed prereg-ui 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_prereg_ui # calling function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# Restart the prereg ui services | ||
## Usage: ./restart.sh [kubeconfig] | ||
|
||
if [ $# -ge 1 ] ; then | ||
export KUBECONFIG=$1 | ||
fi | ||
|
||
function Restarting_prereg_ui() { | ||
NS=prereg | ||
kubectl -n $NS rollout restart deploy | ||
|
||
kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status | ||
|
||
echo Restarted prereg 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_prereg_ui # calling function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
charts/ | ||
Charts.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: prereg-ui | ||
description: A Helm chart for MOSIP Pre-registration UI | ||
type: application | ||
version: 0.0.1-develop | ||
appVersion: "" | ||
dependencies: | ||
- name: common | ||
repository: https://charts.bitnami.com/bitnami | ||
tags: | ||
- bitnami-common | ||
version: 1.x.x | ||
home: https://mosip.io | ||
keywords: | ||
- mosip | ||
- prereg-ui | ||
- kernel | ||
maintainers: | ||
- email: [email protected] | ||
name: MOSIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# PreReg UI | ||
|
||
Helm chart for installing Pre-Registration UI | ||
|
||
## Install | ||
```console | ||
$ kubectl create namespace prereg | ||
$ helm repo add mosip https://mosip.github.io | ||
$ helm -n prereg install my-release mosip/prereg-ui | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{{/* | ||
Return the proper image name | ||
*/}} | ||
{{- define "prereg-ui.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 "prereg-ui.volumePermissions.image" -}} | ||
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper Docker Image Registry Secret Names | ||
*/}} | ||
{{- define "prereg-ui.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 "prereg-ui.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 "prereg-ui.validateValues" -}} | ||
{{- $messages := list -}} | ||
{{- $messages := append $messages (include "prereg-ui.validateValues.foo" .) -}} | ||
{{- $messages := append $messages (include "prereg-ui.validateValues.bar" .) -}} | ||
{{- $messages := without $messages "" -}} | ||
{{- $message := join "\n" $messages -}} | ||
|
||
{{- if $message -}} | ||
{{- printf "\nVALUES VALIDATION:\n%s" $message -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return podAnnotations | ||
*/}} | ||
{{- define "prereg-ui.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 -}} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
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 }} | ||
|
||
data: | ||
config.json: |- | ||
{"BASE_URL":"https://{{ tpl .Values.prereg.apiHost . }}", "PRE_REG_URL" : "/preregistration/v1/"} | ||
Oops, something went wrong.