fix: use .Capabilities.APIVersions.Has in Ingress template
Signed-off-by: chgl <chgl@users.noreply.github.com>
This commit is contained in:
parent
ad848facd6
commit
f7f8626ae4
2 changed files with 7 additions and 25 deletions
|
@ -86,29 +86,11 @@ Create the name of the controller service account to use
|
||||||
Return the appropriate apiVersion for ingress
|
Return the appropriate apiVersion for ingress
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "argo-workflows.ingress.apiVersion" -}}
|
{{- define "argo-workflows.ingress.apiVersion" -}}
|
||||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.Version -}}
|
||||||
{{- print "extensions/v1beta1" -}}
|
{{- print "extensions/v1beta1" -}}
|
||||||
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.Version -}}
|
||||||
{{- print "networking.k8s.io/v1beta1" -}}
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- print "networking.k8s.io/v1" -}}
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
|
||||||
Return the appropriate service layout for ingress
|
|
||||||
*/}}
|
|
||||||
{{- define "argo-workflows.ingress.service" -}}
|
|
||||||
{{- if semverCompare "<1.19-0" .kubeVersion -}}
|
|
||||||
- backend:
|
|
||||||
serviceName: {{ .serviceName }}
|
|
||||||
servicePort: {{ .servicePort }}
|
|
||||||
{{- else -}}
|
|
||||||
- backend:
|
|
||||||
service:
|
|
||||||
name: {{ .serviceName }}
|
|
||||||
port:
|
|
||||||
number: {{ .servicePort }}
|
|
||||||
pathType: ImplementationSpecific
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ metadata:
|
||||||
{{- toYaml .Values.server.ingress.labels | nindent 4 }}
|
{{- toYaml .Values.server.ingress.labels | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
{{- if eq (include "argo-workflows.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||||
{{- with .Values.server.ingress.ingressClassName }}
|
{{- with .Values.server.ingress.ingressClassName }}
|
||||||
ingressClassName: {{ . }}
|
ingressClassName: {{ . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -35,11 +35,11 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range $p := $paths }}
|
{{- range $p := $paths }}
|
||||||
- path: {{ $p }}
|
- path: {{ $p }}
|
||||||
{{- if eq (include "argo-workflows.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
{{- end }}
|
{{- end }}
|
||||||
backend:
|
backend:
|
||||||
{{- if eq (include "argo-workflows.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||||
service:
|
service:
|
||||||
name: {{ $serviceName }}
|
name: {{ $serviceName }}
|
||||||
port:
|
port:
|
||||||
|
@ -62,11 +62,11 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range $p := $paths }}
|
{{- range $p := $paths }}
|
||||||
- path: {{ $p }}
|
- path: {{ $p }}
|
||||||
{{- if eq (include "argo-workflows.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
{{- end }}
|
{{- end }}
|
||||||
backend:
|
backend:
|
||||||
{{- if eq (include "argo-workflows.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||||
service:
|
service:
|
||||||
name: {{ $serviceName }}
|
name: {{ $serviceName }}
|
||||||
port:
|
port:
|
||||||
|
|
Loading…
Reference in a new issue