fix(helm): Replace bitname PostgreSQL chart with custom statefulset (#7936)

* fix(helm): Replace Bitnami PostgreSQL chart with custom StatefulSet (#7831)

* refactor: migrate from Bitnami PostgreSQL to official PostgreSQL image

Replace Bitnami PostgreSQL dependency with custom PostgreSQL StatefulSet implementation
Add new PostgreSQL templates: statefulset, service, and PVC
Update values.yaml to include PostgreSQL image configuration with official postgres:17.4 image
Implement custom PostgreSQL deployment using official Docker Hub image instead of Bitnami chart
Add PostgreSQL resource, nodeSelector, tolerations, and affinity configuration options
Update helper templates to support new PostgreSQL implementation
Update deployment template to connect to the new PostgreSQL implementation
Update README.md to document the new PostgreSQL configuration parameters

BREAKING CHANGE: This replaces the Bitnami PostgreSQL dependency with a custom PostgreSQL implementation using the official
PostgreSQL image from Docker Hub, changing how PostgreSQL is deployed and configured.

Signed-off-by: Ilya Gilev jazer23569@gmail.com

* feature: added a option to use an existing secret for postresql installation

---------

Signed-off-by: Ilya Gilev jazer23569@gmail.com

* refactor(helm): adjust helm templates for clarity

---------

Signed-off-by: Ilya Gilev jazer23569@gmail.com
Co-authored-by: acidsugarx <58903233+acidsugarx@users.noreply.github.com>
pull/5355/merge
Nicolas Giard 7 months ago committed by GitHub
parent d14b0a5509
commit 8fc931a0d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +0,0 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 8.10.14
digest: sha256:db7c1e0bc9ec0ed45520521bd76bb390d04711fd0f04affaadafa1dc498ce68b
generated: "2020-07-21T20:34:41.41180748-04:00"

@ -1,11 +1,7 @@
apiVersion: v2 apiVersion: v2
name: wiki name: wiki-js
# This is the chart version. This version number should be incremented each time you make changes version: '3.0.0'
# to the chart and its templates, including the app version. appVersion: '2'
version: 2.3.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
AppVersion: latest
description: The most powerful and extensible open source Wiki software. description: The most powerful and extensible open source Wiki software.
keywords: keywords:
- wiki - wiki
@ -14,29 +10,8 @@ keywords:
- docs - docs
- reference - reference
- editor - editor
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
dependencies: home: https://js.wiki
- name: postgresql
version: 8.10.14
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
home: https://wiki.js.org
icon: https://cdn.js.wiki/images/wikijs-butterfly.svg icon: https://cdn.js.wiki/images/wikijs-butterfly.svg
sources: sources:
- https://github.com/Requarks/wiki - https://github.com/requarks/wiki
maintainers:
- name: Nicolas Giard
email: github@ngpixel.com
url: https://github.com/NGPixel
- name: James Greenhill
email: james@fuziontech.net
url: https://github.com/fuziontech
engine: gotpl

@ -43,7 +43,7 @@ Wiki.js is an open source project that has been made possible due to the generou
This chart bootstraps a Wiki.js deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. This chart bootstraps a Wiki.js deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
It also optionally packages the [PostgreSQL](https://github.com/kubernetes/charts/tree/master/stable/postgresql) as the database but you are free to bring your own. It also optionally deploys PostgreSQL as the database using the official PostgreSQL image from Docker Hub, but you are free to bring your own database.
## Prerequisites ## Prerequisites
@ -59,7 +59,7 @@ $ helm repo add requarks https://charts.js.wiki
To install the chart with the release name `my-release` run the following: To install the chart with the release name `my-release` run the following:
### Using Helm 3: ### Using Helm 3/4:
```console ```console
$ helm install my-release requarks/wiki $ helm install my-release requarks/wiki
``` ```
@ -95,7 +95,7 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| Parameter | Description | Default | | Parameter | Description | Default |
| ------------------------------- | ------------------------------- | ---------------------------------------------------------- | | ------------------------------- | ------------------------------- | ---------------------------------------------------------- |
| `image.repository` | Wiki.js image | `requarks/wiki` | | `image.repository` | Wiki.js image | `requarks/wiki` |
| `image.tag` | Wiki.js image tag | `latest` | | `image.tag` | Wiki.js image tag | `2` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` | | `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `replicacount` | Number of Wiki.js pods to run | `1` | | `replicacount` | Number of Wiki.js pods to run | `1` |
| `revisionHistoryLimit` | Total number of revision history points | `10` | | `revisionHistoryLimit` | Total number of revision history points | `10` |
@ -119,20 +119,33 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `sideload.resources.limits` | Resource limits for the sideload container | `nil` | | `sideload.resources.limits` | Resource limits for the sideload container | `nil` |
| `sideload.resources.requests` | Resource requests for the sideload container | `nil` | | `sideload.resources.requests` | Resource requests for the sideload container | `nil` |
| `nodeExtraCaCerts` | Trusted certificates path | `nil` | | `nodeExtraCaCerts` | Trusted certificates path | `nil` |
| `externalPostgresql.databaseURL` | External postgres connection string | `nil` |
| `postgresql.enabled` | Deploy postgres server (see below) | `true` | | `postgresql.enabled` | Deploy postgres server (see below) | `true` |
| `postgresql.postgresqlDatabase` | Postgres database name | `wiki` | | `postgresql.postgresqlDatabase` | Postgres database name | `wiki` |
| `postgresql.postgresqlUser` | Postgres username | `postgres` | | `postgresql.postgresqlUser` | Postgres username | `postgres` |
| `postgresql.postgresqlHost` | External postgres host | `nil` | | `postgresql.postgresqlHost` | Postgres host | `nil` |
| `postgresql.postgresqlPassword` | External postgres password | `nil` | | `postgresql.postgresqlPassword` | Postgres password | `nil` |
| `postgresql.existingSecret` | Provide an existing `Secret` for postgres | `nil` | | `postgresql.existingSecret` | Provide an existing `Secret` for postgres | `nil` |
| `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` | | `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` |
| `postgresql.postgresqlPort` | External postgres port | `5432` | | `postgresql.existingSecretUserKey` | The postgres username key in the existing `Secret` | `postgresql-username` |
| `postgresql.postgresqlPort` | Postgres port | `5432` |
| `postgresql.ssl` | Enable external postgres SSL connection | `false` | | `postgresql.ssl` | Enable external postgres SSL connection | `false` |
| `postgresql.ca` | Certificate of Authority content for postgres | `nil` | | `postgresql.ca` | Certificate of Authority content for postgres | `nil` |
| `postgresql.persistence.enabled` | Enable postgres persistence using PVC | `true` | | `postgresql.persistence.enabled` | Enable postgres persistence using PVC | `true` |
| `postgresql.persistence.existingClaim` | Provide an existing `PersistentVolumeClaim` for postgres | `nil` | | `postgresql.persistence.existingClaim` | Provide an existing `PersistentVolumeClaim` for postgres | `nil` |
| `postgresql.persistence.storageClass` | Postgres PVC Storage Class (example: `nfs`) | `nil` | | `postgresql.persistence.storageClass` | Postgres PVC Storage Class (example: `nfs`) | `nil` |
| `postgresql.persistence.size` | Postgers PVC Storage Request | `8Gi` | | `postgresql.persistence.size` | Postgres PVC Storage Request | `8Gi` |
| `postgresql.persistence.accessMode` | Postgres Persistent Volume Access Mode | `ReadWriteOnce` |
| `postgresql.image.repository` | PostgreSQL image repository | `postgres` |
| `postgresql.image.tag` | PostgreSQL image tag | `18` |
| `postgresql.image.pullPolicy` | PostgreSQL image pull policy | `IfNotPresent` |
| `postgresql.resources` | PostgreSQL resource requests/limits | `{}` |
| `postgresql.nodeSelector` | PostgreSQL node selector labels | `{}` |
| `postgresql.tolerations` | PostgreSQL toleration labels | `[]` |
| `postgresql.affinity` | PostgreSQL affinity settings | `{}` |
| `postgresql.service.type` | PostgreSQL service type | `ClusterIP` |
| `postgresql.service.port` | PostgreSQL service port | `5432` |
| `postgresql.service.annotations` | PostgreSQL service annotations | `{}` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@ -150,25 +163,44 @@ $ helm install --name my-release -f values.yaml requarks/wiki
> **Tip**: You can use the default [values.yaml](values.yaml) > **Tip**: You can use the default [values.yaml](values.yaml)
## PostgresSQL ## PostgreSQL
By default, PostgreSQL is installed as part of the chart. By default, PostgreSQL is installed as part of the chart using the official PostgreSQL image from Docker Hub (version 18).
### Using an external PostgreSQL server ### Using an external PostgreSQL server
To use an external PostgreSQL server, set `postgresql.enabled` to `false` and then set `postgresql.postgresqlHost` and `postgresql.postgresqlPassword`. To use an existing `Secret`, set `postgresql.existingSecret`. The other options (`postgresql.postgresqlDatabase`, `postgresql.postgresqlUser`, `postgresql.postgresqlPort` and `postgresql.existingSecretKey`) may also want changing from their default values. To use an external PostgreSQL server, set `postgresql.enabled` to `false`, then use either:
To use an SSL connection you can set `postgresql.ssl` to `true` and if needed the path to a Certificate of Authority can be set using `postgresql.ca` to `/path/to/ca`. Default `postgresql.ssl` value is `false`. #### Connection String
If `postgresql.existingSecret` is not specified, you also need to add the following Helm template to your deployment in order to create the postgresql `Secret`: Set `externalPostgresql.databaseURL` to the full PostgreSQL connection string.
```yaml #### Connection Parameters
kind: Secret
apiVersion: v1 Set `externalPostgresql.host`, `externalPostgres.port`, `externalPostgres.database`, `externalPostgres.username`, `externalPostgres.existingSecret` *(secret name)* and `externalPostgres.existingSecretKey` *(key in the secret containing the password)*
metadata:
name: {{ template "wiki.postgresql.secret" . }} Ensure the secret specified in `externalPostgresql.existingSecret` already exists, with a password set at the path specified in `externalPostgres.existingSecretKey`.
data:
{{ template "wiki.postgresql.secretKey" . }}: "{{ .Values.postgresql.postgresqlPassword | b64enc }}" To use an SSL connection you can set `externalPostgresql.ssl` to `true` and if needed the path to a Certificate of Authority can be set using `externalPostgresql.ca` to `/path/to/ca`. Default `externalPostgresql.ssl` value is `false`.
### Using an existing PostgreSQL secret with built-in PostgreSQL
When using the built-in PostgreSQL (default behavior with `postgresql.enabled: true`), you can still use an existing Kubernetes secret for the database credentials by setting:
- `postgresql.existingSecret`: Name of the existing secret containing the credentials
- `postgresql.existingSecretKey`: Key in the secret containing the password (defaults to `postgresql-password`)
- `postgresql.existingSecretUserKey`: Key in the secret containing the username (defaults to `postgresql-username`)
Example usage:
```bash
# Create your existing secret
kubectl create secret generic my-postgres-secret \
--from-literal=postgresql-username=postgres \
--from-literal=postgresql-password=yourpassword
# Deploy with existing secret
helm install my-release requarks/wiki \
--set postgresql.enabled=true \
--set postgresql.existingSecret=my-postgres-secret
``` ```
## Persistence ## Persistence

@ -19,3 +19,16 @@
echo "Visit http://127.0.0.1:8080 to use your application" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }}
2. PostgreSQL database has been deployed as part of this release:
- Database: {{ .Values.postgresql.postgresqlDatabase }}
- User: {{ .Values.postgresql.postgresqlUser }}
- Service: {{ include "wiki.postgresql.fullname" . }}
- Version: {{ .Values.postgresql.image.tag }}
- Persistence: {{ .Values.postgresql.persistence.enabled | ternary "Enabled" "Disabled" }}
{{- end }}
{{- if not .Values.postgresql.enabled }}
2. External PostgreSQL setup detected. Ensure your database is accessible at the configured host.
{{- end }}

@ -63,15 +63,18 @@ Create the name of the service account to use
{{- end -}} {{- end -}}
{{/* {{/*
Create a default fully qualified app name. PostgreSQL fullname
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}} */}}
{{- define "wiki.postgresql.fullname" -}} {{- define "wiki.postgresql.fullname" -}}
{{- if .Values.postgresql.fullnameOverride -}} {{- printf "%s-%s" (include "wiki.fullname" .) "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{ printf "%s-%s" .Release.Name "postgresql"}}
{{- end -}} {{- end -}}
{{/*
PostgreSQL selector labels
*/}}
{{- define "wiki.postgresql.selectorLabels" -}}
app.kubernetes.io/name: {{ include "wiki.name" . }}-postgresql
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
{{/* {{/*
@ -79,9 +82,9 @@ Set postgres host
*/}} */}}
{{- define "wiki.postgresql.host" -}} {{- define "wiki.postgresql.host" -}}
{{- if .Values.postgresql.enabled -}} {{- if .Values.postgresql.enabled -}}
{{- template "wiki.postgresql.fullname" . -}} {{- include "wiki.postgresql.fullname" . -}}
{{- else -}} {{- else -}}
{{- .Values.postgresql.postgresqlHost | quote -}} {{- .Values.postgresql.postgresqlHost | default "localhost" | quote -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -89,10 +92,25 @@ Set postgres host
Set postgres secret Set postgres secret
*/}} */}}
{{- define "wiki.postgresql.secret" -}} {{- define "wiki.postgresql.secret" -}}
{{- if .Values.postgresql.enabled -}} {{- if and .Values.postgresql.enabled .Values.postgresql.existingSecret -}}
{{- template "wiki.postgresql.fullname" . -}} {{- .Values.postgresql.existingSecret -}}
{{- else if .Values.postgresql.enabled -}}
{{- include "wiki.postgresql.fullname" . -}}
{{- else -}} {{- else -}}
{{- template "wiki.fullname" . -}} {{- template "wiki.fullname" . -}}
{{- end -}}
{{- end -}}
{{/*
Set postgres secretUserKey
*/}}
{{- define "wiki.postgresql.secretUserKey" -}}
{{- if and .Values.postgresql.enabled .Values.postgresql.existingSecret -}}
{{- default "postgresql-username" .Values.postgresql.existingSecretUserKey | quote -}}
{{- else if .Values.postgresql.enabled -}}
"postgresql-username"
{{- else -}}
{{- default "postgresql-username" .Values.postgresql.existingSecretUserKey | quote -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -100,9 +118,24 @@ Set postgres secret
Set postgres secretKey Set postgres secretKey
*/}} */}}
{{- define "wiki.postgresql.secretKey" -}} {{- define "wiki.postgresql.secretKey" -}}
{{- if .Values.postgresql.enabled -}} {{- if and .Values.postgresql.enabled .Values.postgresql.existingSecret -}}
"postgresql-password" {{- default "postgresql-password" .Values.postgresql.existingSecretKey | quote -}}
{{- else if .Values.postgresql.enabled -}}
"postgresql-password"
{{- else -}}
{{- default "postgresql-password" .Values.postgresql.existingSecretKey | quote -}}
{{- end -}}
{{- end -}}
{{/*
Set postgres secretDatabaseKey
*/}}
{{- define "wiki.postgresql.secretDatabaseKey" -}}
{{- if and .Values.postgresql.enabled .Values.postgresql.existingSecret -}}
{{- default "postgresql-database" .Values.postgresql.existingSecretDatabaseKey | quote -}}
{{- else if .Values.postgresql.enabled -}}
"postgresql-database"
{{- else -}} {{- else -}}
{{- default "postgresql-password" .Values.postgresql.existingSecretKey | quote -}} {{- default "postgresql-database" .Values.postgresql.existingSecretDatabaseKey | quote -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

@ -29,7 +29,7 @@ spec:
- name: {{ .Chart.Name }}-sideload - name: {{ .Chart.Name }}-sideload
securityContext: securityContext:
{{- toYaml .Values.sideload.securityContext | nindent 12 }} {{- toYaml .Values.sideload.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ default "2" .Values.image.tag }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }} imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
env: env:
{{- toYaml .Values.sideload.env | nindent 12 }} {{- toYaml .Values.sideload.env | nindent 12 }}
@ -42,7 +42,7 @@ spec:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ default "2" .Values.image.tag }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }} imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
env: env:
{{- if .Values.nodeExtraCaCerts }} {{- if .Values.nodeExtraCaCerts }}
@ -56,15 +56,22 @@ spec:
value: {{ .Values.externalPostgresql.databaseURL }} value: {{ .Values.externalPostgresql.databaseURL }}
- name: NODE_TLS_REJECT_UNAUTHORIZED - name: NODE_TLS_REJECT_UNAUTHORIZED
value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }} value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }}
{{- else }} {{- else if .Values.postgresql.enabled }}
- name: DB_HOST - name: DB_HOST
value: {{ template "wiki.postgresql.host" . }} value: {{ template "wiki.postgresql.host" . }}
- name: DB_PORT - name: DB_PORT
value: "{{ default "5432" .Values.postgresql.postgresqlPort }}" value: "{{ default "5432" .Values.postgresql.postgresqlPort }}"
- name: DB_NAME - name: DB_NAME
value: {{ default "wiki" .Values.postgresql.postgresqlDatabase }} value: {{ default "wiki" .Values.postgresql.postgresqlDatabase | quote }}
- name: DB_USER - name: DB_USER
value: {{ default "wiki" .Values.postgresql.postgresqlUser }} {{- if .Values.postgresql.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.existingSecret }}
key: {{ template "wiki.postgresql.secretUserKey" . }}
{{- else }}
value: {{ default "postgres" .Values.postgresql.postgresqlUser }}
{{- end }}
- name: DB_SSL - name: DB_SSL
value: "{{ default "false" .Values.postgresql.ssl }}" value: "{{ default "false" .Values.postgresql.ssl }}"
- name: DB_SSL_CA - name: DB_SSL_CA
@ -72,12 +79,27 @@ spec:
- name: DB_PASS - name: DB_PASS
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
{{- if .Values.postgresql.existingSecret }}
name: {{ .Values.postgresql.existingSecret }}
{{- else }}
name: {{ template "wiki.postgresql.secret" . }} name: {{ template "wiki.postgresql.secret" . }}
{{- end }}
key: {{ template "wiki.postgresql.secretKey" . }} key: {{ template "wiki.postgresql.secretKey" . }}
{{- else if .Values.externalPostgresql }}
# External PostgreSQL configuration
- name: DB_HOST
value: {{ required "External PostgreSQL host is required when postgresql.enabled is false" .Values.externalPostgresql.host | quote }}
- name: DB_PORT
value: {{ required "External PostgreSQL port is required when postgresql.enabled is false" .Values.externalPostgresql.port | quote }}
- name: DB_NAME
value: {{ required "External PostgreSQL database name is required when postgresql.enabled is false" .Values.externalPostgresql.database | quote }}
- name: DB_USER
value: {{ required "External PostgreSQL user is required when postgresql.enabled is false" .Values.externalPostgresql.username | quote }}
- name: DB_PASS
valueFrom:
secretKeyRef:
name: {{ required "External PostgreSQL secret name is required when postgresql.enabled is false" .Values.externalPostgresql.existingSecret | quote }}
key: {{ required "External PostgreSQL secret key is required when postgresql.enabled is false" .Values.externalPostgresql.existingSecretKey | quote }}
- name: DB_SSL
value: "{{ default "false" .Values.externalPostgresql.ssl }}"
- name: DB_SSL_CA
value: "{{ default "" .Values.externalPostgresql.ca }}"
{{- end }} {{- end }}
- name: HA_ACTIVE - name: HA_ACTIVE
value: {{ .Values.replicaCount | int | le 2 | quote }} value: {{ .Values.replicaCount | int | le 2 | quote }}

@ -0,0 +1,21 @@
{{- if and .Values.postgresql.enabled .Values.postgresql.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "wiki.postgresql.fullname" . }}
labels:
{{- include "wiki.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.postgresql.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.postgresql.persistence.size | quote }}
{{- if .Values.postgresql.persistence.storageClass }}
{{- if (eq "-" .Values.postgresql.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.postgresql.persistence.storageClass | quote }}
{{- end }}
{{- end }}
{{- end }}

@ -0,0 +1,12 @@
{{- if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "wiki.postgresql.fullname" . }}
labels:
{{- include "wiki.labels" . | nindent 4 }}
type: Opaque
data:
postgresql-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }}
postgresql-username: {{ .Values.postgresql.postgresqlUser | b64enc | quote }}
{{- end }}

@ -0,0 +1,21 @@
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "wiki.postgresql.fullname" . }}
labels:
{{- include "wiki.labels" . | nindent 4 }}
{{- with .Values.postgresql.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.postgresql.service.type }}
ports:
- port: {{ .Values.postgresql.service.port }}
targetPort: 5432
protocol: TCP
name: postgresql
selector:
{{- include "wiki.postgresql.selectorLabels" . | nindent 4 }}
{{- end }}

@ -0,0 +1,101 @@
{{- if .Values.postgresql.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "wiki.postgresql.fullname" . }}
labels:
{{- include "wiki.labels" . | nindent 4 }}
spec:
serviceName: {{ include "wiki.postgresql.fullname" . }}
replicas: 1
selector:
matchLabels:
{{- include "wiki.postgresql.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "wiki.postgresql.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.postgresql.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.postgresql.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.postgresql.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: postgresql
image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
ports:
- containerPort: 5432
name: postgresql
env:
- name: POSTGRES_DB
value: {{ .Values.postgresql.postgresqlDatabase | quote }}
- name: POSTGRES_USER
{{- if .Values.postgresql.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.existingSecret }}
key: {{ default "postgresql-username" .Values.postgresql.existingSecretUserKey | quote }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ include "wiki.postgresql.fullname" . }}
key: postgresql-username
{{- end }}
- name: POSTGRES_PASSWORD
{{- if .Values.postgresql.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.existingSecret }}
key: {{ default "postgresql-password" .Values.postgresql.existingSecretKey | quote }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ include "wiki.postgresql.fullname" . }}
key: postgresql-password
{{- end }}
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
livenessProbe:
exec:
command:
- sh
- -c
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
exec:
command:
- sh
- -c
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 6
resources:
{{- toYaml .Values.postgresql.resources | nindent 12 }}
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql/data
subPath: postgresql
volumes:
- name: postgresql-data
{{- if .Values.postgresql.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "wiki.postgresql.fullname" . }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}

@ -19,8 +19,4 @@ spec:
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
- port: {{ default "443" .Values.service.httpsPort}}
targetPort: http
protocol: TCP
name: https
selector: {{- include "wiki.selectorLabels" . | nindent 4}} selector: {{- include "wiki.selectorLabels" . | nindent 4}}

@ -3,7 +3,7 @@
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
revisionHistoryLimit: 10 revisionHistoryLimit: 2
image: image:
repository: requarks/wiki repository: requarks/wiki
@ -61,7 +61,6 @@ service:
# Annotations applied for services such as externalDNS or # Annotations applied for services such as externalDNS or
# service type LoadBalancer # service type LoadBalancer
# type: LoadBalancer # type: LoadBalancer
# httpsPort: 443
# annotations: {} # annotations: {}
# loadBalancerIP: 172.16.0.1 # loadBalancerIP: 172.16.0.1
@ -108,7 +107,7 @@ volumes: []
sideload: sideload:
enabled: false enabled: false
# Git-Repo containing all locales.json-files you need: # Git-Repo containing all locales.json-files you need:
repoURL: https://github.com/Requarks/wiki-localization repoURL: https://github.com/requarks/wiki-localization
## This can be helpfull if you have internet access over a http proxy: ## This can be helpfull if you have internet access over a http proxy:
env: [] env: []
@ -156,47 +155,52 @@ extraEnvVars: []
# # For self signed CAs, like DigitalOcean # # For self signed CAs, like DigitalOcean
# NODE_TLS_REJECT_UNAUTHORIZED: "0" # NODE_TLS_REJECT_UNAUTHORIZED: "0"
## Configuration values for the postgresql dependency. ## Configuration for the custom PostgreSQL 18 deployment
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
## ##
postgresql: postgresql:
## Use the PostgreSQL chart dependency.
## Set to false if bringing your own PostgreSQL, and set secret value postgresql-uri.
##
enabled: true enabled: true
## ssl enforce SSL communication with PostgresSQL ## ssl enforce SSL communication with PostgresSQL
## Default to false ## Default to false
## ##
# ssl: false ssl: false
## ca Certificate of Authority ## ca Certificate of Authority
## Default to empty, point to location of CA ## Default to empty, point to location of CA
## ##
# ca: "path to ca" # ca: "path to ca"
## postgresqlHost override postgres database host ## postgresqlHost override postgres database host
## Default to postgres ## Default to the service name of the custom PostgreSQL deployment
## ##
# postgresqlHost: postgres postgresqlHost: "{{ include \"wiki.postgresql.fullname\" . }}"
## postgresqlPort port for postgres ## postgresqlPort port for postgres
## Default to 5432 ## Default to 5432
## ##
# postgresqlPort: 5432 postgresqlPort: 5432
## PostgreSQL fullname Override
## Default to wiki-postgresql unless fullname override is set for Chart
##
fullnameOverride: ""
## PostgreSQL User to create. ## PostgreSQL User to create.
## ##
postgresqlUser: postgres postgresqlUser: postgres
## PostgreSQL Database to create. ## PostgreSQL Database to create.
## ##
postgresqlDatabase: wiki postgresqlDatabase: wiki
## PostgreSQL password (will be stored in a secret)
##
postgresqlPassword: "postgres"
## Use existing secret for PostgreSQL credentials
## If set, the chart will not create a new secret and will use the existing one
##
# existingSecret: "my-existing-postgres-secret"
## Key in the existing secret containing the password
##
# existingSecretKey: "postgresql-password"
## Key in the existing secret containing the username (defaults to "postgresql-username")
##
# existingSecretUserKey: "postgresql-username"
## Persistent Volume Storage configuration. ## Persistent Volume Storage configuration.
## ref: https://kubernetes.io/docs/user-guide/persistent-volumes ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes
## ##
replication:
## Enable PostgreSQL replication (primary/secondary)
##
enabled: false
persistence: persistence:
## Enable PostgreSQL persistence using Persistent Volume Claims. ## Enable PostgreSQL persistence using Persistent Volume Claims.
## ##
@ -215,3 +219,34 @@ postgresql:
## Persistent Volume Storage Size. ## Persistent Volume Storage Size.
## ##
size: 8Gi size: 8Gi
## PostgreSQL Image Configuration
image:
repository: postgres
tag: "18"
pullPolicy: IfNotPresent
## PostgreSQL Resources Configuration
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
## PostgreSQL Node Selector, Tolerations and Affinity
nodeSelector: {}
tolerations: []
affinity: {}
## PostgreSQL Service Configuration
service:
type: ClusterIP
port: 5432
# Additional service annotations
annotations: {}

Loading…
Cancel
Save