[kanboard] Add postgresql support (#680)

* [kanboard] Add postgresql support

Signed-off-by: Travis Lyons <trly@users.noreply.github.com>

* Fix volume add logic

Only add config volume to manifests if postgresql is enabled.

Signed-off-by: Travis Lyons <trly@users.noreply.github.com>
This commit is contained in:
Travis Lyons 2021-03-15 20:37:55 -04:00 committed by GitHub
parent 6a48d3fdb0
commit 802ee07407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 105 additions and 3 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v1.2.18
description: Kanboard is a free and open source Kanban project management software.
name: kanboard
version: 1.0.0
version: 1.1.0
kubeVersion: ">=1.16.0-0"
keywords:
- kanboard
@ -18,3 +18,7 @@ dependencies:
- name: common
repository: https://k8s-at-home.com/charts/
version: 3.1.0
- name: postgresql
version: 10.3.7
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled

View File

@ -1,6 +1,6 @@
# kanboard
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: v1.2.18](https://img.shields.io/badge/AppVersion-v1.2.18-informational?style=flat-square)
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![AppVersion: v1.2.18](https://img.shields.io/badge/AppVersion-v1.2.18-informational?style=flat-square)
Kanboard is a free and open source Kanban project management software.
@ -18,6 +18,7 @@ Kubernetes: `>=1.16.0-0`
| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | postgresql | 10.3.7 |
| https://k8s-at-home.com/charts/ | common | 3.1.0 |
## TL;DR
@ -98,6 +99,12 @@ N/A
| ingress.enabled | bool | `false` | |
| persistence.data | object | `{"accessMode":"ReadWriteOnce","emptyDir":false,"enabled":false,"mountPath":"/var/www/app/data","size":"1Gi"}` | enable data persistence |
| persistence.ssl | object | `{"emptyDir":false,"enabled":false,"mountPath":"/etc/nginx/ssl"}` | enable SSL persistence |
| postgresql | object | `{"enabled":false,"persistence":{"enabled":false},"postgresqlDatabase":"kanboard","postgresqlPassword":"kanboard","postgresqlUsername":"kanboard"}` | Bitnami postgres chart. For more options see https://github.com/bitnami/charts/tree/master/bitnami/postgresql |
| postgresql.enabled | bool | `false` | true: use bitnami postgres instance -- false: use your own postgres instance |
| postgresql.persistence.enabled | bool | `false` | if database is stored to a PVC. Set to true when you are done testing. |
| postgresql.postgresqlDatabase | string | `"kanboard"` | Postgres database password |
| postgresql.postgresqlPassword | string | `"kanboard"` | Postgres database password |
| postgresql.postgresqlUsername | string | `"kanboard"` | Postgres database user name |
| service.port.port | int | `80` | |
| strategy.type | string | `"Recreate"` | |
@ -107,6 +114,14 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [1.1.0]
#### Added
- Added postgres support
[1.1.0]: https://github.com/k8s-at-home/charts/tree/kanboard-1.1.0/charts/home-assistant
### [1.0.0]
#### Added

View File

@ -9,6 +9,14 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [1.1.0]
#### Added
- Added postgres support
[1.1.0]: https://github.com/k8s-at-home/charts/tree/kanboard-1.1.0/charts/home-assistant
### [1.0.0]
#### Added

View File

@ -25,5 +25,31 @@
{{- $_ := set .Values.env "SESSION_DURATION" (printf "%v" .Values.config.session.duration) -}}
{{- $_ := set .Values.env "SESSION_HANDLER" (printf "%s" .Values.config.session.handler) -}}
{{/* Append the configMap to the additionalVolumes */}}
{{- define "kanboard.config.volume" -}}
name: config
secret:
secretName: {{ template "common.names.fullname" . }}-config
{{- end -}}
{{- if .Values.postgresql.enabled -}}
{{- $volume := include "kanboard.config.volume" . | fromYaml -}}
{{- $additionalVolumes := append .Values.additionalVolumes $volume }}
{{- $_ := set .Values "additionalVolumes" (deepCopy $additionalVolumes) -}}
{{- end -}}
{{/* Append the config secret volume to the additionalVolumeMounts */}}
{{- define "kanboard.config.volumeMount" -}}
name: config
mountPath: /var/www/app/config.php
subPath: config.php
{{- end -}}
{{- if .Values.postgresql.enabled -}}
{{- $volumeMount := include "kanboard.config.volumeMount" . | fromYaml -}}
{{- $additionalVolumeMounts := append .Values.additionalVolumeMounts $volumeMount }}
{{- $_ := set .Values "additionalVolumeMounts" (deepCopy $additionalVolumeMounts) -}}
{{- end -}}
{{/* Render the templates */}}
{{ include "common.all" . }}
{{ include "common.all" . }}

View File

@ -0,0 +1,33 @@
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "kanboard.fullname" . }}-config
stringData:
config.php: |
<?php
// Mysql/Postgres username
define('DB_USERNAME', {{ .Values.postgresql.postgresqlUsername | quote }});
// Mysql/Postgres password
define('DB_PASSWORD', {{ .Values.postgresql.postgresqlPassword | quote }});
// Mysql/Postgres hostname
define('DB_HOSTNAME', "{{ include "kanboard.fullname" . }}-postgresql-headless");
// Mysql/Postgres database name
define('DB_NAME', {{ .Values.postgresql.postgresqlDatabase | quote }});
// Mysql/Postgres custom port (null = default port)
define('DB_PORT', {{ .Values.postgresql.service.port }});
// Mysql SSL key
define('DB_SSL_KEY', null);
// Mysql SSL certificate
define('DB_SSL_CERT', null);
// Mysql SSL CA
define('DB_SSL_CA', null);
?>
{{- end -}}

View File

@ -78,3 +78,19 @@ config:
duration: 0
# -- Session handler: db or php
handler: db
# -- Bitnami postgres chart. For more options see https://github.com/bitnami/charts/tree/master/bitnami/postgresql
postgresql:
# -- true: use bitnami postgres instance
# -- false: use your own postgres instance
enabled: false
# -- Postgres database user name
postgresqlUsername: kanboard
# -- Postgres database password
postgresqlPassword: kanboard
# -- Postgres database password
postgresqlDatabase: kanboard
persistence:
# -- if database is stored to a PVC. Set to true when you are done testing.
enabled: false
# storageClass: ""