[unifi] Reimplement external MongoDB (#1113)

* Reimplement external MongoDB
* fix PVC mountPath for backwards compatibility

Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2021-08-06 11:34:00 +02:00 committed by GitHub
parent d80eeedd4c
commit fe6403318e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 89 additions and 3 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v6.2.26
description: Ubiquiti Network's Unifi Controller
name: unifi
version: 3.0.0
version: 3.1.0
keywords:
- ubiquiti
- unifi
@ -19,3 +19,7 @@ dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 3.3.0
- name: mongodb
version: 10.23.9
repository: https://charts.bitnami.com/bitnami
condition: mongodb.enabled

View File

@ -1,6 +1,6 @@
# unifi
![Version: 3.0.0](https://img.shields.io/badge/Version-3.0.0-informational?style=flat-square) ![AppVersion: v6.2.26](https://img.shields.io/badge/AppVersion-v6.2.26-informational?style=flat-square)
![Version: 3.1.0](https://img.shields.io/badge/Version-3.1.0-informational?style=flat-square) ![AppVersion: v6.2.26](https://img.shields.io/badge/AppVersion-v6.2.26-informational?style=flat-square)
Ubiquiti Network's Unifi Controller
@ -16,6 +16,7 @@ Ubiquiti Network's Unifi Controller
| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | mongodb | 10.23.9 |
| https://library-charts.k8s-at-home.com | common | 3.3.0 |
## TL;DR
@ -65,6 +66,21 @@ helm install unifi k8s-at-home/unifi -f values.yaml
## Custom configuration
### Running with separate MongoDB
By default the Unifi controller runs an internal MongoDB.
If you wish to run the chart with a separate MongoDB instance our chart provides the option to enable a MongoDB instance by adding the following in your `values.yaml`:
```yaml
mongodb:
enabled: true
```
(For more configuration options see the [mongodb chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/mongodb).)
If you do not specify any other configuration, the required environment variables will be inferred automatically.
It is also possible to override the environment variables to configure the image. See [here](https://github.com/jacobalberty/unifi-docker#external-mongodb-environment-variables) for more details.
### Regarding the services
By default it is not possible to combine TCP and UDP ports on a service with `type: LoadBalancer`. This can be solved in a number of ways:
@ -115,6 +131,7 @@ service:
| image.tag | string | `"v6.2.26"` | image tag |
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| ingress.portal | object | See values.yaml | Enable and configure settings for the captive portal ingress under this key. |
| mongodb | object | See values.yaml | Enable and configure mongodb database subchart under this key. For more options see [mongodb chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/mongodb) |
| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. |
| service | object | See values.yaml | Configures service settings for the chart. |
| service.main.ports.controller | object | See values.yaml | Configure Controller port used for device command/control |
@ -132,6 +149,16 @@ 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).
### [3.1.0]
#### Added
- Support for running with an external MongoDB instance has been reimplemented.
#### Fixed
- The chart is now compatible again with PVC's that were created with chart versions < 3.0.0.
### [3.0.0]
#### Changed

View File

@ -9,6 +9,16 @@ 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).
### [3.1.0]
#### Added
- Support for running with an external MongoDB instance has been reimplemented.
#### Fixed
- The chart is now compatible again with PVC's that were created with chart versions < 3.0.0.
### [3.0.0]
#### Changed

View File

@ -5,6 +5,21 @@
{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}
### Running with separate MongoDB
By default the Unifi controller runs an internal MongoDB.
If you wish to run the chart with a separate MongoDB instance our chart provides the option to enable a MongoDB instance by adding the following in your `values.yaml`:
```yaml
mongodb:
enabled: true
```
(For more configuration options see the [mongodb chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/mongodb).)
If you do not specify any other configuration, the required environment variables will be inferred automatically.
It is also possible to override the environment variables to configure the image. See [here](https://github.com/jacobalberty/unifi-docker#external-mongodb-environment-variables) for more details.
### Regarding the services
By default it is not possible to combine TCP and UDP ports on a service with `type: LoadBalancer`. This can be solved in a number of ways:

View File

View File

@ -0,0 +1,2 @@
mongodb:
enabled: true

View File

@ -4,6 +4,17 @@
{{- define "unifi.harcodedValues" -}}
env:
UNIFI_STDOUT: "true"
{{- if .Values.mongodb.enabled }}
{{- if not .Values.env.DB_URI }}
DB_URI: mongodb://{{ .Release.Name }}-mongodb:27017/unifi
{{- end }}
{{- if not .Values.env.STATDB_URI }}
STATDB_URI: mongodb://{{ .Release.Name }}-mongodb:27017/unifi_stat
{{- end }}
{{- if not .Values.env.DB_NAME }}
DB_NAME: unifi
{{- end }}
{{- end }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "unifi.harcodedValues" . | fromYaml) -}}

View File

@ -31,6 +31,10 @@ env:
# For larger installations a larger value is recommended.
# For memory constrained system this value can be lowered.
JVM_MAX_HEAP_SIZE: 1024M
# # -- External MongoDB URI
# DB_URI: # mongodb://unifi-mongodb:27017/unifi
# STATDB_URI: # mongodb://unifi-mongodb:27017/unifi_stat
# DB_NAME: # unifi
# -- Configures service settings for the chart.
# @default -- See values.yaml
@ -123,4 +127,17 @@ ingress:
persistence:
data:
enabled: false
mountPath: /unifi/data
mountPath: /unifi
# -- Enable and configure mongodb database subchart under this key.
# For more options see [mongodb chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/mongodb)
# @default -- See values.yaml
mongodb:
enabled: false
architecture: standalone
auth:
enabled: false
persistence:
enabled: false
# storageClass: ""
# size: 8Gi