Browse Source

feat: helm chart (wip)

Nick 6 years ago
parent
commit
2ba1004024

+ 21 - 0
dev/helm/Chart.yaml

@@ -0,0 +1,21 @@
+apiVersion: v1
+name: Wiki.js
+version: 2.0.0
+appVersion: 2.0.0
+description: The most powerful and extensible open source Wiki software.
+keywords:
+  - wiki
+  - documentation
+  - knowledge base
+  - docs
+  - reference
+  - editor
+home: https://wiki.js.org
+icon: https://github.com/Requarks/wiki/raw/master/client/static/favicons/android-icon-192x192.png
+sources:
+  - https://github.com/Requarks/wiki
+maintainers:
+  - name: Nicolas Giard
+    email: github@ngpixel.com
+    url: https://github.com/NGPixel
+engine: gotpl

+ 2 - 0
dev/helm/README.md

@@ -0,0 +1,2 @@
+# Work in progress
+##### Do not use!

+ 5 - 0
dev/helm/requirements.yaml

@@ -0,0 +1,5 @@
+dependencies:
+  - name: postgresql
+    version: 3.18.4
+    repository: https://kubernetes-charts.storage.googleapis.com/
+    condition: postgresql.enabled

+ 39 - 0
dev/helm/templates/ingress.yaml

@@ -0,0 +1,39 @@
+{{- if .Values.ingress.enabled }}
+{{- range .Values.ingress.hosts  }}
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: {{ template "wiki.fullname" $ }}
+  labels:
+    app: {{ template "wiki.name" $ }}
+    chart: {{ template "wiki.chart" $ }}
+    release: {{ $.Release.Name | quote }}
+    heritage: {{ $.Release.Service | quote }}
+  annotations:
+    {{- if .tls }}
+    ingress.kubernetes.io/secure-backends: "true"
+    {{- end }}
+    {{- if .certManager }}
+    kubernetes.io/tls-acme: "true"
+    {{- end }}
+    {{- range $key, $value := .annotations }}
+    {{ $key }}: {{ $value | quote }}
+    {{- end }}
+spec:
+  rules:
+  - host: {{ .name }}
+    http:
+      paths:
+        - path: {{ default "/" .path }}
+          backend:
+            serviceName: {{ template "wiki.fullname" $ }}
+            servicePort: 80
+{{- if .tls }}
+  tls:
+  - hosts:
+    - {{ .name }}
+    secretName: {{ .tlsSecret }}
+{{- end }}
+---
+{{- end }}
+{{- end }}

+ 13 - 0
dev/helm/templates/secrets.yaml

@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ template "wiki.fullname" . }}
+  labels:
+    app: {{ template "wiki.fullname" . }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+type: Opaque
+data:
+  db-user: {{ .Values.postgresql.postgresUser | b64enc | quote }}
+  db-password: {{ .Values.postgresql.postgresPassword | b64enc | quote }}

+ 32 - 0
dev/helm/templates/service.yaml

@@ -0,0 +1,32 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ template "wiki.fullname" . }}
+  labels:
+    app: {{ template "wiki.name" . }}
+    chart: {{ template "wiki.chart" . }}
+    release: {{ .Release.Name | quote }}
+    heritage: {{ .Release.Service | quote }}
+spec:
+  type: {{ .Values.service.type }}
+  {{- if .Values.service.loadBalancerIP }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }}
+  externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
+  {{- end }}
+  ports:
+  - name: http
+    port: {{ .Values.service.port }}
+    targetPort: http
+    {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePorts.http)))}}
+    nodePort: {{ .Values.service.nodePorts.http }}
+    {{- end }}
+  - name: https
+    port: {{ .Values.service.httpsPort }}
+    targetPort: https
+    {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePorts.https)))}}
+    nodePort: {{ .Values.service.nodePorts.https }}
+    {{- end }}
+  selector:
+    app: {{ template "wiki.name" . }}

+ 41 - 0
dev/helm/values.yaml

@@ -0,0 +1,41 @@
+##
+## Configuration values for the postgresql dependency.
+## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
+postgresql:
+  ##
+  ## Use the PostgreSQL chart dependency.
+  ## Set to false if bringing your own PostgreSQL.
+  enabled: true
+  ##
+  ## If you are bringing your own PostgreSQL, you should set postgresHost and
+  ## also probably service.port, postgresUser, postgresPassword, and postgresDatabase
+  ## postgresHost:
+  ##
+  ## PostgreSQL port
+  service:
+    port: 5432
+  ## PostgreSQL User to create.
+  postgresUser: wiki
+  ##
+  ## PostgreSQL Password for the new user.
+  ## If not set, a random 10 characters password will be used.
+  postgresPassword: wikijsrocks
+  ##
+  ## PostgreSQL Database to create.
+  postgresDatabase: wiki
+  ##
+  ## Persistent Volume Storage configuration.
+  ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes
+  persistence:
+    ##
+    ## Enable PostgreSQL persistence using Persistent Volume Claims.
+    enabled: true
+    ##
+    ## Persistant class
+    # storageClass: classname
+    ##
+    ## Access mode:
+    accessMode: ReadWriteOnce
+    ##
+    ## Requested size:
+    size: 10Gi