[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
appVersion: 5.14.23
appVersion: 6.0.45
description: Ubiquiti Network's Unifi Controller
name: unifi
version: 1.5.4
version: 1.5.5
keywords:
- ubiquiti
- unifi

View File

@ -30,3 +30,23 @@ Create chart name and version as used by the chart label.
{{- define "unifi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- 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 -}}
{{- $unifiedServiceEnabled := .Values.unifiedService.enabled -}}
{{- $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
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-captive
@ -33,12 +39,26 @@ spec:
http:
paths:
- path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
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
{{- if $captivePortalHttps }}
servicePort: captive-https
{{- else }}
servicePort: captive-http
{{- end }}
{{- end -}}
{{- end }}
{{- end }}

View File

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

View File

@ -2,7 +2,13 @@
{{- $fullName := include "unifi.fullname" . -}}
{{- $ingressPath := .Values.controllerService.ingress.path -}}
{{- $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
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-controller
@ -32,8 +38,18 @@ spec:
http:
paths:
- path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend:
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-controller
port:
name: controller
{{- else -}}
serviceName: {{ $fullName }}-controller
servicePort: controller
{{- end }}
{{- end }}
{{- end }}

View File

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

View File

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

View File

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

View File

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

View File

@ -2,19 +2,22 @@
{{- $fullName := include "unifi.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $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
{{- end }}
kind: Ingress
metadata:
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 }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
labels:
{{- include "unifi.labels" . | nindent 4 }}
spec:
{{- if .Values.ingress.tls }}
tls:
@ -32,12 +35,26 @@ spec:
http:
paths:
- path: {{ $ingressPath }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
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 }}
serviceName: {{ $fullName }}
{{- else }}
serviceName: {{ $fullName }}-gui
{{- end }}
servicePort: https-gui
{{- end -}}
{{- end }}
{{- end }}

View File

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

View File

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

View File

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

View File

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