From da8cb36dc81102df9e785de45f64b1f8a42d2c5f Mon Sep 17 00:00:00 2001 From: fnecas Date: Tue, 13 Feb 2024 12:10:12 +0100 Subject: [PATCH 1/5] wip: add tools-pipeline --- tools-pipeline/.helmignore | 23 +++++ tools-pipeline/Chart.yaml | 9 ++ tools-pipeline/README.md | 70 +++++++++++++++ .../_bootstrap-datahub-configuration.tpl | 25 ++++++ tools-pipeline/templates/_helpers.tpl | 62 +++++++++++++ .../templates/datahub-deployment.yaml | 87 +++++++++++++++++++ tools-pipeline/templates/datahub-ingress.yaml | 57 ++++++++++++ tools-pipeline/templates/datahub-svc.yaml | 15 ++++ tools-pipeline/values.yaml | 50 +++++++++++ 9 files changed, 398 insertions(+) create mode 100644 tools-pipeline/.helmignore create mode 100644 tools-pipeline/Chart.yaml create mode 100644 tools-pipeline/README.md create mode 100644 tools-pipeline/templates/_bootstrap-datahub-configuration.tpl create mode 100644 tools-pipeline/templates/_helpers.tpl create mode 100644 tools-pipeline/templates/datahub-deployment.yaml create mode 100644 tools-pipeline/templates/datahub-ingress.yaml create mode 100644 tools-pipeline/templates/datahub-svc.yaml create mode 100644 tools-pipeline/values.yaml diff --git a/tools-pipeline/.helmignore b/tools-pipeline/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/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/tools-pipeline/Chart.yaml b/tools-pipeline/Chart.yaml new file mode 100644 index 0000000..e5be415 --- /dev/null +++ b/tools-pipeline/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: tools-pipeline +description: A Helm chart to deploy the tools-pipelines utility for datahub +type: application +version: 0.4.3 +appVersion: "1.16.0" +maintainers: + - name: geOrchestra + url: https://www.georchestra.org diff --git a/tools-pipeline/README.md b/tools-pipeline/README.md new file mode 100644 index 0000000..1e1a8e5 --- /dev/null +++ b/tools-pipeline/README.md @@ -0,0 +1,70 @@ +# Datahub + +UI of the web application `datahub`. + +`datahub` is an application to provide a default, pure and simple UI for metadata and dataset search. + +Inspire by Opendata catalogs (CKAN, Opendatasoft), the Hub will host geo and non-geo dataset. It will provide dataviz tool and focuses the experience on the dataset instead of on the metadata. + +## Source Code + +* https://github.com/geonetwork/geonetwork-ui/tree/main/apps/datahub + +## Requirements + +Kubernetes: `>=1.14.0-0` + +## Dependencies + +None + +## Installing the Chart + +To install the chart with the release name `datahub` + +```console +helm repo add geonetwork https://helm-charts.geonetwork-opensource.org +helm repo update +helm install datahub geonetwork/datahub +``` + +## Uninstalling the Chart + +To uninstall the `datahub` deployment + +```console +helm uninstall datahub +``` + +The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release. + +## Configuration + +Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +```console +helm install datahub \ + --set replicaCount="2" \ + geonetwork/datahub +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. + +```console +helm install datahub geonetwork/datahub -f values.yaml +``` + +## Datahub configuration + +Through the parameter `configuration.git`, you can set a git repository that will be used for configuring datahub. + +Both `configuration.config_directory_override` and `configuration.assets_directory_override` are available to specify the directory where datahub should find the configuration. + +The default values are `/conf` for the configuration and `/assets` for the assets. + +Please refer to the docker documentation for more explanations about this custom configuration: https://github.com/geonetwork/geonetwork-ui/tree/main/apps/datahub#specifying-a-custom-configuration-file + +## Values + diff --git a/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl b/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl new file mode 100644 index 0000000..7b88776 --- /dev/null +++ b/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl @@ -0,0 +1,25 @@ +{{- define "datahub.bootstrap_datahub_configuration" -}} +- name: bootstrap-datahub-configuration + image: bitnami/git + command: + - /bin/sh + - -c + - {{- if .Values.configuration.git.ssh_secret }} + mkdir -p /root/.ssh ; + cp /ssh-secret/ssh-privatekey /root/.ssh/id_rsa ; + chmod 0600 /root/.ssh/id_rsa ; + {{- end }} + git clone --depth 1 --single-branch {{ .Values.configuration.git.url }} -b {{ .Values.configuration.git.ref }} /etc/datahub ; + {{- if .Values.configuration.git.ssh_secret }} + env: + - name: GIT_SSH_COMMAND + value: ssh -o "IdentitiesOnly=yes" -o "StrictHostKeyChecking no" + {{- end }} + volumeMounts: + - mountPath: /etc/datahub + name: datahub-configuration + {{- if .Values.configuration.git.ssh_secret }} + - mountPath: /ssh-secret + name: ssh-secret + {{- end }} +{{- end -}} diff --git a/tools-pipeline/templates/_helpers.tpl b/tools-pipeline/templates/_helpers.tpl new file mode 100644 index 0000000..7faafa2 --- /dev/null +++ b/tools-pipeline/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "helm-datahub.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 "helm-datahub.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 "helm-datahub.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "helm-datahub.labels" -}} +helm.sh/chart: {{ include "helm-datahub.chart" . }} +{{ include "helm-datahub.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "helm-datahub.selectorLabels" -}} +app.kubernetes.io/name: {{ include "helm-datahub.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "helm-datahub.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "helm-datahub.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/tools-pipeline/templates/datahub-deployment.yaml b/tools-pipeline/templates/datahub-deployment.yaml new file mode 100644 index 0000000..6cc39ef --- /dev/null +++ b/tools-pipeline/templates/datahub-deployment.yaml @@ -0,0 +1,87 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "helm-datahub.fullname" . }}-datahub-deployment + labels: + {{- include "helm-datahub.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "helm-datahub.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "helm-datahub.selectorLabels" . | nindent 8 }} + org.geonetwork.service/name: {{ include "helm-datahub.fullname" . }}-datahub-deployment + spec: + {{- if .Values.configuration.git.url }} + initContainers: + {{- include "datahub.bootstrap_datahub_configuration" $ | nindent 6 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + {{- with .Values.lifecycle }} + lifecycle: + {{- toYaml . | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: CONFIG_DIRECTORY_OVERRIDE + value: "/etc/datahub/{{ .Values.configuration.override_directories.config_directory_override }}" + - name: ASSETS_DIRECTORY_OVERRIDE + value: "/etc/datahub/{{ .Values.configuration.override_directories.assets_directory_override }}" + {{- with .Values.extra_environment }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: datahub-configuration + mountPath: /etc/datahub + volumes: + - name: datahub-configuration + emptyDir: {} + {{- if .Values.configuration.git.ssh_secret }} + - name: ssh-secret + secret: + secretName: {{ .Values.configuration.git.ssh_secret }} + defaultMode: 0400 + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/tools-pipeline/templates/datahub-ingress.yaml b/tools-pipeline/templates/datahub-ingress.yaml new file mode 100644 index 0000000..92bfaa3 --- /dev/null +++ b/tools-pipeline/templates/datahub-ingress.yaml @@ -0,0 +1,57 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "helm-datahub.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} + +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "helm-datahub.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: Prefix + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-datahub-svc + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/tools-pipeline/templates/datahub-svc.yaml b/tools-pipeline/templates/datahub-svc.yaml new file mode 100644 index 0000000..1f4f071 --- /dev/null +++ b/tools-pipeline/templates/datahub-svc.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "helm-datahub.fullname" . }}-datahub-svc + labels: + {{- include "helm-datahub.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + org.geonetwork.service/name: {{ include "helm-datahub.fullname" . }}-datahub-deployment diff --git a/tools-pipeline/values.yaml b/tools-pipeline/values.yaml new file mode 100644 index 0000000..9b5648c --- /dev/null +++ b/tools-pipeline/values.yaml @@ -0,0 +1,50 @@ +replicaCount: 1 + +image: + repository: geonetwork/geonetwork-ui-tools-pipelines + tag: latest + pullPolicy: Always + +ingress: + enabled: false + +extra_environment: + - name: ES_HOST + value: "http://localhost:9200" + - name: RECORDS_INDEX + value: "geonetwork" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +#lifecycle: +# postStart: +# exec: +# command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] +# preStop: +# exec: +# command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"] + +resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + + +nodeSelector: {} + +tolerations: [] + +affinity: {} \ No newline at end of file From a52a3057b22840ece5b20f41d90a19704ab034a6 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Tue, 13 Feb 2024 17:09:33 +0100 Subject: [PATCH 2/5] feat: set tools pipelines to job --- .../.helmignore | 0 .../Chart.yaml | 7 +- gn-tools-pipeline/README.md | 18 ++++ .../templates/_helpers.tpl | 20 ++--- .../templates/gntoolspipelines-job.yaml | 24 +++++ .../values.yaml | 11 +-- tools-pipeline/README.md | 70 --------------- .../_bootstrap-datahub-configuration.tpl | 25 ------ .../templates/datahub-deployment.yaml | 87 ------------------- tools-pipeline/templates/datahub-ingress.yaml | 57 ------------ tools-pipeline/templates/datahub-svc.yaml | 15 ---- 11 files changed, 61 insertions(+), 273 deletions(-) rename {tools-pipeline => gn-tools-pipeline}/.helmignore (100%) rename {tools-pipeline => gn-tools-pipeline}/Chart.yaml (71%) create mode 100644 gn-tools-pipeline/README.md rename {tools-pipeline => gn-tools-pipeline}/templates/_helpers.tpl (71%) create mode 100644 gn-tools-pipeline/templates/gntoolspipelines-job.yaml rename {tools-pipeline => gn-tools-pipeline}/values.yaml (85%) delete mode 100644 tools-pipeline/README.md delete mode 100644 tools-pipeline/templates/_bootstrap-datahub-configuration.tpl delete mode 100644 tools-pipeline/templates/datahub-deployment.yaml delete mode 100644 tools-pipeline/templates/datahub-ingress.yaml delete mode 100644 tools-pipeline/templates/datahub-svc.yaml diff --git a/tools-pipeline/.helmignore b/gn-tools-pipeline/.helmignore similarity index 100% rename from tools-pipeline/.helmignore rename to gn-tools-pipeline/.helmignore diff --git a/tools-pipeline/Chart.yaml b/gn-tools-pipeline/Chart.yaml similarity index 71% rename from tools-pipeline/Chart.yaml rename to gn-tools-pipeline/Chart.yaml index e5be415..69ba03f 100644 --- a/tools-pipeline/Chart.yaml +++ b/gn-tools-pipeline/Chart.yaml @@ -1,9 +1,8 @@ apiVersion: v2 -name: tools-pipeline -description: A Helm chart to deploy the tools-pipelines utility for datahub +name: gn-tools-pipelines +description: A Helm chart to deploy the tools-pipelines utility for geonetwork-ui type: application -version: 0.4.3 -appVersion: "1.16.0" +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/tools-pipeline/templates/_helpers.tpl b/gn-tools-pipeline/templates/_helpers.tpl similarity index 71% rename from tools-pipeline/templates/_helpers.tpl rename to gn-tools-pipeline/templates/_helpers.tpl index 7faafa2..1cc6fd7 100644 --- a/tools-pipeline/templates/_helpers.tpl +++ b/gn-tools-pipeline/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "helm-datahub.name" -}} +{{- define "gn-tools-pipelines.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "helm-datahub.fullname" -}} +{{- define "gn-tools-pipelines.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "helm-datahub.chart" -}} +{{- define "gn-tools-pipelines.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "helm-datahub.labels" -}} -helm.sh/chart: {{ include "helm-datahub.chart" . }} -{{ include "helm-datahub.selectorLabels" . }} +{{- 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 }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "helm-datahub.selectorLabels" -}} -app.kubernetes.io/name: {{ include "helm-datahub.name" . }} +{{- 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 "helm-datahub.serviceAccountName" -}} +{{- define "gn-tools-pipelines.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "helm-datahub.fullname" .) .Values.serviceAccount.name }} +{{- default (include "gn-tools-pipelines.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- 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..bbda8c0 --- /dev/null +++ b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml @@ -0,0 +1,24 @@ +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: "{{ .Values.init.image }}" + command: ["sh", "-c", "echo 'init container'"] + containers: + - name: {{ include "gn-tools-pipelines.fullname" }} + image: "{{ .Values.image }}" + 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/tools-pipeline/values.yaml b/gn-tools-pipeline/values.yaml similarity index 85% rename from tools-pipeline/values.yaml rename to gn-tools-pipeline/values.yaml index 9b5648c..b7ffb17 100644 --- a/tools-pipeline/values.yaml +++ b/gn-tools-pipeline/values.yaml @@ -8,11 +8,12 @@ image: ingress: enabled: false -extra_environment: - - name: ES_HOST - value: "http://localhost:9200" - - name: RECORDS_INDEX - value: "geonetwork" +config: + elasticsearch: + host: "http://localhost:9200" + index: "gn-records" + +extraEnvs: [] podAnnotations: {} diff --git a/tools-pipeline/README.md b/tools-pipeline/README.md deleted file mode 100644 index 1e1a8e5..0000000 --- a/tools-pipeline/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Datahub - -UI of the web application `datahub`. - -`datahub` is an application to provide a default, pure and simple UI for metadata and dataset search. - -Inspire by Opendata catalogs (CKAN, Opendatasoft), the Hub will host geo and non-geo dataset. It will provide dataviz tool and focuses the experience on the dataset instead of on the metadata. - -## Source Code - -* https://github.com/geonetwork/geonetwork-ui/tree/main/apps/datahub - -## Requirements - -Kubernetes: `>=1.14.0-0` - -## Dependencies - -None - -## Installing the Chart - -To install the chart with the release name `datahub` - -```console -helm repo add geonetwork https://helm-charts.geonetwork-opensource.org -helm repo update -helm install datahub geonetwork/datahub -``` - -## Uninstalling the Chart - -To uninstall the `datahub` deployment - -```console -helm uninstall datahub -``` - -The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release. - -## Configuration - -Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. - -```console -helm install datahub \ - --set replicaCount="2" \ - geonetwork/datahub -``` - -Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. - -```console -helm install datahub geonetwork/datahub -f values.yaml -``` - -## Datahub configuration - -Through the parameter `configuration.git`, you can set a git repository that will be used for configuring datahub. - -Both `configuration.config_directory_override` and `configuration.assets_directory_override` are available to specify the directory where datahub should find the configuration. - -The default values are `/conf` for the configuration and `/assets` for the assets. - -Please refer to the docker documentation for more explanations about this custom configuration: https://github.com/geonetwork/geonetwork-ui/tree/main/apps/datahub#specifying-a-custom-configuration-file - -## Values - diff --git a/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl b/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl deleted file mode 100644 index 7b88776..0000000 --- a/tools-pipeline/templates/_bootstrap-datahub-configuration.tpl +++ /dev/null @@ -1,25 +0,0 @@ -{{- define "datahub.bootstrap_datahub_configuration" -}} -- name: bootstrap-datahub-configuration - image: bitnami/git - command: - - /bin/sh - - -c - - {{- if .Values.configuration.git.ssh_secret }} - mkdir -p /root/.ssh ; - cp /ssh-secret/ssh-privatekey /root/.ssh/id_rsa ; - chmod 0600 /root/.ssh/id_rsa ; - {{- end }} - git clone --depth 1 --single-branch {{ .Values.configuration.git.url }} -b {{ .Values.configuration.git.ref }} /etc/datahub ; - {{- if .Values.configuration.git.ssh_secret }} - env: - - name: GIT_SSH_COMMAND - value: ssh -o "IdentitiesOnly=yes" -o "StrictHostKeyChecking no" - {{- end }} - volumeMounts: - - mountPath: /etc/datahub - name: datahub-configuration - {{- if .Values.configuration.git.ssh_secret }} - - mountPath: /ssh-secret - name: ssh-secret - {{- end }} -{{- end -}} diff --git a/tools-pipeline/templates/datahub-deployment.yaml b/tools-pipeline/templates/datahub-deployment.yaml deleted file mode 100644 index 6cc39ef..0000000 --- a/tools-pipeline/templates/datahub-deployment.yaml +++ /dev/null @@ -1,87 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helm-datahub.fullname" . }}-datahub-deployment - labels: - {{- include "helm-datahub.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "helm-datahub.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "helm-datahub.selectorLabels" . | nindent 8 }} - org.geonetwork.service/name: {{ include "helm-datahub.fullname" . }}-datahub-deployment - spec: - {{- if .Values.configuration.git.url }} - initContainers: - {{- include "datahub.bootstrap_datahub_configuration" $ | nindent 6 }} - {{- end }} - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - {{- with .Values.lifecycle }} - lifecycle: - {{- toYaml . | nindent 12 }} - {{- end }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - env: - - name: CONFIG_DIRECTORY_OVERRIDE - value: "/etc/datahub/{{ .Values.configuration.override_directories.config_directory_override }}" - - name: ASSETS_DIRECTORY_OVERRIDE - value: "/etc/datahub/{{ .Values.configuration.override_directories.assets_directory_override }}" - {{- with .Values.extra_environment }} - {{- toYaml . | nindent 12 }} - {{- end }} - volumeMounts: - - name: datahub-configuration - mountPath: /etc/datahub - volumes: - - name: datahub-configuration - emptyDir: {} - {{- if .Values.configuration.git.ssh_secret }} - - name: ssh-secret - secret: - secretName: {{ .Values.configuration.git.ssh_secret }} - defaultMode: 0400 - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/tools-pipeline/templates/datahub-ingress.yaml b/tools-pipeline/templates/datahub-ingress.yaml deleted file mode 100644 index 92bfaa3..0000000 --- a/tools-pipeline/templates/datahub-ingress.yaml +++ /dev/null @@ -1,57 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "helm-datahub.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} - -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "helm-datahub.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Prefix - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }}-datahub-svc - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} \ No newline at end of file diff --git a/tools-pipeline/templates/datahub-svc.yaml b/tools-pipeline/templates/datahub-svc.yaml deleted file mode 100644 index 1f4f071..0000000 --- a/tools-pipeline/templates/datahub-svc.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helm-datahub.fullname" . }}-datahub-svc - labels: - {{- include "helm-datahub.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - org.geonetwork.service/name: {{ include "helm-datahub.fullname" . }}-datahub-deployment From 4b75137f3550c244ba5b30829dc75cc6634815c3 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Tue, 13 Feb 2024 17:33:26 +0100 Subject: [PATCH 3/5] feat: add curl init container --- gn-tools-pipeline/templates/gntoolspipelines-job.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gn-tools-pipeline/templates/gntoolspipelines-job.yaml b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml index bbda8c0..a89ec5e 100644 --- a/gn-tools-pipeline/templates/gntoolspipelines-job.yaml +++ b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml @@ -9,8 +9,8 @@ spec: spec: initContainers: - name: init - image: "{{ .Values.init.image }}" - command: ["sh", "-c", "echo 'init container'"] + image: curlimages/curl:latest + command: ['sh', '-c', 'while [ `curl -Lk --write-out "%{http_code}\n" --silent --output /dev/null "https://{{ .Values.config.elasticsearch.host }}/{{ .Values.config.elasticsearch.index }}"` -ne 200 ]; do sleep 2; done'] containers: - name: {{ include "gn-tools-pipelines.fullname" }} image: "{{ .Values.image }}" From bdcb171897320a6a5f25c4cc7092e8e6141b697f Mon Sep 17 00:00:00 2001 From: f-necas <39771412+f-necas@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:46:15 +0100 Subject: [PATCH 4/5] Update values.yaml --- gn-tools-pipeline/values.yaml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/gn-tools-pipeline/values.yaml b/gn-tools-pipeline/values.yaml index b7ffb17..de29309 100644 --- a/gn-tools-pipeline/values.yaml +++ b/gn-tools-pipeline/values.yaml @@ -13,28 +13,6 @@ config: host: "http://localhost:9200" index: "gn-records" -extraEnvs: [] - -podAnnotations: {} - -podSecurityContext: {} - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -#lifecycle: -# postStart: -# exec: -# command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] -# preStop: -# exec: -# command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"] - resources: limits: cpu: 100m @@ -43,9 +21,3 @@ resources: cpu: 100m memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} \ No newline at end of file From 1a96a441a5dd866da4b858ccb79b89ed68d9ec48 Mon Sep 17 00:00:00 2001 From: fnecas Date: Wed, 14 Feb 2024 15:18:35 +0100 Subject: [PATCH 5/5] fix: values --- .../templates/gntoolspipelines-job.yaml | 5 +++-- gn-tools-pipeline/values.yaml | 12 ------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/gn-tools-pipeline/templates/gntoolspipelines-job.yaml b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml index a89ec5e..2d8c6d1 100644 --- a/gn-tools-pipeline/templates/gntoolspipelines-job.yaml +++ b/gn-tools-pipeline/templates/gntoolspipelines-job.yaml @@ -10,10 +10,11 @@ spec: initContainers: - name: init image: curlimages/curl:latest - command: ['sh', '-c', 'while [ `curl -Lk --write-out "%{http_code}\n" --silent --output /dev/null "https://{{ .Values.config.elasticsearch.host }}/{{ .Values.config.elasticsearch.index }}"` -ne 200 ]; do sleep 2; done'] + 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 }}" + 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." }} diff --git a/gn-tools-pipeline/values.yaml b/gn-tools-pipeline/values.yaml index de29309..5629e74 100644 --- a/gn-tools-pipeline/values.yaml +++ b/gn-tools-pipeline/values.yaml @@ -5,19 +5,7 @@ image: tag: latest pullPolicy: Always -ingress: - enabled: false - config: elasticsearch: host: "http://localhost:9200" index: "gn-records" - -resources: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi -