Skip to content

Commit

Permalink
Merge pull request #8 from geonetwork/tools-pipeline
Browse files Browse the repository at this point in the history
Add tools-pipelines to helm charts
  • Loading branch information
f-necas authored Feb 16, 2024
2 parents 34b08fd + 1a96a44 commit 7e9ba03
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 0 deletions.
23 changes: 23 additions & 0 deletions gn-tools-pipeline/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
8 changes: 8 additions & 0 deletions gn-tools-pipeline/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions gn-tools-pipeline/README.md
Original file line number Diff line number Diff line change
@@ -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


62 changes: 62 additions & 0 deletions gn-tools-pipeline/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}
25 changes: 25 additions & 0 deletions gn-tools-pipeline/templates/gntoolspipelines-job.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions gn-tools-pipeline/values.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7e9ba03

Please sign in to comment.