diff --git a/charts/stable/unifi/Chart.yaml b/charts/stable/unifi/Chart.yaml index 439533e1..e9d6bb8d 100644 --- a/charts/stable/unifi/Chart.yaml +++ b/charts/stable/unifi/Chart.yaml @@ -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 diff --git a/charts/stable/unifi/templates/_helpers.tpl b/charts/stable/unifi/templates/_helpers.tpl index 1c11a45f..cb030c3a 100644 --- a/charts/stable/unifi/templates/_helpers.tpl +++ b/charts/stable/unifi/templates/_helpers.tpl @@ -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 }} \ No newline at end of file diff --git a/charts/stable/unifi/templates/captive-ingress.yaml b/charts/stable/unifi/templates/captive-ingress.yaml index 8a687aed..18ba2099 100644 --- a/charts/stable/unifi/templates/captive-ingress.yaml +++ b/charts/stable/unifi/templates/captive-ingress.yaml @@ -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 @@ -28,17 +34,31 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.captivePortalService.ingress.hosts }} + {{- range .Values.captivePortalService.ingress.hosts }} - host: {{ . }} 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 }} {{- end }} diff --git a/charts/stable/unifi/templates/captive-svc.yaml b/charts/stable/unifi/templates/captive-svc.yaml index 9f651d6a..81e0b144 100644 --- a/charts/stable/unifi/templates/captive-svc.yaml +++ b/charts/stable/unifi/templates/captive-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/controller-ingress.yaml b/charts/stable/unifi/templates/controller-ingress.yaml index a0234af0..9868c9aa 100644 --- a/charts/stable/unifi/templates/controller-ingress.yaml +++ b/charts/stable/unifi/templates/controller-ingress.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/controller-svc.yaml b/charts/stable/unifi/templates/controller-svc.yaml index 2fe7076a..ca3dc9a7 100644 --- a/charts/stable/unifi/templates/controller-svc.yaml +++ b/charts/stable/unifi/templates/controller-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/deployment.yaml b/charts/stable/unifi/templates/deployment.yaml index cfeff1b4..d945d408 100644 --- a/charts/stable/unifi/templates/deployment.yaml +++ b/charts/stable/unifi/templates/deployment.yaml @@ -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: diff --git a/charts/stable/unifi/templates/discovery-svc.yaml b/charts/stable/unifi/templates/discovery-svc.yaml index 870748cd..8567d62b 100644 --- a/charts/stable/unifi/templates/discovery-svc.yaml +++ b/charts/stable/unifi/templates/discovery-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/gui-svc.yaml b/charts/stable/unifi/templates/gui-svc.yaml index 9f145318..da260214 100644 --- a/charts/stable/unifi/templates/gui-svc.yaml +++ b/charts/stable/unifi/templates/gui-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/ingress.yaml b/charts/stable/unifi/templates/ingress.yaml index b079cb3b..9e83650a 100644 --- a/charts/stable/unifi/templates/ingress.yaml +++ b/charts/stable/unifi/templates/ingress.yaml @@ -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: @@ -27,17 +30,31 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} + {{- range .Values.ingress.hosts }} - host: {{ . }} 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 }} diff --git a/charts/stable/unifi/templates/speedtest-svc.yaml b/charts/stable/unifi/templates/speedtest-svc.yaml index 19319ac3..f59f1f73 100644 --- a/charts/stable/unifi/templates/speedtest-svc.yaml +++ b/charts/stable/unifi/templates/speedtest-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/stun-svc.yaml b/charts/stable/unifi/templates/stun-svc.yaml index 45819bc3..bd766eef 100644 --- a/charts/stable/unifi/templates/stun-svc.yaml +++ b/charts/stable/unifi/templates/stun-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/syslog-svc.yaml b/charts/stable/unifi/templates/syslog-svc.yaml index 2c3c1416..460d7fed 100644 --- a/charts/stable/unifi/templates/syslog-svc.yaml +++ b/charts/stable/unifi/templates/syslog-svc.yaml @@ -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 }} diff --git a/charts/stable/unifi/templates/unified-svc.yaml b/charts/stable/unifi/templates/unified-svc.yaml index ad6ec943..aab4c4eb 100644 --- a/charts/stable/unifi/templates/unified-svc.yaml +++ b/charts/stable/unifi/templates/unified-svc.yaml @@ -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 }}