diff --git a/charts/unifi-controller/Chart.yaml b/charts/unifi-controller/Chart.yaml index c043944..6509dc5 100644 --- a/charts/unifi-controller/Chart.yaml +++ b/charts/unifi-controller/Chart.yaml @@ -13,6 +13,6 @@ maintainers: - name: David GirĂ³n url: https://github.com/duhow -version: 0.0.4 +version: 0.1.0 # renovate: datasource=docker depName=linuxserver/unifi-controller appVersion: 7.3.83 diff --git a/charts/unifi-controller/templates/service-lb.yaml b/charts/unifi-controller/templates/service-lb.yaml new file mode 100644 index 0000000..d3346e3 --- /dev/null +++ b/charts/unifi-controller/templates/service-lb.yaml @@ -0,0 +1,80 @@ +{{- if eq .Values.service.type "LoadBalancer" }} + +{{- $proto := "tcp" }} +{{- $hasServicesEnabled := false }} +{{- range $svc, $data := get .Values.service.ports $proto }} +{{- if $data.enabled }} +{{- $hasServicesEnabled = true }} +{{- end }} +{{- end }} + +{{- if $hasServicesEnabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "unifi.fullname" . }}-{{ $proto }} + labels: + {{- include "unifi.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- with .Values.service.loadBalancerIP }} + loadBalancerIP: {{ . | quote }} + {{- end }} + ports: + {{- range $svc, $data := get .Values.service.ports $proto }} + {{- if $data.enabled }} + - name: {{ $svc }} + port: {{ $data.port }} + protocol: {{ $proto | upper }} + targetPort: {{ $svc }} + {{- end }} + {{- end }} + selector: + {{- include "unifi.selectorLabels" . | nindent 4 }} +{{- end }} + + +{{- $proto := "udp" }} +{{- $hasServicesEnabled := false }} +{{- range $svc, $data := get .Values.service.ports $proto }} +{{- if $data.enabled }} +{{- $hasServicesEnabled = true }} +{{- end }} +{{- end }} + +{{- if $hasServicesEnabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "unifi.fullname" . }}-{{ $proto }} + labels: + {{- include "unifi.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + {{- with .Values.service.loadBalancerIP }} + loadBalancerIP: {{ . | quote }} + {{- end }} + ports: + {{- range $svc, $data := get .Values.service.ports $proto }} + {{- if $data.enabled }} + - name: {{ $svc }} + port: {{ $data.port }} + protocol: {{ $proto | upper }} + targetPort: {{ $svc }} + {{- end }} + {{- end }} + selector: + {{- include "unifi.selectorLabels" . | nindent 4 }} +{{- end }} + +{{- end }} diff --git a/charts/unifi-controller/templates/service.yaml b/charts/unifi-controller/templates/service.yaml index 999dabe..e03a38f 100644 --- a/charts/unifi-controller/templates/service.yaml +++ b/charts/unifi-controller/templates/service.yaml @@ -1,9 +1,15 @@ +{{- if ne .Values.service.type "LoadBalancer" }} +--- apiVersion: v1 kind: Service metadata: name: {{ include "unifi.fullname" . }} labels: {{- include "unifi.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: @@ -13,3 +19,4 @@ spec: name: http selector: {{- include "unifi.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/charts/unifi-controller/values.yaml b/charts/unifi-controller/values.yaml index 03ec3c7..5c0c20f 100644 --- a/charts/unifi-controller/values.yaml +++ b/charts/unifi-controller/values.yaml @@ -30,7 +30,40 @@ hostNetwork: true service: type: ClusterIP + annotations: {} + loadBalancerIP: null port: 8443 + # -- Used for LoadBalancer Service type + ports: + tcp: + https: + enabled: true + port: 8443 + http: + enabled: false + port: 8080 + guest-https: + enabled: false + port: 8843 + guest-http: + enabled: false + port: 8880 + throughput: + enabled: false + port: 6789 + udp: + stun: + enabled: false + port: 3478 + l2-discovery: + enabled: false + port: 1900 + ap-discovery: + enabled: false + port: 10001 + syslog: + enabled: false + port: 5514 ingress: enabled: false