Separate selenoid and selenoid ui ingress

This commit is contained in:
Nikolai Rodionov 2024-07-16 17:20:23 +02:00
parent 60982bc497
commit 8c048b6786
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
3 changed files with 88 additions and 11 deletions

View File

@ -1,9 +1,9 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.ingressUI.enabled -}}
{{- $fullName := include "selenoid.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}}
{{- if and .Values.ingressUI.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingressUI.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingressUI.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@ -15,20 +15,20 @@ apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
name: {{ $fullName }}-ui
labels:
{{- include "selenoidUI.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- with .Values.ingressUI.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- if and .Values.ingressUI.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingressUI.className }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- if .Values.ingressUI.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range .Values.ingressUI.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
@ -37,7 +37,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- range .Values.ingressUI.hosts }}
- host: {{ .host | quote }}
http:
paths:

View File

@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "selenoid.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
{{- 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:
{{- include "selenoidUI.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-ui
port:
number: 4444
{{- else }}
serviceName: {{ $fullName }}-ui
servicePort: 4444
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -79,6 +79,22 @@ service:
port: 80
ingress:
enabled: true
className: ""
annotations:
cert-manager.io/cluster-issuer: badhouseplants-issuer-http01
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: selenoid.badhouseplants.net
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: selenoid.badhouseplants.net
hosts:
- selenoid.badhouseplants.net
ingressUI:
enabled: true
className: ""
annotations: