add initial helm chart values

This commit is contained in:
Justin Kreller
2024-11-15 16:56:01 +01:00
parent 75a5b2879e
commit 74dcdd16d4
9 changed files with 797 additions and 92 deletions

View File

@@ -0,0 +1,33 @@
{{ if .Values.pv.enabled }}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.pv.koha.name }}
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
nfs:
path: {{ .Values.pv.koha.path }}
server: {{ .Values.pv.koha.server }}
{{ if not .Values.db.external }}
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.pv.mysql.name }}
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
nfs:
path: {{ .Values.pv.mysql.path }}
server: {{ .Values.pv.mysql.server }}
{{ end }}
{{ end }}

49
templates/configMap.yml Normal file
View File

@@ -0,0 +1,49 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: koha-map
namespace: koha-{{ .Values.instance }}
labels:
app: koha
data:
KOHA_INSTANCE: {{ required "You must provide an instance name, either using --set instance=myinstance or in a custom values.yaml" .Values.instance | quote }}
KOHA_DOMAIN: {{ .Values.global.domain | quote }}
KOHA_INTRANET_PORT: {{ .Values.staff.port | quote }}
{{ with .Values.staff.prefix }}
KOHA_INTRANET_PREFIX: {{ . | quote }}
{{ end }}
{{ with .Values.staff.suffix }}
KOHA_INTRANET_SUFFIX: {{ . | quote }}
{{ end }}
KOHA_MARC_FLAVOUR: {{ .Values.global.marc_flavour }}
KOHA_OPAC_PORT: {{ .Values.opac.port | quote }}
{{ with .Values.opac.prefix }}
KOHA_OPAC_PREFIX: {{ . | quote }}
{{ end }}
{{ with .Values.opac.suffix }}
KOHA_OPAC_SUFFIX: {{ . | quote }}
{{ end }}
{{ with .Values.global.lang }}
KOHA_LANGS: {{ range $index, $lang := . }}
{{ if $index }} {{ end }}
{{ $lang }}
{{ end }}
{{ end }}
KOHA_PASS: {{ .Values.global.pass }}
KOHA_USER: {{ .Values.global.user }}
MANA_URL: {{ .Values.global.mana }}
MYSQL_SERVER: {{ with .Values.db.server }} {{ . | quote }} {{ else }} "{{ .Values.instance }}-db" {{ end }}
MYSQL_ROOT_USER: {{ .Values.db.root_user }}
MYSQL_DATABASE: {{ with .Values.db.database }} {{ . | quote }} {{ else }} "koha_{{ .Values.instance }}" {{ end }}
MYSQL_ROOT_PASSWORD: {{ .Values.db.root_pass }}
MYSQL_USER: {{ with .Values.db.user }} {{ . | quote }} {{ else }} "koha_{{ .Values.instance }}" {{ end }}
MYSQL_PASSWORD: {{ .Values.db.pass }}
ZEBRA_MARC_FORMAT: {{ .Values.zebra.marc_format }}
{{ if .Values.elasticsearch.enabled }}
OVERRIDE_SYSPREF_SearchEngine: "Elasticsearch"
KOHA_ES_NAME: {{ with .Values.elasticsearch.server }} {{ . | quote }} {{ else }} "{{ .Values.instance }}-es" {{ end }}
{{ end }}
{{ if .Values.memcached.enabled }}
MEMCACHED_SERVERS: {{ with .Values.memcached.server }} {{ . | quote }} {{ else }} "{{ .Values.instance }}-memcached:11211" {{ end }}
{{ end }}
KOHA_PLACK_NAME: "{{ .Values.instance }}-plack"

355
templates/deploy.yml Normal file
View File

@@ -0,0 +1,355 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: plack
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: plack
template:
metadata:
labels:
app: koha
component: plack
spec:
containers:
- name: koha
image: {{ .Values.docker.registry }}:{{ .Values.docker.tag }}
env:
- name: USE_PLACK
value: "1"
envFrom:
- configMapRef:
name: koha-map
optional: false
volumeMounts:
- name: koha-pv
mountPath: /var/lib/koha
subPath: koha
- name: koha-pv
mountPath: /etc/koha/sites
subPath: sites
- name: koha-pv
mountPath: /tmp/libshare
subPath: lib
volumes:
- name: koha-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-pvc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-apache
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: apache
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: apache
template:
metadata:
labels:
app: koha
component: apache
spec:
initContainers:
- name: init-wait
image: alpine
command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ .Values.instance }}-plack 5000 && exit 0 || sleep 3; done; exit 1"]
containers:
- name: apache
image: {{ .Values.docker.registry }}:{{ .Values.docker.tag }}
securityContext:
capabilities:
add:
- ALL
env:
- name: USE_APACHE2
value: "1"
envFrom:
- configMapRef:
name: koha-map
volumeMounts:
- name: koha-pv
mountPath: /etc/koha/sites
subPath: sites
- name: koha-pv
mountPath: /tmp/libshare
subPath: lib
ports:
- containerPort: {{ .Values.opac.port }}
- containerPort: {{ .Values.staff.port }}
volumes:
- name: koha-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-pvc
{{ if not .Values.db.external }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-mysql
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: db
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: db
template:
metadata:
labels:
app: koha
component: db
spec:
securityContext:
runAsUser: 999
fsGroup: 999
containers:
- name: db
image: mariadb:10.3
envFrom:
- configMapRef:
name: koha-map
ports:
- containerPort: 3306
volumeMounts:
- name: koha-mysql-pv
mountPath: /var/lib/mysql
volumes:
- name: koha-mysql-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-mysql-pvc
{{ end }}
{{ if and .Values.elasticsearch.enabled (not .Values.elasticsearch.external) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-es
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: es
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: es
template:
metadata:
labels:
app: koha
component: es
spec:
containers:
- name: es
image: koha/elasticsearch-icu
securityContext:
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
env:
- name: cluster.name
value: "docker-cluster"
- name: bootstrap.memory_lock
value: "true"
- name: xpack.security.enabled
value: "false"
- name: ES_JAVA_OPTS
value: "-Xms1g -Xmx1g"
- name: SET_ULIMIT
value: "1"
initContainers:
- name: set-max-map-count
image: alpine
securityContext:
privileged: true
command: ["sh", "-c", "sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536"]
{{ end }}
{{ if .Values.sip.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-sip
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: sip
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: sip
template:
metadata:
labels:
app: koha
component: sip
spec:
initContainers:
- name: init-wait
image: alpine
command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ .Values.instance }}-plack 5000 && exit 0 || sleep 3; done; exit 1"]
containers:
- name: sip
image: {{ .Values.docker.registry }}:{{ .Values.docker.tag }}
env:
- name: USE_SIP
value: "1"
envFrom:
- configMapRef:
name: koha-map
volumeMounts:
- name: koha-pv
mountPath: /etc/koha/sites
subPath: sites
- name: koha-pv
mountPath: /tmp/libshare
subPath: lib
ports:
- containerPort: 6001
volumes:
- name: koha-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-pvc
{{ end }}
{{ if .Values.z3950.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-z3950
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: z3950
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: z3950
template:
metadata:
labels:
app: koha
component: z3950
spec:
initContainers:
- name: init-wait
image: alpine
command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ .Values.instance }}-plack 5000 && exit 0 || sleep 3; done; exit 1"]
containers:
- name: z3950
image: {{ .Values.docker.registry }}:{{ .Values.docker.tag }}
env:
- name: USE_Z3950
value: "1"
envFrom:
- configMapRef:
name: koha-map
volumeMounts:
- name: koha-pv
mountPath: /etc/koha/sites
subPath: sites
- name: koha-pv
mountPath: /tmp/libshare
subPath: lib
ports:
- containerPort: 2100
volumes:
- name: koha-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-pvc
{{ end }}
{{ if .Values.ncip.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-ncip
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: ncip
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: ncip
template:
metadata:
labels:
app: koha
component: ncip
spec:
initContainers:
- name: init-wait
image: alpine
command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ .Values.instance }}-plack 5000 && exit 0 || sleep 3; done; exit 1"]
containers:
- name: ncip
image: bywater/koha-ncip-server:v19.05-latest
env:
- name: KOHA_CONF
value: "/conf/{{ .Values.instance }}/koha-conf.xml"
volumeMounts:
- name: koha-pv
mountPath: /conf
subPath: sites
- name: koha-pv
mountPath: /usr/share/koha/lib
subPath: lib
volumes:
- name: koha-pv
persistentVolumeClaim:
claimName: koha-{{ .Values.instance }}-pvc
{{ end }}
{{ if and .Values.memcached.enabled (not .Values.memcached.external) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: koha-memcached
namespace: koha-{{ .Values.instance }}
labels:
app: koha
component: memcached
spec:
replicas: 1
selector:
matchLabels:
app: koha
component: memcached
template:
metadata:
labels:
app: koha
component: memcached
spec:
containers:
- name: memcached
image: memcached
command: [ "memcached", "-m", "64m" ]
{{ end }}

74
templates/ingress.yml Normal file
View File

@@ -0,0 +1,74 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: koha-ingress
namespace: koha-{{ .Values.instance }}
{{ if and .Values.tls.enabled .Values.tls.cert_manager.enabled }}
annotations:
{{ if eq .Values.tls.cert_manager.kind "cluster-issuer" }}
cert-manager.io/cluster-issuer: {{ .Values.tls.cert_manager.name }}
{{ else }}
cert-manager.io/issuer: {{ .Values.tls.cert_manager.name }}
{{ end }}
{{ end }}
labels:
app: koha
spec:
{{ if .Values.tls.enabled }}
tls:
- hosts:
- {{ .Values.staff.prefix }}{{ .Values.instance }}{{ .Values.staff.suffix }}{{ .Values.global.domain }}
- {{ .Values.opac.prefix }}{{ .Values.instance }}{{ .Values.opac.suffix }}{{ .Values.global.domain }}
secretName: koha-{{ .Values.instance }}-tls-secret
{{ end }}
rules:
- host: {{ .Values.staff.prefix }}{{ .Values.instance }}{{ .Values.staff.suffix }}{{ .Values.global.domain }}
http:
paths:
- backend:
service:
name: {{ .Values.instance }}-koha
port:
number: {{ .Values.staff.port }}
pathType: ImplementationSpecific
- host: {{ .Values.opac.prefix }}{{ .Values.instance }}{{ .Values.opac.suffix }}{{ .Values.global.domain }}
http:
paths:
- backend:
service:
name: {{ .Values.instance }}-koha
port:
number: {{ .Values.opac.port }}
pathType: ImplementationSpecific
{{ if .Values.sip.enabled }}
- host: {{ .Values.instance }}{{ .Values.sip.suffix }}{{ .Values.global.domain }}
http:
paths:
- backend:
service:
name: {{ .Values.instance }}-sip
port:
number: 6001
{{ end }}
{{ if .Values.ncip.enabled }}
- host: {{ .Values.instance }}{{ .Values.ncip.suffix }}{{ .Values.global.domain }}
http:
paths:
- backend:
service:
name: {{ .Values.instance }}-ncip
port:
number: 3000
pathType: ImplementationSpecific
{{ end }}
{{ if .Values.z3950.enabled }}
- host: {{ .Values.instance }}{{ .Values.z3950.suffix }}{{ .Values.global.domain }}
http:
paths:
- backend:
service:
name: {{ .Values.instance }}-z3950
port:
number: 2100
pathType: ImplementationSpecific
{{ end }}

143
templates/service.yml Normal file
View File

@@ -0,0 +1,143 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-koha
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-koha
spec:
type: ClusterIP
ports:
- name: staff
port: {{ .Values.staff.port }}
protocol: TCP
- name: opac
port: {{ .Values.opac.port }}
protocol: TCP
selector:
app: koha
component: apache
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-plack
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-plack
spec:
type: ClusterIP
ports:
- port: 5000
protocol: TCP
selector:
app: koha
component: plack
{{ if .Values.sip.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-sip
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-sip
spec:
type: ClusterIP
ports:
- port: 6001
protocol: TCP
selector:
app: koha
component: sip
{{ end }}
{{ if .Values.ncip.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-ncip
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-ncip
spec:
type: ClusterIP
ports:
- port: 3000
protocol: TCP
selector:
app: koha
component: ncip
{{ end }}
{{ if .Values.z3950.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-z3950
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-z3950
spec:
type: ClusterIP
ports:
- port: 2100
protocol: TCP
selector:
app: koha
component: z3950
{{ end }}
{{ if and .Values.elasticsearch.enabled (not .Values.elasticsearch.external) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-es
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-es
spec:
type: ClusterIP
ports:
- port: 9200
protocol: TCP
selector:
app: koha
component: es
{{ end }}
{{ if not .Values.db.external }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-db
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-db
spec:
type: ClusterIP
ports:
- port: 3306
protocol: TCP
selector:
app: koha
component: db
{{ end }}
{{ if and .Values.memcached.enabled (not .Values.memcached.external) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.instance }}-memcached
namespace: koha-{{ .Values.instance }}
labels:
run: {{ .Values.instance }}-memcached
spec:
type: ClusterIP
ports:
- port: 11211
protocol: TCP
selector:
app: koha
component: memcached
{{ end }}

31
templates/volumeClaim.yml Normal file
View File

@@ -0,0 +1,31 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: koha-{{ .Values.instance }}-pvc
namespace: koha-{{ .Values.instance }}
labels:
app: koha
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 24Gi
storageClassName: {{ .Values.storage.storageClassName }}
{{ if not .Values.db.external }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: koha-{{ .Values.instance }}-mysql-pvc
namespace: koha-{{ .Values.instance }}
labels:
app: koha
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 30Gi
storageClassName: {{ .Values.storage.storageClassName }}
{{ end }}