Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOSIP-34233] #653

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
34 changes: 34 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Regclient

## Introduction
The chart here installs a regclient downloader accessed over an http URL.

## Install
* Make sure global configmap contains the url for regclient host e.g. `regclient.sandbox.xyz.net`.
* The url must point to your internal loadbalancer as regclient will typically not be open to public.
* Install
```sh
./install.sh
```
## Download
The download URL will be available at `https://your-reglient-host`. Example: `https://reglient.sandbox.xyz.net`.

## Customization
If you want to add extra environment variables to the regclient docker do follow the below mentioned steps.
1. Add the variables in extraEnvVars section of the sample 'values.yaml.sample' file given.
2. Rename 'values.yaml.sample' file to 'values.yaml'.
3. Append 'values.yaml' to the install.sh script as '-f values.yaml' to include the environmental variables to the regclient docker.

```
helm -n $NS install regclient mosip/regclient \
--set regclient.upgradeServerUrl=https://$INTERNAL_HOST \
--set regclient.healthCheckUrl=$HEALTH_URL \
--set regclient.hostName=$INTERNAL_HOST \
--set istio.host=$REGCLIENT_HOST \
--wait \
-f values.yaml \
--version $CHART_VERSION
```

## Set up of regclient
Follow the guide [here](https://github.com/mosip/registration-client/blob/develop/README.md)
22 changes: 22 additions & 0 deletions deploy/copy_cm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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=regclient

wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh

$COPY_UTIL configmap artifactory-share artifactory $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
30 changes: 30 additions & 0 deletions deploy/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Uninstalls Regclient downloader
## Usage: ./delete.sh [kubeconfig]

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

function deleting_regclient() {
NS=regclient
while true; do
read -p "Are you sure you want to delete regclient helm chart?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete regclient
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_regclient # calling function
48 changes: 48 additions & 0 deletions deploy/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Installs regclient Downloader
## Usage: ./install.sh [kubeconfig]

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

NS=regclient
CHART_VERSION=0.0.1-develop

echo Create $NS namespace
kubectl create ns $NS

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

REGCLIENT_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-regclient-host})
INTERNAL_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-api-internal-host})
HEALTH_URL=https://$INTERNAL_HOST/v1/syncdata/actuator/health

echo Installing reg client downloader. This may take a few minutes ..
helm -n $NS install regclient mosip/regclient \
--set regclient.upgradeServerUrl=https://$REGCLIENT_HOST \
--set regclient.healthCheckUrl=$HEALTH_URL \
--set regclient.hostName=$INTERNAL_HOST \
--set istio.host=$REGCLIENT_HOST \
--wait \
--version $CHART_VERSION

echo Get your download url from here
echo https://$REGCLIENT_HOST/
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_regclient # 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 regclient service
## Usage: ./restart.sh [kubeconfig]

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

function Restarting_regclient() {
NS=regclient
kubectl -n $NS rollout restart deploy

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

echo Restarted regclient 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_regclient # calling function
Binary file added deploy/samples/sample_address_proof.pdf
Binary file not shown.
Binary file added deploy/samples/sample_exception_proof.pdf
Binary file not shown.
Binary file added deploy/samples/sample_identity_proof.pdf
Binary file not shown.
Binary file added deploy/samples/sample_relationship_proof.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions deploy/values.yaml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extraEnvVars:
- name: client_certificate_env
value: mosip_cer.cer
2 changes: 2 additions & 0 deletions helm/regclient/.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/regclient/.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
21 changes: 21 additions & 0 deletions helm/regclient/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: regclient
description: A Helm chart to installed Downloader for Regstration Client Application
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
- regclient
- registration
- client
maintainers:
- email: info@mosip.io
name: MOSIP
11 changes: 11 additions & 0 deletions helm/regclient/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Registration Client Downloader

Helm chart for installing for Registration client downloader.

## Install

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

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

58 changes: 58 additions & 0 deletions helm/regclient/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{/*
Return the proper image name
*/}}
{{- define "regclient.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 "regclient.volumePermissions.image" -}}
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "regclient.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 "regclient.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 "regclient.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "regclient.validateValues.foo" .) -}}
{{- $messages := append $messages (include "regclient.validateValues.bar" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}

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

{{/*
Return podAnnotations
*/}}
{{- define "regclient.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 -}}
35 changes: 35 additions & 0 deletions helm/regclient/templates/configmap-index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Config map to insert a landing index.html page in the docker. This may be removed later if the same is done while building the docker.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-index
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:
index.html: |-
<!DOCTYPE html>
<html>
<style>
.content {
max-width: 700px;
margin: auto;
text-align: center;
}
</style>
<body>
<div class="content">
<img src="https://mosip.github.io/mosip-helm/mosip_logo.png">
<h2 style="font-family:verdana;"> Registration Client</h2>
<a href="https://{{ .Values.istio.host }}/registration-client/{{ .Values.regclient.version }}/reg-client.zip" style="font-family:verdana;">Windows 10</a>
<h4 style="font-family:verdana;"> Registration Client Test Utility</h2>
<a href="https://{{ .Values.istio.host }}/registration-client/{{ .Values.regclient.version }}/registration-test-utility.zip" style="font-family:verdana;">Windows 10</a>
</div>
</body>
</html>
Loading
Loading