diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index a45de6a..74b3b92 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -30,3 +30,13 @@ Create chart name and version as used by the chart label. {{- define "owgwui.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "owgwui.ingress.apiVersion" -}} + {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}} + {{- print "networking.k8s.io/v1" -}} + {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} + {{- print "networking.k8s.io/v1beta1" -}} + {{- else -}} + {{- print "extensions/v1beta1" -}} + {{- end -}} +{{- end -}} diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index eaf5486..a3c6973 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -2,7 +2,7 @@ {{- range $ingress, $ingressValue := .Values.ingresses }} {{- if $ingressValue.enabled }} --- -apiVersion: extensions/v1beta1 +apiVersion: {{ include "owgwui.ingress.apiVersion" $root }} kind: Ingress metadata: name: {{ include "owgwui.fullname" $root }}-{{ $ingress }} @@ -36,9 +36,23 @@ spec: paths: {{- range $ingressValue.paths }} - path: {{ .path }} + {{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }} + pathType: {{ .pathType | default "ImplementationSpecific" }} + {{- end }} backend: + {{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }} + service: + name: {{ include "owgwui.fullname" $root }}-{{ .serviceName }} + port: + {{- if kindIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else }} + number: {{ .servicePort }} + {{- end }} + {{- else }} serviceName: {{ include "owgwui.fullname" $root }}-{{ .serviceName }} servicePort: {{ .servicePort }} + {{- end }} {{- end }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 4e91358..abee23c 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -49,6 +49,7 @@ ingresses: - chart-example.local paths: - path: / + pathType: ImplementationSpecific serviceName: owgwui servicePort: http