Skip to content

Commit ac54153

Browse files
Merge pull request #37 from element-hq/guillaumev/bookstack
Add first bookstack chart
2 parents 02f6c20 + d5d1af2 commit ac54153

11 files changed

+678
-0
lines changed

charts/bookstack/.helmignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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/
24+
tests/

charts/bookstack/Chart.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v2
2+
name: bookstack
3+
description: A Helm chart for running bookstack on Kubernetes
4+
type: application
5+
maintainers:
6+
- name: Element SRE Team
7+
8+
# This version number should be incremented each time you make changes
9+
# to the chart and its templates, including the app version.
10+
version: "0.1.0"
11+
12+
# Track the appVersion based on the image:
13+
# renovate: image=ghcr.io/linuxserver/bookstack
14+
appVersion: "version-v23.02.1"
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "bookstack.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 "bookstack.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 "bookstack.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "bookstack.labels" -}}
37+
helm.sh/chart: {{ include "bookstack.chart" . }}
38+
{{ include "bookstack.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 "bookstack.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "bookstack.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 "bookstack.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "bookstack.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
+216
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "bookstack.fullname" . }}
5+
labels:
6+
{{- include "bookstack.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
{{- if .Values.revisionHistoryLimit }}
10+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
11+
{{- end }}
12+
selector:
13+
matchLabels:
14+
{{- include "bookstack.selectorLabels" . | nindent 6 }}
15+
{{- with .Values.strategy }}
16+
strategy:
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
template:
20+
metadata:
21+
annotations:
22+
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
23+
{{- with .Values.podAnnotations }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
labels:
27+
{{- include "bookstack.selectorLabels" . | nindent 8 }}
28+
spec:
29+
{{- with .Values.imagePullSecrets }}
30+
imagePullSecrets:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
serviceAccountName: {{ include "bookstack.serviceAccountName" . }}
34+
{{- with .Values.podSecurityContext }}
35+
securityContext:
36+
{{- toYaml . | nindent 8 }}
37+
{{- end }}
38+
containers:
39+
- name: {{ .Chart.Name }}
40+
{{- with .Values.securityContext }}
41+
securityContext:
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
44+
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
45+
imagePullPolicy: {{ .Values.image.pullPolicy }}
46+
ports:
47+
- name: http
48+
containerPort: 80
49+
protocol: TCP
50+
envFrom:
51+
- secretRef:
52+
name: {{ include "bookstack.fullname" . }}
53+
env:
54+
{{- if .Values.settings.url }}
55+
- name: APP_URL
56+
value: {{ .Values.settings.url | quote }}
57+
{{- end }}
58+
{{- if .Values.settings.debug }}
59+
- name: APP_DEBUG
60+
value: {{ .Values.settings.debug | quote }}
61+
{{- end }}
62+
{{- if .Values.settings.sessionLifetime }}
63+
- name: SESSION_LIFETIME
64+
value: {{ .Values.settings.sessionLifetime | quote }}
65+
{{- end }}
66+
{{- if .Values.settings.tz }}
67+
- name: TZ
68+
value: {{ .Values.settings.tz | quote }}
69+
{{- end }}
70+
{{- if .Values.settings.authSaml2.enabled }}
71+
- name: AUTH_METHOD
72+
value: "saml2"
73+
{{- with .Values.settings.authSaml2 }}
74+
- name: SAML2_AUTOLOAD_METADATA
75+
value: {{ .autoloadMetadata | quote }}
76+
- name: SAML2_DISPLAY_NAME_ATTRIBUTES
77+
value: {{ .displayNameAttribute | quote }}
78+
- name: SAML2_EMAIL_ATTRIBUTE
79+
value: {{ .emailAttribute | quote }}
80+
- name: SAML2_EXTERNAL_ID_ATTRIBUTE
81+
value: {{ .externalIdAttribute | quote }}
82+
- name: SAML2_GROUP_ATTRIBUTE
83+
value: {{ .groupAttribute | quote }}
84+
- name: SAML2_IDP_AUTHNCONTEXT
85+
value: {{ .idpAuthnContent | quote }}
86+
- name: SAML2_IDP_ENTITYID
87+
value: {{ .idpEntityId | quote }}
88+
- name: SAML2_NAME
89+
value: {{ .name | quote }}
90+
- name: SAML2_REMOVE_FROM_GROUPS
91+
value: {{ .removeFromGroups | quote }}
92+
- name: SAML2_USER_TO_GROUPS
93+
value: {{ .userToGroups | quote }}
94+
{{- end }}
95+
{{- end }}
96+
{{- if .Values.settings.mail.enabled }}
97+
{{- with .Values.settings.mail }}
98+
- name: MAIL_DRIVER
99+
value: {{ .transport | quote }}
100+
- name: MAIL_ENCRYPTION
101+
value: {{ .encryption | quote }}
102+
- name: MAIL_FROM
103+
value: {{ .from | quote }}
104+
- name: MAIL_FROM_NAME
105+
value: {{ .displayName | quote }}
106+
- name: MAIL_HOST
107+
value: {{ .host | quote }}
108+
- name: MAIL_PORT
109+
value: {{ .port | quote }}
110+
{{- end }}
111+
{{- end }}
112+
{{- with .Values.env }}
113+
{{- toYaml . | nindent 12 }}
114+
{{- end }}
115+
116+
{{- if .Values.customStartupProbe }}
117+
startupProbe:
118+
{{- toYaml .Values.customStartupProbe | nindent 12 }}
119+
{{- else }}
120+
{{- if .Values.startupProbe.enabled }}
121+
startupProbe:
122+
httpGet:
123+
path: /
124+
port: http
125+
httpHeaders:
126+
- name: Host
127+
value: localhost:2368
128+
{{- with .Values.startupProbe }}
129+
initialDelaySeconds: {{ .initialDelaySeconds }}
130+
timeoutSeconds: {{ .timeoutSeconds }}
131+
failureThreshold: {{ .failureThreshold }}
132+
successThreshold: {{ .successThreshold }}
133+
periodSeconds: {{ .periodSeconds }}
134+
{{- end }}
135+
{{- end }}
136+
{{- end }}
137+
{{- if .Values.customLivenessProbe }}
138+
livenessProbe:
139+
{{- toYaml .Values.customLivenessProbe | nindent 12 }}
140+
{{- else }}
141+
{{- if .Values.livenessProbe.enabled }}
142+
livenessProbe:
143+
httpGet:
144+
path: /
145+
port: http
146+
httpHeaders:
147+
- name: Host
148+
value: localhost:2368
149+
{{- with .Values.livenessProbe }}
150+
initialDelaySeconds: {{ .initialDelaySeconds }}
151+
timeoutSeconds: {{ .timeoutSeconds }}
152+
failureThreshold: {{ .failureThreshold }}
153+
successThreshold: {{ .successThreshold }}
154+
periodSeconds: {{ .periodSeconds }}
155+
{{- end }}
156+
{{- end }}
157+
{{- end }}
158+
{{- if .Values.customReadinessProbe }}
159+
readinessProbe:
160+
{{- toYaml .Values.customReadinessProbe | nindent 12 }}
161+
{{- else }}
162+
{{- if .Values.readinessProbe.enabled }}
163+
readinessProbe:
164+
httpGet:
165+
path: /
166+
port: http
167+
httpHeaders:
168+
- name: Host
169+
value: localhost:2368
170+
{{- with .Values.readinessProbe }}
171+
initialDelaySeconds: {{ .initialDelaySeconds }}
172+
timeoutSeconds: {{ .timeoutSeconds }}
173+
failureThreshold: {{ .failureThreshold }}
174+
successThreshold: {{ .successThreshold }}
175+
periodSeconds: {{ .periodSeconds }}
176+
{{- end }}
177+
{{- end }}
178+
{{- end }}
179+
{{- with .Values.resources }}
180+
resources:
181+
{{- toYaml . | nindent 12 }}
182+
{{- end }}
183+
{{- if .Values.args }}
184+
args:
185+
{{- range .Values.args }}
186+
- {{ . }}
187+
{{- end }}
188+
{{- end }}
189+
volumeMounts:
190+
- mountPath: /config
191+
name: bookstack-vol
192+
{{- with .Values.nodeSelector }}
193+
nodeSelector:
194+
{{- toYaml . | nindent 8 }}
195+
{{- end }}
196+
{{- with .Values.affinity }}
197+
affinity:
198+
{{- toYaml . | nindent 8 }}
199+
{{- end }}
200+
{{- with .Values.tolerations }}
201+
tolerations:
202+
{{- toYaml . | nindent 8 }}
203+
{{- end }}
204+
volumes:
205+
- name: bookstack-vol
206+
{{- if .Values.storage.persistentVolumeClaimName }}
207+
persistentVolumeClaim:
208+
claimName: {{ .Values.storage.persistentVolumeClaimName }}
209+
{{- else }}
210+
{{- if .Values.storage.requestedSize }}
211+
persistentVolumeClaim:
212+
claimName: {{ include "bookstack.fullname" . }}
213+
{{- else }}
214+
emptyDir: {}
215+
{{- end }}
216+
{{- end }}
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "bookstack.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
apiVersion: networking.k8s.io/v1
10+
kind: Ingress
11+
metadata:
12+
name: {{ $fullName }}
13+
labels:
14+
{{- include "bookstack.labels" . | nindent 4 }}
15+
{{- with .Values.ingress.annotations }}
16+
annotations:
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
spec:
20+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
21+
ingressClassName: {{ .Values.ingress.className }}
22+
{{- end }}
23+
{{- if .Values.ingress.tls }}
24+
tls:
25+
{{- range .Values.ingress.tls }}
26+
- hosts:
27+
{{- range .hosts }}
28+
- {{ . | quote }}
29+
{{- end }}
30+
secretName: {{ .secretName }}
31+
{{- end }}
32+
{{- end }}
33+
rules:
34+
{{- range .Values.ingress.hosts }}
35+
- host: {{ .host | quote }}
36+
http:
37+
paths:
38+
{{- range .paths }}
39+
- path: {{ .path }}
40+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
41+
pathType: {{ .pathType }}
42+
{{- end }}
43+
backend:
44+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
45+
service:
46+
name: {{ $fullName }}
47+
port:
48+
number: {{ $svcPort }}
49+
{{- else }}
50+
serviceName: {{ $fullName }}
51+
servicePort: {{ $svcPort }}
52+
{{- end }}
53+
{{- end }}
54+
{{- end }}
55+
{{- end }}

0 commit comments

Comments
 (0)