Skip to content

Commit

Permalink
initial support for metfragrest
Browse files Browse the repository at this point in the history
  • Loading branch information
sneumann committed May 23, 2023
1 parent f969cc5 commit 15d4853
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/metfrag/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: metfrag
description: A Helm chart for the MetFrag application
type: application
version: 0.1.17
version: 0.1.18
appVersion: "latest"
icon: https://msbi.ipb-halle.de/MetFragLogo232x128.png

Expand Down
33 changes: 33 additions & 0 deletions charts/metfrag/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- end -}}

{{- define "metfragrest.fullname" -}}
{{- if .Values.fullnameRESTOverride -}}
{{- .Values.fullnameRESTOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameRESTOverride -}}
{{- 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.
*/}}
Expand All @@ -43,6 +56,18 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "metfragrest.labels" -}}
helm.sh/chart: {{ include "metfrag.chart" . }}
{{ include "metfragrest.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
Expand All @@ -51,6 +76,14 @@ app.kubernetes.io/name: {{ include "metfrag.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "metfragrest.selectorLabels" -}}
app.kubernetes.io/name: {{ .Values.RESTname }}
app.kubernetes.io/instance: {{ .Values.RESTname }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
Expand Down
85 changes: 85 additions & 0 deletions charts/metfrag/templates/deploymentREST.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.RESTname }}
labels:
{{- include "metfragrest.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaRESTCount }}
selector:
matchLabels:
{{- include "metfragrest.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "metfragrest.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "metfrag.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: postgres-listener
image: alpine
command:
- sh
- -c
- for i in $(seq 1 200); do nc -z -w3 metfrag-postgresql 5432 && exit 0 || sleep $((2*i)); echo -n "." ; done; exit 1
containers:
- name: {{ .Values.RESTname }}
volumeMounts:
- name: metfrag-settings
mountPath: /resources/
{{- if .Values.storage }}
- name: spectral-databases
mountPath: /vol/spectral-databases
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.imageREST.repository }}:{{ .Values.imageREST.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.imageREST.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
# livenessProbe:
# httpGet:
# path: {{ trimSuffix "/" .Values.RESTpath }}/javax.faces.resource/images/MetLogoCube_Green.png.xhtml
# port: 8080
# readinessProbe:
# httpGet:
# path: {{ trimSuffix "/" .Values.RESTpath }}/javax.faces.resource/images/MetLogoCube_Green.png.xhtml
# port: 8080
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: RESTPREFIX
value: {{ .Values.webRESTpath }}
- name: JAVA_OPTS
value: -Xmx4g -Xms4g
volumes:
- name: metfrag-settings
configMap:
name: metfrag-settings
items:
- key: settings.properties
path: settings.properties
{{- if .Values.storage }}
{{- toYaml .Values.storage.volumes | nindent 8 }}
{{- 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 }}
File renamed without changes.
8 changes: 8 additions & 0 deletions charts/metfrag/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ spec:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
- path: {{ .Values.RESTpath }}
pathType: Prefix
backend:
service:
name: {{ .Values.RESTname }}
port:
number: {{ $svcPort }}

{{- end }}
15 changes: 15 additions & 0 deletions charts/metfrag/templates/serviceREST.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.RESTname }}
labels:
{{- include "metfragrest.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 8080
protocol: TCP
name: http
selector:
{{- include "metfragrest.selectorLabels" . | nindent 4 }}
11 changes: 11 additions & 0 deletions charts/metfrag/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ FeedbackEmailTo: [email protected]
FeedbackEmailHost: mail.example.com

webpath: /
RESTpath: /metfragrest
NumberThreads: 2

RESTname: metfragrest

replicaCount: 1
replicaRESTCount: 1

image:
repository: ipbhalle/metfragweb
pullPolicy: Always

imageREST:
repository: ipbhalle/metfragrest
pullPolicy: Always

#storage:
# volumes:
# - name: spectral-databases
Expand All @@ -35,6 +43,9 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

nameRESTOverride: ""
fullnameRESTOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down

0 comments on commit 15d4853

Please sign in to comment.