Files
helm-gitea/templates/ingress.yaml
T
Ceddaerrix ddd0290b55 feat: adding 'tpl' to ingress annotation values (#1124)
### Description of the change

Adding templating support into ingress annotations so the following can be used (hence avoiding YAML anchors):

```
    ingress:
      className: "{{ .Values.global.ingress.className }}"
      annotations:
        cert-manager.io/issuer: "{{ .Values.global.issuer.name }}"
```

### Benefits

- avoiding use of YAML anchors and related limitations
- Possibility to inject a value into an annotation even from an umbrella chart

### Checklist

<!-- [Place an '[X]' (no spaces) in all applicable fields. Please remove unrelated fields.] -->

- [x] Helm templating unittests are added (required when changing anything in `templates` folder)

Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1124
Reviewed-by: Markus Pesch <1641+volker.raschek@noreply.gitea.com>
Co-authored-by: Ceddaerrix <48319+ceddaerrix@noreply.gitea.com>
2026-12-04 17:08:33 +00:00

64 lines
1.8 KiB
YAML

{{- if eq (include "gitea.ingress.enabled" .) "true" -}}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- with (include "gitea.ingress.annotations" $) }}
annotations:
{{- tpl . $ | nindent 4 }}
{{- end }}
{{- with (include "gitea.ingress.labels" .) }}
labels:
{{- . | nindent 4 }}
{{- end }}
name: {{ include "gitea.ingress.name" . }}
namespace: {{ .Release.Namespace }}
spec:
ingressClassName: {{ tpl .Values.ingress.ingressClassName $ }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- if .paths }}
{{- range .paths }}
{{- if kindIs "string" . }}
- path: {{ . }}
pathType: {{ default "Prefix" $.Values.ingress.pathType }}
backend:
service:
name: {{ include "gitea.service.http.name" $ }}
port:
number: {{ $.Values.service.http.port }}
{{- else }}
- path: {{ .path | default "/" }}
pathType: {{ .pathType | default "Prefix" }}
backend:
service:
name: {{ include "gitea.service.http.name" $ }}
port:
number: {{ $.Values.service.http.port }}
{{- end }}
{{- end }}
{{- else }}
- path: "/"
pathType: "Prefix"
backend:
service:
name: {{ include "gitea.service.http.name" $ }}
port:
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 }}