Enable overriding of ingress api version for systems where detection doesn't work (#252)
fixes #251 The rendering is a bit more programatic but the result is the same if you don't have an override. This makes the code a little easier at the end of the template, and slightly less easier to read at the beginning, which I think is a valid tradeoff. Co-authored-by: Martyn Ranyard <m@rtyn.berlin> Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/252 Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.io> Reviewed-by: luhahn <luhahn@noreply.gitea.io> Co-authored-by: iMartyn <imartyn@noreply.gitea.io> Co-committed-by: iMartyn <imartyn@noreply.gitea.io>
This commit is contained in:
parent
bef0cea1b1
commit
d97b1567e2
@ -608,7 +608,7 @@ gitea:
|
|||||||
### Ingress
|
### Ingress
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
| ------------------------------------ | ---------------------------------------------- | ----------------- |
|
| ------------------------------------ | ---------------------------------------------------------------------------- | -------------------------------------------------- |
|
||||||
| `ingress.enabled` | enable ingress | `false` |
|
| `ingress.enabled` | enable ingress | `false` |
|
||||||
| `ingress.annotations` | add ingress annotations | |
|
| `ingress.annotations` | add ingress annotations | |
|
||||||
| `ingress.hosts[0].host` | add hosts for ingress | `git.example.com` |
|
| `ingress.hosts[0].host` | add hosts for ingress | `git.example.com` |
|
||||||
@ -616,6 +616,7 @@ gitea:
|
|||||||
| `ingress.hosts[0].paths[0].pathType` | add ingress path type | `Prefix` |
|
| `ingress.hosts[0].paths[0].pathType` | add ingress path type | `Prefix` |
|
||||||
| `ingress.tls` | add ingress tls settings | `[]` |
|
| `ingress.tls` | add ingress tls settings | `[]` |
|
||||||
| `ingress.className` | add ingress class name. Only used in k8s 1.19+ | |
|
| `ingress.className` | add ingress class name. Only used in k8s 1.19+ | |
|
||||||
|
| `ingress.apiVersion` | specify APIVersion of ingress object. Mostly would only be used for argocd. | version indicated by helm's `Capabilities` object. |
|
||||||
|
|
||||||
### Service
|
### Service
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
{{- if .Values.ingress.enabled -}}
|
{{- if .Values.ingress.enabled -}}
|
||||||
{{- $fullName := include "gitea.fullname" . -}}
|
{{- $fullName := include "gitea.fullname" . -}}
|
||||||
{{- $httpPort := .Values.service.http.port -}}
|
{{- $httpPort := .Values.service.http.port -}}
|
||||||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
|
{{- $apiVersion := "extensions/v1beta1" -}}
|
||||||
apiVersion: networking.k8s.io/v1
|
{{- if .Values.ingress.apiVersion -}}
|
||||||
|
{{- $apiVersion = .Values.ingress.apiVersion -}}
|
||||||
|
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
|
||||||
|
{{- $apiVersion = "networking.k8s.io/v1" }}
|
||||||
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}}
|
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}}
|
||||||
apiVersion: networking.k8s.io/v1beta1
|
{{- $apiVersion = "networking.k8s.io/v1beta1" }}
|
||||||
{{- else -}}
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
apiVersion: {{ $apiVersion }}
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ $fullName }}
|
name: {{ $fullName }}
|
||||||
@ -38,11 +40,11 @@ spec:
|
|||||||
paths:
|
paths:
|
||||||
{{- range .paths }}
|
{{- range .paths }}
|
||||||
- path: {{ .path }}
|
- path: {{ .path }}
|
||||||
{{- if and .pathType ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
|
{{- if and .pathType (eq $apiVersion "networking.k8s.io/v1") }}
|
||||||
pathType: {{ .pathType }}
|
pathType: {{ .pathType }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
backend:
|
backend:
|
||||||
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
{{- if eq $apiVersion "networking.k8s.io/v1" }}
|
||||||
service:
|
service:
|
||||||
name: {{ $fullName }}-http
|
name: {{ $fullName }}-http
|
||||||
port:
|
port:
|
||||||
|
@ -78,6 +78,9 @@ ingress:
|
|||||||
# - secretName: chart-example-tls
|
# - secretName: chart-example-tls
|
||||||
# hosts:
|
# hosts:
|
||||||
# - git.example.com
|
# - 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
|
||||||
|
|
||||||
resources: {}
|
resources: {}
|
||||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
Loading…
Reference in New Issue
Block a user