refactor(ingress)!: skip the Ingress when the HTTP Service is disabled
changelog / changelog (push) Successful in 16s
check-and-test / check-and-test (push) Failing after 1m51s

An Ingress that points at a Service which the chart does not render is broken by definition: the backend reference
cannot resolve and the ingress controller reports the rule as unavailable. The render condition therefore now also
requires `service.http.enabled` and lives in the new `gitea.ingress.enabled` helper, so the same rule can be reused
by other templates instead of being duplicated.

The namespace is taken from `.Release.Namespace` again. The `namespace` value is not a documented chart parameter,
and letting a single resource opt out of the release namespace breaks `helm uninstall` and Argo CD pruning, because
neither tracks objects outside the release namespace.

The `ingress.className` default changes from an empty string to `nginx`. An empty class makes the cluster fall back
to the default IngressClass, which silently produces a different result per cluster; naming the controller the chart
is tested against makes the rendered output predictable.

The scattered ingress suites are consolidated into a single `unittests/helm/ingress/ingress.yaml` that pins the
release name, namespace and appVersion, as required by the testing conventions, and covers the enable/disable matrix,
annotations, labels, TLS and a custom HTTP port.

BREAKING CHANGE: The Ingress is no longer rendered when `service.http.enabled` is `false`. `ingress.className` now
defaults to `nginx` instead of the cluster's default IngressClass. The undocumented `namespace` value no longer
applies to the Ingress.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-13 20:20:00 +02:00
co-authored by Copilot
parent 41dcb48564
commit e17a4e7a7b
11 changed files with 166 additions and 246 deletions
+8
View File
@@ -8,6 +8,14 @@
{{- end }}
{{- end }}
{{- define "gitea.ingress.enabled" -}}
{{- if and .Values.ingress.enabled .Values.service.http.enabled -}}
true
{{- else -}}
false
{{- end }}
{{- end }}
{{/* labels */}}
{{- define "gitea.ingress.labels" -}}
+12 -12
View File
@@ -1,4 +1,4 @@
{{- if .Values.ingress.enabled -}}
{{- if eq (include "gitea.ingress.enabled" .) "true" -}}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
@@ -12,19 +12,9 @@ metadata:
{{- . | nindent 4 }}
{{- end }}
name: {{ include "gitea.ingress.name" . }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
namespace: {{ .Release.Namespace }}
spec:
ingressClassName: {{ tpl .Values.ingress.className . }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ tpl . $ | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ tpl .host $ | quote }}
@@ -60,4 +50,14 @@ spec:
number: {{ $.Values.service.http.port }}
{{- end }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ tpl . $ | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- end }}