File tree Expand file tree Collapse file tree 2 files changed +40
-5
lines changed
ui/chart/wkp-ui/templates Expand file tree Collapse file tree 2 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -17,3 +17,39 @@ If release name contains chart name it will be used as a full name.
17
17
{ {- end -} }
18
18
{ {- end -} }
19
19
{ {- end -} }
20
+
21
+ { {/*
22
+ Return the appropriate apiVersion for ingress.
23
+ */} }
24
+ { {- define " common.capabilities.ingress.apiVersion" -} }
25
+ { {- if semverCompare " <1.14-0" .Capabilities.KubeVersion.GitVersion -} }
26
+ { {- print " extensions/v1beta1" -} }
27
+ { {- else if semverCompare " <1.19-0" .Capabilities.KubeVersion.GitVersion -} }
28
+ { {- print " networking.k8s.io/v1beta1" -} }
29
+ { {- else -} }
30
+ { {- print " networking.k8s.io/v1" -} }
31
+ { {- end -} }
32
+ { {- end -} }
33
+
34
+ { {/*
35
+ Params:
36
+ - serviceName - String. Name of an existing service backend
37
+ - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer.
38
+ - context - Dict - Required. The context for the template evaluation.
39
+ */} }
40
+ { {- define " common.ingress.backend" -} }
41
+ { {- $apiVersion := (include " common.capabilities.ingress.apiVersion" .context) -} }
42
+ { {- if or (eq $apiVersion " extensions/v1beta1" ) (eq $apiVersion " networking.k8s.io/v1beta1" ) -} }
43
+ serviceName: { { .serviceName } }
44
+ servicePort: { { .servicePort } }
45
+ { {- else -} }
46
+ service:
47
+ name: { { .serviceName } }
48
+ port:
49
+ { {- if typeIs " string" .servicePort } }
50
+ name: { { .servicePort } }
51
+ { {- else if or (typeIs " int" .servicePort) (typeIs " float64" .servicePort) } }
52
+ number: { { .servicePort | int } }
53
+ { {- end } }
54
+ { {- end -} }
55
+ { {- end -} }
Original file line number Diff line number Diff line change 2
2
{{- $serviceName := .Values.service.name -}}
3
3
{{- $servicePort := .Values.service.port -}}
4
4
{{- $ingressPath := .Values.ingress.path -}}
5
- apiVersion : extensions/v1beta1
5
+ apiVersion : {{ include "common.capabilities.ingress.apiVersion" . }}
6
6
kind : Ingress
7
7
metadata :
8
8
name : {{ include "wkp-ui.fullname" . }}
31
31
- host : {{ . }}
32
32
http :
33
33
paths :
34
- - path : {{ $ingressPath }}
35
- backend :
36
- serviceName : {{ $serviceName }}
37
- servicePort : {{ $servicePort }}
34
+ - pathType : ImplementationSpecific
35
+ path : {{ $ingressPath }}
36
+ backend : {{- include "common.ingress.backend" (dict "serviceName" $serviceName "servicePort" $servicePort "context" $) | nindent 14 }}
38
37
{{- end }}
39
38
{{- end }}
You can’t perform that action at this time.
0 commit comments