Skip to content

Commit 8ac548b

Browse files
committed
chore: added umap helm chart
This helm chart allow to deploy umap on a Kubernetes cluster easily.
1 parent 8f08ee3 commit 8ac548b

12 files changed

+440
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ test-results/
2525

2626
### Transifex ###
2727
tx
28+
29+
# Helm
30+
charts/*/charts
31+
helmfile.yaml
32+
charts/*/Chart.lock

charts/umap/.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/

charts/umap/Chart.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
name: umap
3+
description: A Helm chart to deploy umap on Kubernetes
4+
5+
type: application
6+
7+
version: 0.1.0
8+
9+
appVersion: "2.7.2"
10+
11+
dependencies:
12+
- name: cnpg-cluster
13+
version: 2.0.1
14+
repository: https://charts.enix.io/
15+
alias: cnpg
16+
condition: cnpg.enabled

charts/umap/templates/_helpers.tpl

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "umap.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 "umap.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 "umap.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "umap.labels" -}}
37+
helm.sh/chart: {{ include "umap.chart" . }}
38+
{{ include "umap.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 "umap.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "umap.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 "umap.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "umap.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{/*
65+
Get the name of the persistent volume claim
66+
*/}}
67+
{{- define "umap.pvcName" -}}
68+
{{- if .Values.persistence.existingClaim -}}
69+
{{- printf "%s" (tpl .Values.persistence.existingClaim $) -}}
70+
{{- else -}}
71+
{{- printf "%s" (include "umap.fullname" .) -}}
72+
{{- end -}}
73+
{{- end -}}

charts/umap/templates/deployment.yaml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "umap.fullname" . }}
5+
labels:
6+
{{- include "umap.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "umap.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
annotations:
15+
checksum/config: {{ include (print $.Template.BasePath "/secret-config.yaml") . | sha256sum }}
16+
checksum/env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }}
17+
{{- with .Values.podAnnotations }}
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "umap.labels" . | nindent 8 }}
22+
{{- with .Values.podLabels }}
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
spec:
26+
{{- with .Values.imagePullSecrets }}
27+
imagePullSecrets:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
serviceAccountName: {{ include "umap.serviceAccountName" . }}
31+
securityContext:
32+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
containers:
34+
- name: {{ .Chart.Name }}
35+
securityContext:
36+
{{- toYaml .Values.securityContext | nindent 12 }}
37+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
38+
imagePullPolicy: {{ .Values.image.pullPolicy }}
39+
ports:
40+
- name: http
41+
containerPort: {{ .Values.service.port }}
42+
protocol: TCP
43+
startupProbe:
44+
httpGet:
45+
path: /stats
46+
port: http
47+
livenessProbe:
48+
httpGet:
49+
path: /stats
50+
port: http
51+
readinessProbe:
52+
httpGet:
53+
path: /stats
54+
port: http
55+
resources:
56+
{{- toYaml .Values.resources | nindent 12 }}
57+
{{- if .Values.cnpg.enabled }}
58+
env:
59+
- name: DATABASE_URL
60+
valueFrom:
61+
secretKeyRef:
62+
name: {{ .Release.Name }}-cnpg-app
63+
key: uri
64+
- name: UMAP_SETTINGS
65+
value: /etc/umap/umap.conf
66+
{{- end }}
67+
envFrom:
68+
- secretRef:
69+
name: {{ .Release.Name }}-env
70+
volumeMounts:
71+
- name: config
72+
mountPath: /etc/umap/
73+
readOnly: true
74+
- name: statics
75+
mountPath: /srv/umap/static
76+
{{- if .Values.persistence.enabled }}
77+
- name: data
78+
mountPath: /srv/umap/uploads/
79+
{{- end }}
80+
volumes:
81+
- name: config
82+
secret:
83+
secretName: {{ .Release.Name }}-config
84+
- name: statics
85+
emptyDir: {}
86+
{{- if .Values.persistence.enabled }}
87+
- name: data
88+
persistentVolumeClaim:
89+
claimName: {{ include "umap.pvcName" . }}
90+
{{- end }}
91+
{{- with .Values.nodeSelector }}
92+
nodeSelector:
93+
{{- toYaml . | nindent 8 }}
94+
{{- end }}
95+
{{- with .Values.affinity }}
96+
affinity:
97+
{{- toYaml . | nindent 8 }}
98+
{{- end }}
99+
{{- with .Values.tolerations }}
100+
tolerations:
101+
{{- toYaml . | nindent 8 }}
102+
{{- end }}

charts/umap/templates/ingress.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "umap.fullname" . }}
6+
{{- with .Values.ingress.annotations }}
7+
annotations:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
spec:
11+
ingressClassName: {{ .Values.ingress.className }}
12+
tls:
13+
- hosts:
14+
{{- range .Values.ingress.hosts }}
15+
- {{ . | quote }}
16+
{{- end }}
17+
secretName: {{ include "umap.fullname" . }}-tls
18+
rules:
19+
{{- range .Values.ingress.hosts }}
20+
- host: {{ . | quote }}
21+
http:
22+
paths:
23+
- path: /
24+
pathType: Prefix
25+
backend:
26+
service:
27+
name: {{ include "umap.fullname" $ }}
28+
port:
29+
number: {{ $.Values.service.port }}
30+
{{- end }}
31+
{{- end }}

charts/umap/templates/pvc.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- if and (.Values.persistence.enabled) (not .Values.persistence.existingClaim) }}
2+
kind: PersistentVolumeClaim
3+
apiVersion: v1
4+
metadata:
5+
{{- if .Values.persistence.annotations }}
6+
annotations:
7+
{{- toYaml .Values.persistence.annotations | nindent 4 }}
8+
{{- end }}
9+
name: {{ include "umap.pvcName" . }}
10+
labels:
11+
{{- include "umap.labels" . | nindent 4 }}
12+
spec:
13+
accessModes:
14+
{{- range .Values.persistence.accessModes }}
15+
- {{ . | quote }}
16+
{{- end }}
17+
{{- with .Values.persistence.resources }}
18+
resources:
19+
{{- toYaml . | nindent 4 }}
20+
{{- end }}
21+
{{- if .Values.persistence.storageClassName }}
22+
storageClassName: {{ .Values.persistence.storageClassName | quote }}
23+
{{- end }}
24+
{{- end }}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "umap.fullname" . }}-config
5+
labels:
6+
{{- include "umap.labels" . | nindent 4 }}
7+
type: Opaque
8+
data:
9+
umap.conf: {{ .Values.umap.config | b64enc }}

charts/umap/templates/secret-env.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "umap.fullname" . }}-env
5+
labels:
6+
{{- include "umap.labels" . | nindent 4 }}
7+
type: Opaque
8+
data:
9+
{{- range $key, $value := .Values.umap.environment }}
10+
{{ $key }}: "{{ $value | b64enc }}"
11+
{{- end }}

charts/umap/templates/service.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "umap.fullname" . }}
5+
labels:
6+
{{- include "umap.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+
{{- include "umap.selectorLabels" . | nindent 4 }}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "umap.serviceAccountName" . }}
6+
labels:
7+
{{- include "umap.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
13+
{{- end }}

0 commit comments

Comments
 (0)