deprecate ingress.className in favor of ingress.ingressClassName

This commit is contained in:
pat-s 2024-07-13 12:48:15 +02:00
parent f34fe9efb9
commit 52a779f26c
No known key found for this signature in database
GPG Key ID: 3C6318841EF78925
6 changed files with 76 additions and 20 deletions

View File

@ -905,15 +905,16 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
### Ingress
| Name | Description | Value |
| ------------------------ | -------------------- | ----------------- |
| `ingress.enabled` | Enable ingress | `false` |
| `ingress.className` | Ingress class name | `nil` |
| `ingress.pathType` | Ingress Path Type | `Prefix` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts[0].host` | Default Ingress host | `git.example.com` |
| `ingress.hosts[0].paths` | Default Ingress path | `[]` |
| `ingress.tls` | Ingress tls settings | `[]` |
| Name | Description | Value |
| -------------------------- | -------------------- | ----------------- |
| `ingress.enabled` | Enable ingress | `false` |
| `ingress.className` | Ingress class name | `""` |
| `ingress.ingressClassName` | 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` | Default Ingress path | `[]` |
| `ingress.tls` | Ingress tls settings | `[]` |
### deployment

View File

@ -404,3 +404,15 @@ https
{{- end }}
{{- end }}
{{- end -}}
{{- /* Deprecations */ -}}
{{- /* 10.4.0 (2024-07) */ -}}
{{- define "deprecations" -}}
{{- if ne .Values.ingress.className "" }}
{{- printf "# WARNING: 'ingress.className' is deprecated and will be removed in a future release. Use 'ingress.ingressClassName' instead.\n" -}}
{{- end -}}
{{- if and (ne .Values.ingress.className "" ) (ne .Values.ingress.ingressClassName "") -}}
{{- fail "ingress.ingressClassName and ingress.className cannot be defined at the same time. Please only choose one." -}}
{{- end -}}
{{- end -}}

View File

@ -1,3 +1,4 @@
{{- include "deprecations" . -}}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "gitea.fullname" . -}}
{{- $httpPort := .Values.service.http.port -}}
@ -10,8 +11,10 @@ metadata:
{{- include "gitea.labels" . | nindent 4 }}
{{- template "ingress.annotations" . }}
spec:
{{- if .Values.ingress.className }}
{{- if ne .Values.ingress.className "" }}
ingressClassName: {{ tpl .Values.ingress.className . }}
{{- else }}
ingressClassName: {{ tpl .Values.ingress.ingressClassName . }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:

View File

@ -53,7 +53,7 @@ tests:
- it: Ingress Class using TPL
set:
global.ingress.className: "ingress-class"
ingress.className: "{{ .Values.global.ingress.className }}"
ingress.ingressClassName: "{{ .Values.global.ingress.className }}"
ingress.enabled: true
ingress.hosts[0].host: "some-host"
ingress.tls:

View File

@ -0,0 +1,43 @@
suite: Test ingress.yaml
templates:
- templates/gitea/ingress.yaml
tests:
- it: should fail when both ingress.className and ingress.ingressClassName are defined
set:
ingress.enabled: true
ingress.className: "ingress-class"
ingress.ingressClassName: "ingress-class"
asserts:
- failedTemplate:
errorMessage: "ingress.ingressClassName and ingress.className cannot be defined at the same time. Please only choose one."
- it: should succeed when only ingress.className is defined
set:
ingress.enabled: true
ingress.ingressClassName: "ingress-class"
asserts:
- hasDocuments:
count: 1
- it: should succeed when only ingress.ingressClassName is defined
set:
ingress.enabled: true
ingress.ingressClassName: "ingress-class"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.ingressClassName
value: ingress-class
- it: should succeed when neither ingress.className nor ingress.ingressClassName are defined
set:
ingress.enabled: true
ingress.className: "ingress-class"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.ingressClassName
value: ingress-class

View File

@ -151,6 +151,7 @@ service:
## @section Ingress
## @param ingress.enabled Enable ingress
## @param ingress.className Ingress class name
## @param ingress.ingressClassName Ingress class name
## @param ingress.pathType Ingress Path Type
## @param ingress.annotations Ingress annotations
## @param ingress.hosts[0].host Default Ingress host
@ -158,13 +159,12 @@ service:
## @param ingress.tls Ingress tls settings
ingress:
enabled: false
# className: nginx
className:
# DEPRECATED: Use `ingress.ingressClassName` instead.
className: ""
ingressClassName: ""
pathType: Prefix
annotations:
{}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
annotations: {}
# kubernetes.io/tls-acme: "true"
hosts:
- host: git.example.com
paths: []
@ -172,9 +172,6 @@ ingress:
# - secretName: chart-example-tls
# hosts:
# - git.example.com
# Mostly for argocd or any other CI that uses `helm template | kubectl apply` or similar
# If helm doesn't correctly detect your ingress API version you can set it here.
# apiVersion: networking.k8s.io/v1
## @section deployment
#