Skip to content

Commit

Permalink
Merge pull request #608 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 c8cf662 + d0266c6 commit ca84d45
Show file tree
Hide file tree
Showing 34 changed files with 1,966 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 }}
6 changes: 6 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Partner Management portal

## Install
```
$ ./install.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=pms

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
31 changes: 31 additions & 0 deletions deploy/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Uninstalls all pms ui helm charts
## Usage: ./delete.sh [kubeconfig]

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

function deleting_pmp_ui() {
NS=pms
while true; do
read -p "Are you sure you want to delete all pms helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete pmp-ui
helm -n $NS delete pmp-reactjs-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_pmp_ui # calling function
56 changes: 56 additions & 0 deletions deploy/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
# Installs all PMS UI charts
## Usage: ./install.sh [kubeconfig]

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

NS=pms
CHART_VERSION=0.0.1-develop

echo Create $NS namespace
kubectl create ns $NS

function installing_pmp_ui() {
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

INTERNAL_API_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-api-internal-host})
PMP_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-pmp-host})
PMP_NEW_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-pmp-reactjs-ui-new-host})

PARTNER_MANAGER_SERVICE_NAME="pms-partner"
POLICY_MANAGER_SERVICE_NAME="pms-policy"

echo Installing pmp-ui
helm -n $NS install pmp-ui mosip/pmp-ui --set pmp.apiUrl=https://$INTERNAL_API_HOST/ --set istio.hosts=["$PMP_HOST"] --version $CHART_VERSION

echo Installing pmp-reactjs-ui-new
helm -n $NS install pmp-reactjs-ui mosip/pmp-reactjs-ui \
--set pmp_new.react_app_partner_manager_api_base_url="https://$INTERNAL_API_HOST/v1/partnermanager" \
--set pmp_new.react_app_policy_manager_api_base_url="https://$INTERNAL_API_HOST/v1/policymanager" \
--set pmp_new.pms_partner_manager_internal_service_url="http://$PARTNER_MANAGER_SERVICE_NAME.$NS/v1/partnermanager" \
--set pmp_new.pms_policy_manager_internal_service_url="http://$POLICY_MANAGER_SERVICE_NAME.$NS/v1/policymanager" \
--set istio.hosts=["$PMP_NEW_HOST"] --version $CHART_VERSION

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Installed pmp ui services

echo "Partner management portal URL: https://$PMP_HOST/pmp-ui/"
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_pmp_ui # 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 pms services
## Usage: ./restart.sh [kubeconfig]

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

function Restarting_pmp_ui() {
NS=pms
kubectl -n $NS rollout restart deploy

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Restarted pmp 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
Restarting_pmp_ui # calling function
2 changes: 2 additions & 0 deletions helm/pmp-reactjs-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chart
Charts.lock
19 changes: 19 additions & 0 deletions helm/pmp-reactjs-ui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: pmp-reactjs-ui
description: A Helm chart for MOSIP pmp reactJS UI module
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
- pmp
maintainers:
- email: [email protected]
name: MOSIP
33 changes: 33 additions & 0 deletions helm/pmp-reactjs-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Authmanager

Helm chart for installing MOSIP pmp reactJS UI module

## TL;DR

```console
$ helm repo add mosip https://mosip.github.io
$ helm install my-release mosip/pmp-reactjs-ui
```

## Prerequisites

- Kubernetes 1.12+
- Helm 3.1.0
- PV provisioner support in the underlying infrastructure
- ReadWriteMany volumes for deployment scaling

## Installing the Chart

To install the chart with the release name `pmp-reactjs-ui`.

```console
helm install my-release mosip/pmp-reactjs-ui
```

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:


1 change: 1 addition & 0 deletions helm/pmp-reactjs-ui/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

58 changes: 58 additions & 0 deletions helm/pmp-reactjs-ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{/*
Return the proper image name
*/}}
{{- define "pmp-reactjs-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 "pmp-reactjs-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 "pmp-reactjs-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 "pmp-reactjs-ui.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 "pmp-reactjs-ui.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "pmp-reactjs-ui.validateValues.foo" .) -}}
{{- $messages := append $messages (include "pmp-reactjs-ui.validateValues.bar" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}

{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}

{{/*
Return podAnnotations
*/}}
{{- define "pmp-reactjs-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 -}}
59 changes: 59 additions & 0 deletions helm/pmp-reactjs-ui/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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:
nginx.conf: |-
worker_processes 1;
events {
worker_connections 1024;
}
http {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 3000;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location /v1/partnermanager {
proxy_pass {{ .Values.pmp_new.pms_partner_manager_internal_service_url }};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
location /v1/policymanager {
proxy_pass {{ .Values.pmp_new.pms_policy_manager_internal_service_url }};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
location / {
# alias /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
}
Loading

0 comments on commit ca84d45

Please sign in to comment.