fix(headscale-ui): improve networking

This commit is contained in:
WrenIX 2024-05-30 16:26:40 +02:00
parent 3d1999fd7a
commit 5cb8591591
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
7 changed files with 30 additions and 29 deletions

View file

@ -3,7 +3,7 @@ name: headscale-ui
description: A simple Headscale web UI for small-scale deployments. description: A simple Headscale web UI for small-scale deployments.
icon: https://raw.githubusercontent.com/gurucomputing/headscale-ui/master/static/favicon.png icon: https://raw.githubusercontent.com/gurucomputing/headscale-ui/master/static/favicon.png
type: application type: application
version: 0.1.4 version: 0.1.5
# renovate: image=ghcr.io/gurucomputing/headscale-ui # renovate: image=ghcr.io/gurucomputing/headscale-ui
appVersion: "2024.02.24-beta1" appVersion: "2024.02.24-beta1"
maintainers: maintainers:

View file

@ -2,7 +2,7 @@
= headscale-ui = headscale-ui
image::https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square[Version: 0.1.4] image::https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square[Version: 0.1.5]
image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application] image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application]
image::https://img.shields.io/badge/AppVersion-2024.02.24-beta1-informational?style=flat-square[AppVersion: 2024.02.24-beta1] image::https://img.shields.io/badge/AppVersion-2024.02.24-beta1-informational?style=flat-square[AppVersion: 2024.02.24-beta1]
== Maintainers == Maintainers
@ -187,9 +187,14 @@ helm uninstall headscale-ui-release
| `{}` | `{}`
| |
| service.port | service.port.http
| int | int
| `80` | `8080`
|
| service.port.https
| int
| `8443`
| |
| service.type | service.type

View file

@ -38,9 +38,17 @@ spec:
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}" image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }} imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }} {{- end }}
env:
- name: "HTTP_PORT"
value: {{ .Values.service.port.http | quote }}
- name: "HTTPS_PORT"
value: {{ .Values.service.port.https | quote }}
ports: ports:
- name: http - name: http
containerPort: {{ .Values.service.port }} containerPort: {{ .Values.service.port.http }}
protocol: TCP
- name: https
containerPort: {{ .Values.service.port.https }}
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:

View file

@ -1,18 +1,6 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $fullName := include "headscale-ui.fullname" . -}} {{- $fullName := include "headscale-ui.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1 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 kind: Ingress
metadata: metadata:
name: {{ $fullName }} name: {{ $fullName }}
@ -23,8 +11,8 @@ metadata:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} {{- with .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }} ingressClassName: {{ . }}
{{- end }} {{- end }}
{{- if .Values.ingress.tls }} {{- if .Values.ingress.tls }}
tls: tls:
@ -43,19 +31,12 @@ spec:
paths: paths:
{{- range .paths }} {{- range .paths }}
- path: {{ .path }} - path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }} pathType: {{ .pathType }}
{{- end }}
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service: service:
name: {{ $fullName }} name: {{ $fullName }}
port: port:
number: {{ $svcPort }} name: http
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -7,9 +7,13 @@ metadata:
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port.http }}
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
- port: {{ .Values.service.port.https }}
targetPort: https
protocol: TCP
name: https
selector: selector:
{{- include "headscale-ui.selectorLabels" . | nindent 4 }} {{- include "headscale-ui.selectorLabels" . | nindent 4 }}

View file

@ -43,7 +43,9 @@ securityContext: {}
service: service:
type: ClusterIP type: ClusterIP
port: 80 port:
http: 8080
https: 8443
ingress: ingress:
enabled: false enabled: false

View file

@ -14,6 +14,7 @@ ct lint # || exit 1
for p in * ; do for p in * ; do
if \ if \
[ ! -d $p ] || \ [ ! -d $p ] || \
[ "$p" == "matrix-authentication-service" ] || \
[ ! -f $p/Chart.yaml ] \ [ ! -f $p/Chart.yaml ] \
; then ; then
continue continue