diff --git a/gn-tools-pipeline/.helmignore b/gn-tools-pipeline/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/gn-tools-pipeline/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/gn-tools-pipeline/Chart.yaml b/gn-tools-pipeline/Chart.yaml new file mode 100644 index 0000000..69ba03f --- /dev/null +++ b/gn-tools-pipeline/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: gn-tools-pipelines +description: A Helm chart to deploy the tools-pipelines utility for geonetwork-ui +type: application +version: 0.1.0 +maintainers: + - name: geOrchestra + url: https://www.georchestra.org diff --git a/gn-tools-pipeline/README.md b/gn-tools-pipeline/README.md new file mode 100644 index 0000000..d765da9 --- /dev/null +++ b/gn-tools-pipeline/README.md @@ -0,0 +1,18 @@ +# GN-tools-pipelines + +Contains utilities related to registering pipelines on ElasticSearch. +Pipelines are used to preprocess records during the indexation process, thus offering greater control over the values returned by ElasticSearch and giving an improved user experience when searching records. + +## Source Code + +* https://github.com/geonetwork/geonetwork-ui/tree/main/apps/datahub + +## Requirements + +Kubernetes: `>=1.14.0-0` + +## Dependencies + +None + + diff --git a/gn-tools-pipeline/templates/_helpers.tpl b/gn-tools-pipeline/templates/_helpers.tpl new file mode 100644 index 0000000..1cc6fd7 --- /dev/null +++ b/gn-tools-pipeline/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "gn-tools-pipelines.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "gn-tools-pipelines.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "gn-tools-pipelines.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "gn-tools-pipelines.labels" -}} +helm.sh/chart: {{ include "gn-tools-pipelines.chart" . }} +{{ include "gn-tools-pipelines.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "gn-tools-pipelines.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gn-tools-pipelines.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "gn-tools-pipelines.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "gn-tools-pipelines.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/gn-tools-pipeline/templates/gntoolspipelines-job.yaml b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml new file mode 100644 index 0000000..2d8c6d1 --- /dev/null +++ b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml @@ -0,0 +1,25 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "gn-tools-pipelines.fullname" }} + labels: + {{ include "gn-tools-pipelines.labels" . | nindent 4 }} +spec: + template: + spec: + initContainers: + - name: init + image: curlimages/curl:latest + command: ['sh', '-c', 'while [ `curl -Lk --write-out "%{http_code}\n" --silent --output /dev/null "{{ .Values.config.elasticsearch.host }}/{{ .Values.config.elasticsearch.index }}"` -ne 200 ]; do sleep 2; done'] + containers: + - name: {{ include "gn-tools-pipelines.fullname" }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: ES_HOST + value: {{ .Values.config.elasticsearch.host | required ".Values.config.elasticsearch.host is required." }} + - name: RECORDS_INDEX + value: {{ .Values.config.elasticsearch.index | required ".Values.config.elasticsearch.index is required." }} + restartPolicy: Never + + backoffLimit: 2 \ No newline at end of file diff --git a/gn-tools-pipeline/values.yaml b/gn-tools-pipeline/values.yaml new file mode 100644 index 0000000..5629e74 --- /dev/null +++ b/gn-tools-pipeline/values.yaml @@ -0,0 +1,11 @@ +replicaCount: 1 + +image: + repository: geonetwork/geonetwork-ui-tools-pipelines + tag: latest + pullPolicy: Always + +config: + elasticsearch: + host: "http://localhost:9200" + index: "gn-records"