Kubernetes version: v1.14+
Dashboard version: 2.*
The dashboard uses non-deprecated versions of the APIs
Considering that the new APIs are available from version 1.14, the Dashboard fully supports 1.19 (and partially from 1.15) could it be time for the dashboard to migrate to the new API for ingresses?
To date, the APIs used are hard-coded in the code [1][2][3]. Might it make sense to parameterize the APIs based on the underlying k8s version?
[1] https://github.com/kubernetes/dashboard/blob/master/src/app/backend/resource/ingress/common.go#L19
[2] https://github.com/kubernetes/dashboard/blob/master/src/app/backend/resource/ingress/detail.go#L21
[3] https://github.com/kubernetes/dashboard/blob/master/src/app/backend/resource/ingress/list.go#L24
This is something that we'll be working on in the API v2. Nevertheless, considering that API versions for different parts of kubernetes can differ we can at most move client creation logic to separate file(s) to easier migrate to newer versions.
Actually if helm with lint is used, the deployment fails on recent K8S versions:
Error: malformed chart or values:
templates/ingress.yaml: the kind "extensions/v1beta1 Ingress" is deprecated in favor of "networking.k8s.io/v1beta1 Ingress"
templates/networkpolicy.yaml: object name does not conform to Kubernetes naming requirements: "": invalid metadata name, must match regex ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$ and the length must not longer than 253
templates/pdb.yaml: object name does not conform to Kubernetes naming requirements: "": invalid metadata name, must match regex ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$ and the length must not longer than 253
templates/psp.yaml: object name does not conform to Kubernetes naming requirements: "": invalid metadata name, must match regex ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$ and the length must not longer than 253
A proper way to support also older k8s versions could be:
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
@cf-sewe if you could turn your suggestion into a PR I think it would be terrific.
If @floreks agree of course!
As an experiment, I implemented the k8s 1.19 API (networking/v1) ( #5741 ).
It is nice, but now it broke the dashboard on k8s <= 1.18, which is not something I am prod of.
Suggestions are welcome...
Problem solved: https://github.com/kubernetes/dashboard/pull/5742
Most helpful comment
Actually if helm with lint is used, the deployment fails on recent K8S versions:
A proper way to support also older k8s versions could be: