From f4d9fd43f09ce73692f3fd82b67e08dd507df65d Mon Sep 17 00:00:00 2001 From: Nold Date: Sun, 24 Oct 2021 21:36:45 +0200 Subject: [PATCH] misc: helm sideload initContainer option (#4325) ***NO_CI*** --- dev/helm/README.md | 3 +++ dev/helm/templates/deployment.yaml | 10 ++++++++++ dev/helm/values.yaml | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/dev/helm/README.md b/dev/helm/README.md index d539a7f9..5e823d45 100644 --- a/dev/helm/README.md +++ b/dev/helm/README.md @@ -108,6 +108,9 @@ The following table lists the configurable parameters of the Wiki.js chart and t | `ingress.annotations` | Ingress annotations | `{}` | | `ingress.hosts` | List of ingress rules | `[{"host": "wiki.local", "paths": ["/"]}]` | | `ingress.tls` | Ingress TLS configuration | `[]` | +| `sideload.enabled` | Enable sideloading of locale files from git | `false` | +| `sideload.repoURL` | Git repository URL containing locale files | `https://github.com/Requarks/wiki-localization` | +| `sideload.env` | Environment variables for sideload Container | `{}` | | `postgresql.enabled` | Deploy postgres server (see below) | `true` | | `postgresql.postgresqlDatabase` | Postgres database name | `wiki` | | `postgresql.postgresqlUser` | Postgres username | `postgres` | diff --git a/dev/helm/templates/deployment.yaml b/dev/helm/templates/deployment.yaml index ef9b4a5a..c26e9299 100644 --- a/dev/helm/templates/deployment.yaml +++ b/dev/helm/templates/deployment.yaml @@ -21,6 +21,16 @@ spec: serviceAccountName: {{ include "wiki.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.sideload.enabled }} + initContainers: + - name: {{ .Chart.Name }}-sideload + image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}" + imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }} + env: + {{- toYaml .Values.sideload.env | nindent 12 }} + command: [ "sh", "-c" ] + args: [ "mkdir -p /wiki/data/sideload && git clone --depth=1 {{ .Values.sideload.repoURL }} /wiki/data/sideload/" ] + {{- end }} containers: - name: {{ .Chart.Name }} securityContext: diff --git a/dev/helm/values.yaml b/dev/helm/values.yaml index 24ab1aee..41da889e 100644 --- a/dev/helm/values.yaml +++ b/dev/helm/values.yaml @@ -85,6 +85,17 @@ tolerations: [] affinity: {} +# This will allow us to install locales even without internet access using a initContainer & wikjs "sideloading" +sideload: + enabled: false + # Git-Repo containing all locales.json-files you need: + repoURL: https://github.com/Requarks/wiki-localization + + ## This can be helpfull if you have internet access over a http proxy: + env: [] + # - name: HTTPS_PROXY + # value: http://my.proxy.com:3128 + ## Configuration values for the postgresql dependency. ## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md ##