(helm) create ingress-redirects template

Create a new Helm template for ingress redirects
and update the values.yaml file accordingly.
We will be able to manage ingress redirects
through Helm charts easily.
This commit is contained in:
Anthony LC
2025-12-11 09:58:59 +01:00
parent 715d88ba3c
commit efaec45bfd
4 changed files with 100 additions and 6 deletions

View File

@@ -6,6 +6,10 @@ and this project adheres to
## [Unreleased]
### Added
- ✨(helm) redirecting system #1697
## [4.2.0] - 2025-12-17
### Added

View File

@@ -39,6 +39,14 @@
| `ingressCollaborationWS.annotations.nginx.ingress.kubernetes.io/proxy-read-timeout` | | `86400` |
| `ingressCollaborationWS.annotations.nginx.ingress.kubernetes.io/proxy-send-timeout` | | `86400` |
| `ingressCollaborationWS.annotations.nginx.ingress.kubernetes.io/upstream-hash-by` | | `$arg_room` |
| `ingressRedirects.enabled` | whether to enable the Ingress Redirects or not | `false` |
| `ingressRedirects.className` | IngressClass to use for the Ingress Redirects | `nil` |
| `ingressRedirects.host` | Host for the Ingress Redirects | `impress.example.com` |
| `ingressRedirects.tls.enabled` | Weather to enable TLS for the Ingress Redirects | `true` |
| `ingressRedirects.tls.secretName` | Secret name for TLS config | `nil` |
| `ingressRedirects.tls.additional[].secretName` | Secret name for additional TLS config | |
| `ingressRedirects.tls.additional[].hosts[]` | Hosts for additional TLS config | |
| `ingressRedirects.rules` | Rules for the Ingress Redirects | `[]` |
| `ingressCollaborationApi.enabled` | whether to enable the Ingress or not | `false` |
| `ingressCollaborationApi.className` | IngressClass to use for the Ingress | `nil` |
| `ingressCollaborationApi.host` | Host for the Ingress | `impress.example.com` |
@@ -113,15 +121,15 @@
| `backend.job.annotations` | Annotations to add to the job [default: argocd.argoproj.io/hook: PostSync] | |
| `backend.cronjobs` | Cronjob name, schedule, command | `[]` |
| `backend.probes.liveness.path` | Configure path for backend HTTP liveness probe | `/__heartbeat__` |
| `backend.probes.liveness.targetPort` | Configure port for backend HTTP liveness probe | `undefined` |
| `backend.probes.liveness.targetPort` | Configure port for backend HTTP liveness probe | `nil` |
| `backend.probes.liveness.initialDelaySeconds` | Configure initial delay for backend liveness probe | `10` |
| `backend.probes.liveness.initialDelaySeconds` | Configure timeout for backend liveness probe | `10` |
| `backend.probes.startup.path` | Configure path for backend HTTP startup probe | `undefined` |
| `backend.probes.startup.targetPort` | Configure port for backend HTTP startup probe | `undefined` |
| `backend.probes.startup.initialDelaySeconds` | Configure initial delay for backend startup probe | `undefined` |
| `backend.probes.startup.initialDelaySeconds` | Configure timeout for backend startup probe | `undefined` |
| `backend.probes.startup.path` | Configure path for backend HTTP startup probe | `nil` |
| `backend.probes.startup.targetPort` | Configure port for backend HTTP startup probe | `nil` |
| `backend.probes.startup.initialDelaySeconds` | Configure initial delay for backend startup probe | `nil` |
| `backend.probes.startup.initialDelaySeconds` | Configure timeout for backend startup probe | `nil` |
| `backend.probes.readiness.path` | Configure path for backend HTTP readiness probe | `/__lbheartbeat__` |
| `backend.probes.readiness.targetPort` | Configure port for backend HTTP readiness probe | `undefined` |
| `backend.probes.readiness.targetPort` | Configure port for backend HTTP readiness probe | `nil` |
| `backend.probes.readiness.initialDelaySeconds` | Configure initial delay for backend readiness probe | `10` |
| `backend.probes.readiness.initialDelaySeconds` | Configure timeout for backend readiness probe | `10` |
| `backend.resources` | Resource requirements for the backend container | `{}` |

View File

@@ -0,0 +1,63 @@
{{- if .Values.ingressRedirects.enabled }}
{{- $fullName := include "impress.fullname" . -}}
{{- $ns := .Release.Namespace -}}
{{- range $i, $r := .Values.ingressRedirects.rules }}
{{- $host := $r.host | default $.Values.ingressRedirects.host -}}
{{- $from := $r.from | default "/home" -}}
{{- $to := required (printf "ingressRedirects.rules[%d].to is required" $i) $r.to -}}
{{- $name := printf "%s-redirect-%s" $fullName (replace "/" "-" (trimAll "/" $from)) | trunc 63 | trimSuffix "-" -}}
{{- if $i }}
---
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $name }}
namespace: {{ $ns }}
annotations:
{{- if or (not $r.code) (eq (toString $r.code) "301") }}
nginx.ingress.kubernetes.io/permanent-redirect: "{{ $to }}"
{{- else }}
nginx.ingress.kubernetes.io/temporal-redirect: "{{ $to }}"
nginx.ingress.kubernetes.io/temporal-redirect-code: "{{ $r.code }}"
{{- end }}
spec:
{{- if $.Values.ingressRedirects.className }}
ingressClassName: {{ $.Values.ingressRedirects.className }}
{{- end }}
{{- if $.Values.ingressRedirects.tls.enabled }}
tls:
{{- if $host }}
- secretName: {{ $.Values.ingressRedirects.tls.secretName | default (printf "%s-tls" $fullName) | quote }}
hosts:
- {{ $host | quote }}
{{- end }}
{{- range $.Values.ingressRedirects.tls.additional }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ $host }}
http:
paths:
- path: {{ $from }}
pathType: Exact
backend:
service:
name: {{ include "impress.frontend.fullname" $ }}
port:
number: {{ $.Values.frontend.service.port }}
- path: {{ printf "%s/" (trimSuffix "/" $from) }}
pathType: Exact
backend:
service:
name: {{ include "impress.frontend.fullname" $ }}
port:
number: {{ $.Values.frontend.service.port }}
{{- end }}
{{- end }}

View File

@@ -85,6 +85,25 @@ ingressCollaborationWS:
nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
nginx.ingress.kubernetes.io/upstream-hash-by: $arg_room
## @param ingressRedirects.enabled whether to enable the Ingress Redirects or not
## @param ingressRedirects.className IngressClass to use for the Ingress Redirects
## @param ingressRedirects.host Host for the Ingress Redirects
ingressRedirects:
enabled: false
className: null
host: impress.example.com
## @param ingressRedirects.tls.enabled Weather to enable TLS for the Ingress Redirects
## @param ingressRedirects.tls.secretName Secret name for TLS config
## @skip ingressRedirects.tls.additional
## @extra ingressRedirects.tls.additional[].secretName Secret name for additional TLS config
## @extra ingressRedirects.tls.additional[].hosts[] Hosts for additional TLS config
tls:
enabled: true
secretName: null
additional: []
## @param ingressRedirects.rules Rules for the Ingress Redirects
rules: []
## @param ingressCollaborationApi.enabled whether to enable the Ingress or not
## @param ingressCollaborationApi.className IngressClass to use for the Ingress
## @param ingressCollaborationApi.host Host for the Ingress