[unifi] Updated AppVersion to 6.0.45 (#705)

* Updated AppVersion to 6.0.45
Modified the Ingress definitions to use the latest Ingress spec (networking.k8s.io/v1) for clusters 1.18+ and the beta spec (networking.k8s.io/v1beta1) 1.14+.  Otherwise, continue using extensions/v1beta1

* Moved Labels and Selector Labels to _helpers (in following latest helm guidelines) and fixed ingress templates

* Modified logic in the ingress templates to reduce some of the nesting

Co-authored-by: ᗪєνιη ᗷυнʟ <onedr0p@users.noreply.github.com>
This commit is contained in:
Matt Gerega 2021-03-24 03:38:32 -04:00 committed by GitHub
parent 1eaf501196
commit 3a78db20ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 92 additions and 28 deletions

View File

@ -1,8 +1,8 @@
apiVersion: v2 apiVersion: v2
appVersion: 5.14.23 appVersion: 6.0.45
description: Ubiquiti Network's Unifi Controller description: Ubiquiti Network's Unifi Controller
name: unifi name: unifi
version: 1.5.4 version: 1.5.5
keywords: keywords:
- ubiquiti - ubiquiti
- unifi - unifi

View File

@ -30,3 +30,23 @@ Create chart name and version as used by the chart label.
{{- define "unifi.chart" -}} {{- define "unifi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/*
Common labels
*/}}
{{- define "unifi.labels" -}}
helm.sh/chart: {{ include "unifi.chart" . }}
{{ include "unifi.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "unifi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@ -3,7 +3,13 @@
{{- $ingressPath := .Values.captivePortalService.ingress.path -}} {{- $ingressPath := .Values.captivePortalService.ingress.path -}}
{{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}} {{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}}
{{- $captivePortalHttps := .Values.captivePortalService.https -}} {{- $captivePortalHttps := .Values.captivePortalService.https -}}
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }}-captive name: {{ $fullName }}-captive
@ -28,17 +34,31 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.captivePortalService.ingress.hosts }} {{- range .Values.captivePortalService.ingress.hosts }}
- host: {{ . }} - host: {{ . }}
http: http:
paths: paths:
- path: {{ $ingressPath }} - path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend: backend:
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-captiveportalservice
port:
{{- if $captivePortalHttps }}
name: captive-https
{{- else }}
name: captive-http
{{- end }}
{{- else }}
serviceName: {{ $fullName }}-captiveportalservice serviceName: {{ $fullName }}-captiveportalservice
{{- if $captivePortalHttps }} {{- if $captivePortalHttps }}
servicePort: captive-https servicePort: captive-https
{{- else }} {{- else }}
servicePort: captive-http servicePort: captive-http
{{- end }} {{- end }}
{{- end }} {{- end -}}
{{- end }}
{{- end }} {{- end }}

View File

@ -56,6 +56,5 @@ spec:
nodePort: {{.Values.captivePortalService.https}} nodePort: {{.Values.captivePortalService.https}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 6 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -2,7 +2,13 @@
{{- $fullName := include "unifi.fullname" . -}} {{- $fullName := include "unifi.fullname" . -}}
{{- $ingressPath := .Values.controllerService.ingress.path -}} {{- $ingressPath := .Values.controllerService.ingress.path -}}
{{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}} {{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}}
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }}-controller name: {{ $fullName }}-controller
@ -32,8 +38,18 @@ spec:
http: http:
paths: paths:
- path: {{ $ingressPath }} - path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend: backend:
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-controller
port:
name: controller
{{- else -}}
serviceName: {{ $fullName }}-controller serviceName: {{ $fullName }}-controller
servicePort: controller servicePort: controller
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.controllerService.nodePort}} nodePort: {{.Values.controllerService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -19,8 +19,7 @@ spec:
type: {{ .Values.strategyType }} type: {{ .Values.strategyType }}
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 6 }}
app.kubernetes.io/instance: {{ .Release.Name }}
template: template:
metadata: metadata:
labels: labels:

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.discoveryService.nodePort}} nodePort: {{.Values.discoveryService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.guiService.nodePort}} nodePort: {{.Values.guiService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -2,19 +2,22 @@
{{- $fullName := include "unifi.fullname" . -}} {{- $fullName := include "unifi.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}} {{- $ingressPath := .Values.ingress.path -}}
{{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}} {{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}}
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }} name: {{ $fullName }}
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 }}
{{- with .Values.ingress.annotations }} {{- with .Values.ingress.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{ toYaml . | indent 4 }}
{{- end }} {{- end }}
labels:
{{- include "unifi.labels" . | nindent 4 }}
spec: spec:
{{- if .Values.ingress.tls }} {{- if .Values.ingress.tls }}
tls: tls:
@ -27,17 +30,31 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.hosts }}
- host: {{ . }} - host: {{ . }}
http: http:
paths: paths:
- path: {{ $ingressPath }} - path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend: backend:
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
service:
{{- if $unifiedServiceEnabled }}
name: {{ $fullName }}
{{- else }}
name: {{ $fullName }}-gui
{{- end }}
port:
name: https-gui
{{- else -}}
{{- if $unifiedServiceEnabled }} {{- if $unifiedServiceEnabled }}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
{{- else }} {{- else }}
serviceName: {{ $fullName }}-gui serviceName: {{ $fullName }}-gui
{{- end }} {{- end }}
servicePort: https-gui servicePort: https-gui
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.speedtestService.nodePort}} nodePort: {{.Values.speedtestService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.stunService.nodePort}} nodePort: {{.Values.stunService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -49,6 +49,5 @@ spec:
nodePort: {{.Values.syslogService.nodePort}} nodePort: {{.Values.syslogService.nodePort}}
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}

View File

@ -101,7 +101,6 @@ spec:
{{ end }} {{ end }}
selector: selector:
app.kubernetes.io/name: {{ include "unifi.name" . }} {{- include "unifi.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }} {{ end }}