From 01ca4d7da14b2089c2eb64a957a02133ec261a9b Mon Sep 17 00:00:00 2001
From: Andrew Zammit <zammit.andrew@gmail.com>
Date: Wed, 23 Jun 2021 02:25:47 -0700
Subject: [PATCH] [unifi-poller] update to common@3.2.0 and unifi-poller@2.1.3
 (#1043)

* [unifi-poller] update to common@3.2.0 and unifi-poller@2.1.3

Signed-off-by: Andrew Zammit <zammit.andrew@gmail.com>
---
 charts/stable/unifi-poller/Chart.yaml         |  6 +--
 charts/stable/unifi-poller/README.md          | 42 +++++++++---------
 .../unifi-poller/README_CHANGELOG.md.gotmpl   |  9 ++--
 charts/stable/unifi-poller/values.yaml        | 44 ++++++++++++++-----
 4 files changed, 63 insertions(+), 38 deletions(-)

diff --git a/charts/stable/unifi-poller/Chart.yaml b/charts/stable/unifi-poller/Chart.yaml
index 056467de..81891b57 100644
--- a/charts/stable/unifi-poller/Chart.yaml
+++ b/charts/stable/unifi-poller/Chart.yaml
@@ -1,8 +1,8 @@
 apiVersion: v2
-appVersion: 2.0.1
+appVersion: 2.1.3
 description: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
 name: unifi-poller
-version: 7.4.0
+version: 8.0.0
 kubeVersion: ">=1.16.0-0"
 keywords:
 - unifi
@@ -18,7 +18,7 @@ maintainers:
 dependencies:
 - name: common
   repository: https://library-charts.k8s-at-home.com
-  version: 2.5.0
+  version: 3.2.0
 - name: influxdb
   version: 1.1.9
   repository: https://charts.bitnami.com/bitnami
diff --git a/charts/stable/unifi-poller/README.md b/charts/stable/unifi-poller/README.md
index 45a02ec9..9170148f 100644
--- a/charts/stable/unifi-poller/README.md
+++ b/charts/stable/unifi-poller/README.md
@@ -1,6 +1,6 @@
 # unifi-poller
 
-![Version: 7.4.0](https://img.shields.io/badge/Version-7.4.0-informational?style=flat-square) ![AppVersion: 2.0.1](https://img.shields.io/badge/AppVersion-2.0.1-informational?style=flat-square)
+![Version: 8.0.0](https://img.shields.io/badge/Version-8.0.0-informational?style=flat-square) ![AppVersion: 2.1.3](https://img.shields.io/badge/AppVersion-2.1.3-informational?style=flat-square)
 
 Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
 
@@ -20,7 +20,7 @@ Kubernetes: `>=1.16.0-0`
 | Repository | Name | Version |
 |------------|------|---------|
 | https://charts.bitnami.com/bitnami | influxdb | 1.1.9 |
-| https://library-charts.k8s-at-home.com | common | 2.5.0 |
+| https://library-charts.k8s-at-home.com | common | 3.2.0 |
 
 ## TL;DR
 
@@ -77,21 +77,21 @@ N/A
 
 | Key | Type | Default | Description |
 |-----|------|---------|-------------|
-| env | object | `{}` |  |
-| image.pullPolicy | string | `"IfNotPresent"` |  |
-| image.repository | string | `"golift/unifi-poller"` |  |
-| image.tag | string | `"2.0.1"` |  |
-| influxdb.architecture | string | `"standalone"` |  |
-| influxdb.authEnabled | bool | `false` |  |
-| influxdb.database | string | `"unifi_poller"` |  |
-| influxdb.enabled | bool | `false` |  |
-| influxdb.persistence.enabled | bool | `false` |  |
-| ingress.enabled | bool | `false` |  |
-| prometheus.serviceMonitor.additionalLabels | object | `{}` |  |
-| prometheus.serviceMonitor.enabled | bool | `false` |  |
-| prometheus.serviceMonitor.interval | string | `"1m"` |  |
-| service.port.port | int | `9130` |  |
-| strategy.type | string | `"Recreate"` |  |
+| env | object | `{}` | Environment variable configuration options for unifi-poller ([docs](https://unifipoller.com/docs/install/configuration)).    Note: a [configuration file](https://github.com/unifi-poller/unifi-poller/blob/master/examples/up.conf.example) is also supported. |
+| image.pullPolicy | string | `"IfNotPresent"` | Image [k8s pull policy](https://kubernetes.io/docs/concepts/containers/images/#updating-images). |
+| image.repository | string | `"golift/unifi-poller"` | Image to deploy. |
+| image.tag | string | `"2.1.3"` | Image tag to deploy. |
+| influxdb.architecture | string | `"standalone"` | InfluxDB cluster deployment architecture. |
+| influxdb.authEnabled | bool | `false` | Enable InfluxDB authentication, supported by unifi-poller.    Be sure to match in unifi-poller's [influxdb config](https://unifipoller.com/docs/install/configuration#influxdb). |
+| influxdb.database | string | `"unifi"` | Database name to automatically initialize.    Be sure to match in unifi-poller's [influxdb config](https://unifipoller.com/docs/install/configuration#influxdb). |
+| influxdb.enabled | bool | `false` | Create an InfluxDB instance as a [unifi-poller storage backend](https://unifipoller.com/docs/dependencies/influxdb).    See [bitnami/influxdb](https://github.com/bitnami/charts/tree/master/bitnami/influxdb) for more options. |
+| influxdb.persistence.enabled | bool | `false` | Enable persistence to store in a PV so data survives pod restarts. |
+| ingress.main.enabled | bool | `false` | Expose [unifi-poller's web interface](https://unifipoller.com/docs/advanced/webserver)    (if enabled in the configuration) via the k8s ingress by setting this true. |
+| prometheus.serviceMonitor.additionalLabels | object | `{}` | More labels to add to the ServiceMonitor resource. |
+| prometheus.serviceMonitor.enabled | bool | `false` | Create a [ServiceMonitor](https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/design.md#servicemonitor)    for the [unifi-poller prometheus exporter](https://unifipoller.com/docs/dependencies/prometheus)    that is recognized by [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator).    This gets created in this chart's namespace. Note: this only creates a ServiceMonitor, not a prometheus instance. |
+| prometheus.serviceMonitor.interval | string | `"1m"` | Prometheus [endpoint polling interval](https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint)    for this ServiceMonitor (how often unifi-poller will be queried). |
+| service.main.ports.http.port | int | `9130` | The port this prometheus exporter will listen on ([registered as 9130](https://github.com/prometheus/prometheus/wiki/Default-port-allocations)).    This should match unifi-poller's [configured listen port](https://unifipoller.com/docs/install/configuration#prometheus). |
+| strategy | string | `"Recreate"` | [Deployment strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) used to replace old Pods by new ones. |
 
 ## Changelog
 
@@ -99,7 +99,7 @@ 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.0.0]
+### [8.0.0]
 
 #### Added
 
@@ -107,13 +107,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 
 #### Changed
 
-- N/A
+- Upgrades unifi-poller dependency: k8s-at-home common library from version 2.5.0 to version 3.2.0 - BREAKING CHANGE
+- Change the default influxdb database name to match unifi-poller's default - BREAKING CHANGE
+- Updates default unifi-poller version from 2.0.1 to 2.1.3
 
 #### Removed
 
 - N/A
 
-[1.0.0]: #1.0.0
+[8.0.0]: https://github.com/k8s-at-home/charts/compare/unifi-poller-7.4.0...unifi-poller-8.0.0
 
 ## Support
 
diff --git a/charts/stable/unifi-poller/README_CHANGELOG.md.gotmpl b/charts/stable/unifi-poller/README_CHANGELOG.md.gotmpl
index 457def03..186e15d1 100644
--- a/charts/stable/unifi-poller/README_CHANGELOG.md.gotmpl
+++ b/charts/stable/unifi-poller/README_CHANGELOG.md.gotmpl
@@ -9,7 +9,7 @@ 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.0.0]
+### [8.0.0]
 
 #### Added
 
@@ -17,11 +17,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 
 #### Changed
 
-- N/A
+- **BREAKING**: Upgraded the common library dependency to version 3.2.0. This introduces several breaking changes (`service`, `ingress` and `persistence` keys have been refactored).
+   Be sure to check out the [library chart](https://github.com/k8s-at-home/library-charts/blob/common-3.2.0/charts/stable/common/) for the up-to-date values.
+- Change the default influxdb database name to match unifi-poller's default - BREAKING CHANGE
+- Updates default unifi-poller version from 2.0.1 to 2.1.3
 
 #### Removed
 
 - N/A
 
-[1.0.0]: #1.0.0
+[8.0.0]: https://github.com/k8s-at-home/charts/compare/unifi-poller-7.4.0...unifi-poller-8.0.0
 {{- end -}}
diff --git a/charts/stable/unifi-poller/values.yaml b/charts/stable/unifi-poller/values.yaml
index 3085fb4b..84326fd4 100644
--- a/charts/stable/unifi-poller/values.yaml
+++ b/charts/stable/unifi-poller/values.yaml
@@ -6,15 +6,16 @@
 #
 
 image:
+  # -- Image to deploy.
   repository: golift/unifi-poller
+  # -- Image [k8s pull policy](https://kubernetes.io/docs/concepts/containers/images/#updating-images).
   pullPolicy: IfNotPresent
-  tag: 2.0.1
+  # -- Image tag to deploy.
+  tag: 2.1.3
 
-strategy:
-  type: Recreate
 
-# # See more environment varaibles in the unifi-poller documentation
-# https://github.com/unifi-poller/unifi-poller/wiki/Configuration
+# -- Environment variable configuration options for unifi-poller ([docs](https://unifipoller.com/docs/install/configuration)).
+#    Note: a [configuration file](https://github.com/unifi-poller/unifi-poller/blob/master/examples/up.conf.example) is also supported.
 env: {}
   # TZ: UTC
   # UP_UNIFI_DEFAULT_URL: "https://127.0.0.1:8443"
@@ -24,27 +25,46 @@ env: {}
   # UP_INFLUXDB_DISABLE: true
 
 service:
-  port:
-    port: 9130
+  main:
+    ports:
+      http:
+        # -- The port this prometheus exporter will listen on ([registered as 9130](https://github.com/prometheus/prometheus/wiki/Default-port-allocations)).
+        #    This should match unifi-poller's [configured listen port](https://unifipoller.com/docs/install/configuration#prometheus).
+        port: 9130
 
 ingress:
-  enabled: false
+  main:
+    # -- Expose [unifi-poller's web interface](https://unifipoller.com/docs/advanced/webserver)
+    #    (if enabled in the configuration) via the k8s ingress by setting this true.
+    enabled: false
 
-# enable a prometheus-operator servicemonitor
 prometheus:
   serviceMonitor:
+    # -- Create a [ServiceMonitor](https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/design.md#servicemonitor)
+    #    for the [unifi-poller prometheus exporter](https://unifipoller.com/docs/dependencies/prometheus)
+    #    that is recognized by [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator).
+    #    This gets created in this chart's namespace. Note: this only creates a ServiceMonitor, not a prometheus instance.
     enabled: false
+    # -- Prometheus [endpoint polling interval](https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint)
+    #    for this ServiceMonitor (how often unifi-poller will be queried).
     interval: 1m
+    # -- More labels to add to the ServiceMonitor resource.
     additionalLabels: {}
 
-# Enable influxdb
-# ... for more options see https://github.com/bitnami/charts/tree/master/bitnami/influxdb
 influxdb:
+  # -- Create an InfluxDB instance as a [unifi-poller storage backend](https://unifipoller.com/docs/dependencies/influxdb).
+  #    See [bitnami/influxdb](https://github.com/bitnami/charts/tree/master/bitnami/influxdb) for more options.
   enabled: false
+  # -- InfluxDB cluster deployment architecture.
   architecture: standalone
-  database: unifi_poller
+  # -- Database name to automatically initialize.
+  #    Be sure to match in unifi-poller's [influxdb config](https://unifipoller.com/docs/install/configuration#influxdb).
+  database: unifi
+  # -- Enable InfluxDB authentication, supported by unifi-poller.
+  #    Be sure to match in unifi-poller's [influxdb config](https://unifipoller.com/docs/install/configuration#influxdb).
   authEnabled: false
   persistence:
+    # -- Enable persistence to store in a PV so data survives pod restarts.
     enabled: false
     # storageClass: ""
     # size: 8Gi