From 802ee07407fef4d5fe3013e5c51eb17d41a59e91 Mon Sep 17 00:00:00 2001 From: Travis Lyons Date: Mon, 15 Mar 2021 20:37:55 -0400 Subject: [PATCH] [kanboard] Add postgresql support (#680) * [kanboard] Add postgresql support Signed-off-by: Travis Lyons * Fix volume add logic Only add config volume to manifests if postgresql is enabled. Signed-off-by: Travis Lyons --- charts/kanboard/Chart.yaml | 6 +++- charts/kanboard/README.md | 17 ++++++++++- charts/kanboard/README_CHANGELOG.md.gotmpl | 8 ++++++ charts/kanboard/templates/common.yaml | 28 +++++++++++++++++- charts/kanboard/templates/config.yaml | 33 ++++++++++++++++++++++ charts/kanboard/values.yaml | 16 +++++++++++ 6 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 charts/kanboard/templates/config.yaml diff --git a/charts/kanboard/Chart.yaml b/charts/kanboard/Chart.yaml index 2752f265..fb903ea7 100644 --- a/charts/kanboard/Chart.yaml +++ b/charts/kanboard/Chart.yaml @@ -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 diff --git a/charts/kanboard/README.md b/charts/kanboard/README.md index e0e879a0..7a6fb3fb 100644 --- a/charts/kanboard/README.md +++ b/charts/kanboard/README.md @@ -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 diff --git a/charts/kanboard/README_CHANGELOG.md.gotmpl b/charts/kanboard/README_CHANGELOG.md.gotmpl index a9ec1eae..2de88a67 100644 --- a/charts/kanboard/README_CHANGELOG.md.gotmpl +++ b/charts/kanboard/README_CHANGELOG.md.gotmpl @@ -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 diff --git a/charts/kanboard/templates/common.yaml b/charts/kanboard/templates/common.yaml index 7540bb32..4ee2c515 100644 --- a/charts/kanboard/templates/common.yaml +++ b/charts/kanboard/templates/common.yaml @@ -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" . }} \ No newline at end of file +{{ include "common.all" . }} diff --git a/charts/kanboard/templates/config.yaml b/charts/kanboard/templates/config.yaml new file mode 100644 index 00000000..fc1d3f3c --- /dev/null +++ b/charts/kanboard/templates/config.yaml @@ -0,0 +1,33 @@ +{{- if .Values.postgresql.enabled -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "kanboard.fullname" . }}-config +stringData: + config.php: | + +{{- end -}} diff --git a/charts/kanboard/values.yaml b/charts/kanboard/values.yaml index 5ffddb1d..b8ca527a 100644 --- a/charts/kanboard/values.yaml +++ b/charts/kanboard/values.yaml @@ -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: ""