Skip to content

Commit

Permalink
Merge pull request #2 from lalithkota/develop
Browse files Browse the repository at this point in the history
Helm chart added.
  • Loading branch information
lalithkota authored Oct 18, 2024
2 parents 9f5dcd4 + 8d3e2a5 commit b7fbf49
Show file tree
Hide file tree
Showing 28 changed files with 1,164 additions and 67 deletions.
134 changes: 134 additions & 0 deletions .github/workflows/helm-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Publish OpenG2P Helm charts on

on:
push:
tags-ignore:
- '**'
branches:
- 1.*
- develop
- main
workflow_dispatch:
inputs:
forcePublishCharts:
description: "Force publish Charts?"
default: "*"
type: string

jobs:
generate-charts:
runs-on: ubuntu-latest
env:
SKIP: 'FALSE'
RANCHER_CHART_FILTER: "openg2p.org/add-to-rancher"
FORCE_PUBLISH_CHARTS: "${{ inputs.forcePublishCharts || '' }}"
defaults:
run:
shell: bash
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- id: files
if: env.FORCE_PUBLISH_CHARTS == ''
uses: jitterbit/get-changed-files@v1

- name: save helm/charts to tmp.txt file
run: |
touch charts-list.txt
if [ -n "${FORCE_PUBLISH_CHARTS}" ]; then
for chart in charts/${FORCE_PUBLISH_CHARTS}/; do
chart="${chart#charts/}"
chart="${chart%/}"
echo "$chart" >> charts-list.txt
done
else
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ ${changed_file} =~ ^charts ]]; then
chart_name=$(echo "${changed_file}" | awk -F/ '/^[charts]/{print $2}')
echo $chart_name >> charts-list.txt;
echo "Saved $chart_name chart to charts-list.txt"
fi
done
cat charts-list.txt | sort | uniq > charts-list-unique.txt
mv charts-list-unique.txt charts-list.txt
fi
echo "List of charts to be published";
cat charts-list.txt
- name: Generate tar files
run: |
if [[ ! -s charts-list.txt ]]; then
echo "::warning::No Charts to publish";
echo "SKIP=TRUE" >> $GITHUB_ENV
else
for chartpath in charts/*/; do
if [ -f ${chartpath}Chart.yaml ]; then
helm dep up $chartpath
fi
done
RANCHER_CHARTS=()
while IFS= read -r chartpath; do
echo "chartpath: $chartpath"
chartname=$(basename "$chartpath")
if [ -f charts/${chartname}/Chart.yaml ]; then
echo "Chartname: $chartname"
helm package charts/$chartpath
is_rancher_chart=$(grep "$RANCHER_CHART_FILTER" charts/${chartpath%*/}/Chart.yaml || true)
if [ -n "$is_rancher_chart" ]; then
RANCHER_CHARTS+=("$chartname")
fi
fi
done < charts-list.txt
echo "RANCHER_CHARTS=${RANCHER_CHARTS[@]}" >> $GITHUB_ENV
rm charts-list.txt
fi
shopt -s nocasematch
if [[ '${{ github.repository_owner }}' != 'OpenG2P' ]]; then
echo "SKIP=TRUE" >> $GITHUB_ENV
fi
- name: Upload tar as Artifact
uses: actions/upload-artifact@v4
with:
name: charts
path: ./*.tgz
if: env.SKIP != 'TRUE'

- name: Checkout branch for publishing
uses: actions/checkout@v3
with:
repository: 'openg2p/openg2p-helm'
ref: gh-pages
token: ${{ secrets.OPENG2P_BOT_GITHUB_PAT }}
if: env.SKIP != 'TRUE'

- name: Download tar from Artifacts
uses: actions/download-artifact@v4
with:
name: charts
path: ./
if: env.SKIP != 'TRUE'

- name: Update index.yaml
run: |
helm repo index --url https://openg2p.github.io/openg2p-helm/ .
for chartname in $RANCHER_CHARTS; do
cp ${chartname}*.tgz rancher/
done
helm repo index --url https://openg2p.github.io/openg2p-helm/ --merge rancher/index.yaml rancher
for chartname in $RANCHER_CHARTS; do
rm rancher/${chartname}*.tgz || true
done
if: env.SKIP != 'TRUE'

- name: Commit Changes to repository
uses: EndBug/add-and-commit@v7
with:
branch: gh-pages
author_name: openg2pbot
author_email: [email protected]
default_author: user_info
message: 'added deduplicator helm charts for publish openg2p/openg2p-deduplicator@${{ github.sha }}'
add: './*.tgz ./index.yaml rancher/index.yaml'
if: env.SKIP != 'TRUE'
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repos:
- id: check-symlinks
- id: check-toml
- id: check-yaml
exclude: ^charts/.*/templates/
args:
- --unsafe
- id: mixed-line-ending
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

Deduplication service of OpenG2P offering fuzzy match on demographic data.

Refer to https://docs.openg2p.org.

## Available Packages

Package | Description
Expand Down
1 change: 1 addition & 0 deletions charts/openg2p-deduplicator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
charts/
21 changes: 21 additions & 0 deletions charts/openg2p-deduplicator/.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
9 changes: 9 additions & 0 deletions charts/openg2p-deduplicator/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.24.0
- name: opensearch
repository: oci://registry-1.docker.io/bitnamicharts
version: 1.2.0
digest: sha256:9382dcc5ef4ac9e3c203e428d70c8c9f7de47a0ae6b2197d77696cfcdb556345
generated: "2024-10-11T13:06:07.180171021+05:30"
26 changes: 26 additions & 0 deletions charts/openg2p-deduplicator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v2
name: openg2p-deduplicator
description: A Helm chart for OpenG2P Deduplicator
type: application
version: 0.0.0-develop
appVersion: ""
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.x.x
- name: opensearch
version: 1.2.0
repository: oci://registry-1.docker.io/bitnamicharts
condition: opensearch.enabled
home: https://openg2p.org
keywords:
- openg2p
- deduplication
- deduplicator
- opensearch
maintainers:
- email: [email protected]
name: OpenG2P
icon: https://openg2p.github.io/openg2p-helm/openg2p-logo.png
annotations:
catalog.cattle.io/display-name: "OpenG2P Deduplicator"
5 changes: 5 additions & 0 deletions charts/openg2p-deduplicator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# OpenG2P Deduplicator

Helm chart for installing OpenG2P Deduplicator.

Refer to https://docs.openg2p.org.
Empty file.
35 changes: 35 additions & 0 deletions charts/openg2p-deduplicator/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
questions:
- variable: opensearch.enabled
description: This installs OpenSearch along with the deduplicator
type: boolean
label: Install OpenSearch?

- variable: opensearch.dashboards.enabled
description: This installs OpenSearch Dashboards along with OpenSearch
type: boolean
label: Install OpenSearch Dashboards?
show_if: "opensearch.enabled=true"

- variable: opensearch.hostname
description: Hostname on which OpenSearch Dashboards should be accessed
type: string
label: OpenSearch Hostname
show_if: "opensearch.enabled=true&&opensearch.dashboards.enabled=true"

- variable: global.keycloakBaseUrl
description: Required for Authentication.
type: string
label: Keycloak Base URL
show_if: "opensearch.enabled=true&&opensearch.dashboards.enabled=true"

- variable: opensearch.oidcClientId
description: OIDC Client ID for OpenSearch login
type: string
label: OpenSearch OIDC Client ID
show_if: "opensearch.enabled=true&&opensearch.dashboards.enabled=true"

- variable: opensearch.oidcClientSecret
description: OIDC Client Secret for OpenSearch login
type: string
label: OpenSearch OIDC Client Secret
show_if: "opensearch.enabled=true&&opensearch.dashboards.enabled=true"
46 changes: 46 additions & 0 deletions charts/openg2p-deduplicator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{/*
Return the proper image name
*/}}
{{- define "deduplicator.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "deduplicator.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "deduplicator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s-foo" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Render Env values section
*/}}
{{- define "deduplicator.baseEnvVars" -}}
{{- $context := .context -}}
{{- range $k, $v := .envVars }}
- name: {{ $k }}
{{- if or (kindIs "int64" $v) (kindIs "float64" $v) (kindIs "bool" $v) }}
value: {{ $v | quote }}
{{- else if kindIs "string" $v }}
value: {{ include "common.tplvalues.render" ( dict "value" $v "context" $context ) | squote }}
{{- else }}
valueFrom: {{- include "common.tplvalues.render" ( dict "value" $v "context" $context ) | nindent 4}}
{{- end }}
{{- end }}
{{- end -}}

{{- define "deduplicator.envVars" -}}
{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) -}}
{{- include "deduplicator.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}
93 changes: 93 additions & 0 deletions charts/openg2p-deduplicator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- 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" (dict "customLabels" .Values.podLabels "context" $) | nindent 6 }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.podLabels "context" $) | nindent 8 }}
spec:
serviceAccountName: {{ template "deduplicator.serviceAccountName" . }}
{{- include "deduplicator.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 }}
{{- if .Values.initContainers }}
initContainers:
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: deduplicator
image: {{ template "deduplicator.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:
{{- include "deduplicator.envVars" . | nindent 12 }}
ports:
- name: http
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 }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
volumeMounts: {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.extraVolumes }}
volumes: {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
Loading

0 comments on commit b7fbf49

Please sign in to comment.