From b91e6c69d7291a66de8de5a2aeffa014ec9772b2 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Sat, 14 Nov 2020 19:55:11 +0000 Subject: [PATCH] [unifi] add speedtest service and update to 5.14.23 (#148) * add speedtest service and update to 5.14.23 * forgot speedtest in unified service Co-authored-by: Jeff Billimek --- charts/unifi/Chart.yaml | 4 +- charts/unifi/README.md | 13 +++++- charts/unifi/templates/deployment.yaml | 3 ++ charts/unifi/templates/speedtest-svc.yaml | 54 +++++++++++++++++++++++ charts/unifi/templates/unified-svc.yaml | 7 +++ charts/unifi/values.yaml | 23 +++++++++- 6 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 charts/unifi/templates/speedtest-svc.yaml diff --git a/charts/unifi/Chart.yaml b/charts/unifi/Chart.yaml index 350ed58e..2367aa4a 100644 --- a/charts/unifi/Chart.yaml +++ b/charts/unifi/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 -appVersion: 5.12.35 +appVersion: 5.14.23 description: Ubiquiti Network's Unifi Controller name: unifi -version: 1.1.0 +version: 1.1.1 keywords: - ubiquiti - unifi diff --git a/charts/unifi/README.md b/charts/unifi/README.md index b34a6f6b..29670cb7 100644 --- a/charts/unifi/README.md +++ b/charts/unifi/README.md @@ -34,7 +34,7 @@ The following tables lists the configurable parameters of the Unifi chart and th | Parameter | Default | Description | |-------------------------------------------------|------------------------------|------------------------------------------------------------------------------------------------------------------------| | `image.repository` | `jacobalberty/unifi` | Image repository | -| `image.tag` | `5.12.35` | Image tag. Possible values listed [here][docker]. | +| `image.tag` | `5.14.23` | Image tag. Possible values listed [here][docker]. | | `image.pullPolicy` | `IfNotPresent` | Image pull policy | | `strategyType` | `Recreate` | Specifies the strategy used to replace old Pods by new ones | | `guiService.type` | `ClusterIP` | Kubernetes service type for the Unifi GUI | @@ -93,7 +93,14 @@ The following tables lists the configurable parameters of the Unifi chart and th | `syslogService.loadBalancerIP` | `{}` | Loadbalancer IP for remote syslog capture | | `syslogService.loadBalancerSourceRanges` | None | List of IP CIDRs allowed access to load balancer (if supported) | | `syslogService.externalTrafficPolicy` | `Cluster` | Set the externalTrafficPolicy in the Service to either Cluster or Local | -| `unifiedService.enabled` | `false` | Use a single service for GUI, controller, STUN, discovery and syslog | +| `speedtestService.type` | `ClusterIP` | Kubernetes service type for mobile speedtest | +| `speedtestService.port` | `6789` | Kubernetes UDP port for mobile speedtest | +| `speedtestService.annotations` | `{}` | Service annotations for mobile speedtest | +| `speedtestService.labels` | `{}` | Custom labels | +| `speedtestService.loadBalancerIP` | `{}` | Loadbalancer IP for mobile speedtest | +| `speedtestService.loadBalancerSourceRanges` | None | List of IP CIDRs allowed access to load balancer (if supported) | +| `speedtestService.externalTrafficPolicy` | `Cluster` | Set the externalTrafficPolicy in the Service to either Cluster or Local | +| `unifiedService.enabled` | `false` | Use a single service for GUI, controller, STUN, discovery, syslog and speedtest | | `unifiedService.type` | `ClusterIP` | Kubernetes service type for the unified service | | `unifiedService.annotations` | `{}` | Annotations for the unified service | | `unifiedService.labels` | `{}` | Custom labels for the unified service | @@ -178,6 +185,8 @@ Read through the [values.yaml](values.yaml) file. It has several commented out s - `syslogService`: Used to capture syslog from Unifi devices if the feature is enabled in the site configuration. This needs to be reachable by Unifi devices on port 5514/UDP. +- `speedtestService`: Used for mobile speedtest inside the UniFi Mobile app. + This needs to be reachable by clients connecting to port 6789/TCP. ## Ingress and HTTPS diff --git a/charts/unifi/templates/deployment.yaml b/charts/unifi/templates/deployment.yaml index 618734aa..5c9e833c 100644 --- a/charts/unifi/templates/deployment.yaml +++ b/charts/unifi/templates/deployment.yaml @@ -75,6 +75,9 @@ spec: - name: captive-https containerPort: 8843 protocol: TCP + - name: speedtest + containerPort: 6789 + protocol: TCP {{ end }} {{- if not .Values.runAsRoot }} securityContext: diff --git a/charts/unifi/templates/speedtest-svc.yaml b/charts/unifi/templates/speedtest-svc.yaml new file mode 100644 index 00000000..e63cbda0 --- /dev/null +++ b/charts/unifi/templates/speedtest-svc.yaml @@ -0,0 +1,54 @@ +{{ if not .Values.speedtestService.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "unifi.fullname" . }}-speedtest + labels: + app.kubernetes.io/name: {{ include "unifi.name" . }} + helm.sh/chart: {{ include "unifi.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.speedtestService.labels }} +{{ toYaml .Values.speedtestService.labels | indent 4 }} +{{- end }} +{{- with .Values.speedtestService.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.speedtestService.type "ClusterIP") (empty .Values.speedtestService.type)) }} + type: ClusterIP + {{- if .Values.speedtestService.clusterIP }} + clusterIP: {{ .Values.speedtestService.clusterIP }} + {{end}} +{{- else if eq .Values.speedtestService.type "LoadBalancer" }} + type: {{ .Values.speedtestService.type }} + {{- if .Values.speedtestService.loadBalancerIP }} + loadBalancerIP: {{ .Values.speedtestService.loadBalancerIP }} + {{- end }} + {{- if .Values.speedtestService.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.speedtestService.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.speedtestService.type }} +{{- end }} +{{- if .Values.speedtestService.externalIPs }} + externalIPs: +{{ toYaml .Values.speedtestService.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.speedtestService.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.speedtestService.externalTrafficPolicy }} + {{- end }} + ports: + - port: {{ .Values.speedtestService.port }} + targetPort: speedtest + protocol: TCP + name: speedtest +{{ if (and (eq .Values.speedtestService.type "NodePort") (not (empty .Values.speedtestService.nodePort))) }} + nodePort: {{.Values.speedtestService.nodePort}} +{{ end }} + selector: + app.kubernetes.io/name: {{ include "unifi.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{ end }} diff --git a/charts/unifi/templates/unified-svc.yaml b/charts/unifi/templates/unified-svc.yaml index db3793e5..ad6ec943 100644 --- a/charts/unifi/templates/unified-svc.yaml +++ b/charts/unifi/templates/unified-svc.yaml @@ -90,6 +90,13 @@ spec: targetPort: captive-https {{ if (and (eq .Values.unifiedService.type "NodePort") (not (empty .Values.captivePortalService.https))) }} nodePort: {{.Values.captivePortalService.https}} +{{ end }} + - port: {{ .Values.speedtestService.port }} + targetPort: speedtest + protocol: TCP + name: speedtest +{{ if (and (eq .Values.unifiedService.type "NodePort") (not (empty .Values.speedtestService.nodePort))) }} + nodePort: {{.Values.speedtestService.nodePort}} {{ end }} {{ end }} diff --git a/charts/unifi/values.yaml b/charts/unifi/values.yaml index cdc5491e..058d4ae6 100644 --- a/charts/unifi/values.yaml +++ b/charts/unifi/values.yaml @@ -7,7 +7,7 @@ strategyType: Recreate image: repository: jacobalberty/unifi - tag: 5.12.35 + tag: 5.14.23 pullPolicy: IfNotPresent # If enabled, the controller, discovery, GUI, STUN and syslog services will not be @@ -190,6 +190,27 @@ syslogService: ## Set the externalTrafficPolicy in the Service to either Cluster or Local # externalTrafficPolicy: Cluster +speedtestService: + type: ClusterIP + port: 6789 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + labels: {} + ## Use loadBalancerIP to request a specific static IP, + ## otherwise leave blank + ## + loadBalancerIP: + # loadBalancerSourceRanges: [] + ## Set the externalTrafficPolicy in the Service to either Cluster or Local + # externalTrafficPolicy: Cluster + ingress: enabled: false annotations: {}