diff --git a/README.md b/README.md index 494eefe..18797cd 100644 --- a/README.md +++ b/README.md @@ -1144,9 +1144,10 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo | Name | Description | Value | | -------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------- | | `ingress.enabled` | Enable ingress | `false` | +| `ingress.annotations` | Additional annotations. | `{}` | +| `ingress.labels` | Additional labels. | `{}` | | `ingress.className` | DEPRECATED: Ingress class name. | `""` | | `ingress.pathType` | Ingress Path Type | `Prefix` | -| `ingress.annotations` | Ingress annotations | `{}` | | `ingress.hosts[0].host` | Default Ingress host | `git.example.com` | | `ingress.hosts[0].paths[0].path` | Default Ingress path | `/` | | `ingress.tls` | Ingress tls settings | `[]` | diff --git a/templates/gitea/_ingresses.tpl b/templates/gitea/_ingresses.tpl new file mode 100644 index 0000000..741dd32 --- /dev/null +++ b/templates/gitea/_ingresses.tpl @@ -0,0 +1,24 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* annotations */}} + +{{- define "gitea.ingress.annotations" -}} +{{- with .Values.ingress.annotations }} +{{- toYaml . -}} +{{- end }} +{{- end }} + +{{/* labels */}} + +{{- define "gitea.ingress.labels" -}} +{{ include "gitea.labels" . }} +{{- with .Values.ingress.labels }} +{{ toYaml . }} +{{- end }} +{{- end }} + +{{/* name */}} + +{{- define "gitea.ingress.name" -}} +{{ include "gitea.fullname" . }} +{{- end }} \ No newline at end of file diff --git a/templates/gitea/ingress.yaml b/templates/gitea/ingress.yaml index 408cba6..5b1cf74 100644 --- a/templates/gitea/ingress.yaml +++ b/templates/gitea/ingress.yaml @@ -1,17 +1,18 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "gitea.fullname" . -}} -{{- $httpPort := .Values.service.http.port -}} +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ $fullName }} - namespace: {{ .Values.namespace | default .Release.Namespace }} - labels: - {{- include "gitea.labels" . | nindent 4 }} + {{- with (include "gitea.ingress.annotations" .) }} annotations: - {{- range $key, $value := .Values.ingress.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} + {{- . | nindent 4 }} + {{- end }} + {{- with (include "gitea.ingress.labels" .) }} + labels: + {{- . | nindent 4 }} + {{- end }} + name: {{ include "gitea.ingress.name" . }} + namespace: {{ .Values.namespace | default .Release.Namespace }} spec: ingressClassName: {{ tpl .Values.ingress.className . }} {{- if .Values.ingress.tls }} @@ -38,7 +39,7 @@ spec: service: name: {{ include "gitea.service.http.name" $ }} port: - number: {{ $httpPort }} + number: {{ $.Values.service.http.port }} {{- else }} - path: {{ .path | default "/" }} pathType: {{ .pathType | default "Prefix" }} @@ -46,7 +47,7 @@ spec: service: name: {{ include "gitea.service.http.name" $ }} port: - number: {{ $httpPort }} + number: {{ $.Values.service.http.port }} {{- end }} {{- end }} {{- else }} @@ -56,7 +57,7 @@ spec: service: name: {{ include "gitea.service.http.name" $ }} port: - number: {{ $httpPort }} + number: {{ $.Values.service.http.port }} {{- end }} {{- end }} {{- end }} diff --git a/values.yaml b/values.yaml index 6026615..5ca937d 100644 --- a/values.yaml +++ b/values.yaml @@ -588,17 +588,19 @@ gatewayAPI: ## @section Ingress ## @param ingress.enabled Enable ingress +## @param ingress.annotations Additional annotations. +## @param ingress.labels Additional labels. ## @param ingress.className DEPRECATED: Ingress class name. ## @param ingress.pathType Ingress Path Type -## @param ingress.annotations Ingress annotations ## @param ingress.hosts[0].host Default Ingress host ## @param ingress.hosts[0].paths[0].path Default Ingress path ## @param ingress.tls Ingress tls settings ingress: enabled: false + annotations: {} + labels: {} className: "" pathType: Prefix - annotations: {} hosts: - host: git.example.com paths: