`apiVersion` of Ingress resource is wrong for version k8s
cyanwind23 opened this issue · 2 comments
Problem
Hi, we have a problem with apiVersion
of Ingress manifest.
As you can see in _helpers.tpl
at line 646
{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "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 -}}
The problem is we're using k8s v1.17, we have networking.k8s.io/v1
but it's only for NetworkPolicy
not Ingress
resource, and Ingress
uses networking.k8s.io/v1beta1
. Thus, with your chart, we will get Ingress manifest with apiVersion: networking.k8s.io/v1
and it will cause an error.
Suggested solution
I think you should handle Ingress apiVersion like helm default template (as below), or it would be better if you have your own idea.
...
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
...
I'm looking forward to your new commit which can fix this problem.
P/s: Sorry for my bad English
Hi @ThienNam23,
Currently, we only support networking.k8s.io/v1
as we try to follow Kubernete's end of life schedule.
we're facing the same issue, please reopen this thread