Skip to content

Commit 34b08fd

Browse files
authored
feat: implement metadata-editor in gn helm (#6)
* feat: implement metadata-editor in gn helm * feat: update versions and filename
1 parent 9c47e74 commit 34b08fd

10 files changed

+444
-1
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
## Datahub
44

5-
Readme: https://github.com/geonetwork/geonetwork-helm-charts/tree/main/datahub
5+
Readme: https://github.com/geonetwork/geonetwork-helm-charts/tree/main/datahub
6+
7+
## Metadata-editor
8+
9+
Readme: https://github.com/geonetwork/geonetwork-helm-charts/tree/main/metadata-editor

metadata-editor/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

metadata-editor/Chart.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
name: metadata-editor
3+
description: A Helm chart to deploy the metadata-editor application
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.0.0"
7+
maintainers:
8+
- name: geOrchestra
9+
url: https://www.georchestra.org

metadata-editor/README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Metadata-editor
2+
3+
UI of the web application `metadata-editor`.
4+
5+
`metadata-editor` is an UI application containing a dashboard for seeing metadata records, and a powerful form-based editor.
6+
7+
8+
## Source Code
9+
10+
* https://github.com/geonetwork/geonetwork-ui/tree/main/apps/metadata-editor
11+
12+
## Requirements
13+
14+
Kubernetes: `>=1.14.0-0`
15+
16+
## Dependencies
17+
18+
None
19+
20+
## Installing the Chart
21+
22+
To install the chart with the release name `metadata-editor`
23+
24+
```console
25+
helm repo add geonetwork https://helm-charts.geonetwork-opensource.org
26+
helm repo update
27+
helm install metadata-editor geonetwork/metadata-editor
28+
```
29+
30+
## Uninstalling the Chart
31+
32+
To uninstall the `metadata-editor` deployment
33+
34+
```console
35+
helm uninstall metadata-editor
36+
```
37+
38+
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
39+
40+
## Configuration
41+
42+
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
43+
44+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
45+
46+
```console
47+
helm install metadata-editor \
48+
--set replicaCount="2" \
49+
geonetwork/metadata-editor
50+
```
51+
52+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
53+
54+
```console
55+
helm install metadata-editor geonetwork/metadata-editor -f values.yaml
56+
```
57+
58+
## Metadata-editor configuration
59+
60+
Through the parameter `configuration.git`, you can set a git repository that will be used for configuring metadata-editor.
61+
62+
Both `configuration.config_directory_override` and `configuration.assets_directory_override` are available to specify the directory where metadata-editor should find the configuration.
63+
64+
The default values are `/conf` for the configuration and `/assets` for the assets.
65+
66+
Please refer to the docker documentation for more explanations about this custom configuration: https://github.com/geonetwork/geonetwork-ui/tree/main/apps/metadata-editor#specifying-a-custom-configuration-file
67+
68+
## Values
69+
70+
**Important**: Some values here are not documented because those are obvious parameters that you can find the meaning and the usuability through the Kubernetes configuration: https://kubernetes.io/docs/home/
71+
72+
| Key | Type | Default | Description |
73+
|-----|------|---------|-------------|
74+
| image | object | See values.yaml | Set the docker image to use. |
75+
| configuration | object | See values.yaml | [See above](#metadata-editor-configuration) |
76+
| ingress | object | See values.yaml | Configurations for configuring ingress |
77+
78+
## Changelog
79+
80+
### Version 0.1.0
81+
82+
Initial version
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- define "metadata-editor.bootstrap_metadata-editor_configuration" -}}
2+
- name: bootstrap-metadata-editor-configuration
3+
image: bitnami/git
4+
command:
5+
- /bin/sh
6+
- -c
7+
- {{- if .Values.configuration.git.ssh_secret }}
8+
mkdir -p /root/.ssh ;
9+
cp /ssh-secret/ssh-privatekey /root/.ssh/id_rsa ;
10+
chmod 0600 /root/.ssh/id_rsa ;
11+
{{- end }}
12+
git clone --depth 1 --single-branch {{ .Values.configuration.git.url }} -b {{ .Values.configuration.git.ref }} /etc/metadata-editor ;
13+
{{- if .Values.configuration.git.ssh_secret }}
14+
env:
15+
- name: GIT_SSH_COMMAND
16+
value: ssh -o "IdentitiesOnly=yes" -o "StrictHostKeyChecking no"
17+
{{- end }}
18+
volumeMounts:
19+
- mountPath: /etc/metadata-editor
20+
name: metadata-editor-configuration
21+
{{- if .Values.configuration.git.ssh_secret }}
22+
- mountPath: /ssh-secret
23+
name: ssh-secret
24+
{{- end }}
25+
{{- end -}}
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "helm-metadata-editor.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "helm-metadata-editor.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "helm-metadata-editor.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "helm-metadata-editor.labels" -}}
37+
helm.sh/chart: {{ include "helm-metadata-editor.chart" . }}
38+
{{ include "helm-metadata-editor.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "helm-metadata-editor.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "helm-metadata-editor.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "helm-metadata-editor.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "helm-metadata-editor.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "helm-metadata-editor.fullname" . }}-metadata-editor-deployment
5+
labels:
6+
{{- include "helm-metadata-editor.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "helm-metadata-editor.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "helm-metadata-editor.selectorLabels" . | nindent 8 }}
20+
org.geonetwork.service/name: {{ include "helm-metadata-editor.fullname" . }}-metadata-editor-deployment
21+
spec:
22+
{{- if .Values.configuration.git.url }}
23+
initContainers:
24+
{{- include "metadata-editor.bootstrap_metadata-editor_configuration" $ | nindent 6 }}
25+
{{- end }}
26+
{{- with .Values.imagePullSecrets }}
27+
imagePullSecrets:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
securityContext:
31+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
32+
containers:
33+
- name: {{ .Chart.Name }}
34+
securityContext:
35+
{{- toYaml .Values.securityContext | nindent 12 }}
36+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
37+
imagePullPolicy: {{ .Values.image.pullPolicy }}
38+
ports:
39+
- name: http
40+
containerPort: 80
41+
protocol: TCP
42+
livenessProbe:
43+
httpGet:
44+
path: /
45+
port: http
46+
readinessProbe:
47+
httpGet:
48+
path: /
49+
port: http
50+
{{- with .Values.lifecycle }}
51+
lifecycle:
52+
{{- toYaml . | nindent 12 }}
53+
{{- end }}
54+
resources:
55+
{{- toYaml .Values.resources | nindent 12 }}
56+
env:
57+
- name: CONFIG_DIRECTORY_OVERRIDE
58+
value: "/etc/metadata-editor/{{ .Values.configuration.override_directories.config_directory_override }}"
59+
- name: ASSETS_DIRECTORY_OVERRIDE
60+
value: "/etc/metadata-editor/{{ .Values.configuration.override_directories.assets_directory_override }}"
61+
{{- with .Values.extra_environment }}
62+
{{- toYaml . | nindent 12 }}
63+
{{- end }}
64+
volumeMounts:
65+
- name: metadata-editor-configuration
66+
mountPath: /etc/metadata-editor
67+
volumes:
68+
- name: metadata-editor-configuration
69+
emptyDir: {}
70+
{{- if .Values.configuration.git.ssh_secret }}
71+
- name: ssh-secret
72+
secret:
73+
secretName: {{ .Values.configuration.git.ssh_secret }}
74+
defaultMode: 0400
75+
{{- end }}
76+
{{- with .Values.nodeSelector }}
77+
nodeSelector:
78+
{{- toYaml . | nindent 8 }}
79+
{{- end }}
80+
{{- with .Values.affinity }}
81+
affinity:
82+
{{- toYaml . | nindent 8 }}
83+
{{- end }}
84+
{{- with .Values.tolerations }}
85+
tolerations:
86+
{{- toYaml . | nindent 8 }}
87+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "helm-metadata-editor.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
5+
apiVersion: networking.k8s.io/v1
6+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
7+
apiVersion: networking.k8s.io/v1beta1
8+
{{- else -}}
9+
apiVersion: extensions/v1beta1
10+
{{- end }}
11+
12+
kind: Ingress
13+
metadata:
14+
name: {{ $fullName }}
15+
labels:
16+
{{- include "helm-metadata-editor.labels" . | nindent 4 }}
17+
{{- with .Values.ingress.annotations }}
18+
annotations:
19+
{{- toYaml . | nindent 4 }}
20+
{{- end }}
21+
spec:
22+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
23+
ingressClassName: {{ .Values.ingress.className }}
24+
{{- end }}
25+
{{- if .Values.ingress.tls }}
26+
tls:
27+
{{- range .Values.ingress.tls }}
28+
- hosts:
29+
{{- range .hosts }}
30+
- {{ . | quote }}
31+
{{- end }}
32+
secretName: {{ .secretName }}
33+
{{- end }}
34+
{{- end }}
35+
rules:
36+
{{- range .Values.ingress.hosts }}
37+
- host: {{ .host | quote }}
38+
http:
39+
paths:
40+
{{- range .paths }}
41+
- path: {{ . }}
42+
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
43+
pathType: Prefix
44+
{{- end }}
45+
backend:
46+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
47+
service:
48+
name: {{ $fullName }}-metadata-editor-svc
49+
port:
50+
number: {{ $svcPort }}
51+
{{- else }}
52+
serviceName: {{ $fullName }}
53+
servicePort: {{ $svcPort }}
54+
{{- end }}
55+
{{- end }}
56+
{{- end }}
57+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "helm-metadata-editor.fullname" . }}-metadata-editor-svc
5+
labels:
6+
{{- include "helm-metadata-editor.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
org.geonetwork.service/name: {{ include "helm-metadata-editor.fullname" . }}-metadata-editor-deployment

0 commit comments

Comments
 (0)