rudr
rudr copied to clipboard
Bump nginx-ingress chart to work with kubernetes 1.16
The ingress
trait documentation heavily relies on the nginx-ingress
chart in the stable repository.
In Kubernetes 1.16, the extensions/v1beta1
API version was dropped for Deployments. Only Deployments with apiVersion: apps/v1
will work.
We should bump the nginx-ingress chart to support Kubernetes 1.16 clusters, as anyone using a more recent version of Kubernetes (e.g. minikube/KinD users) will fall flat in the quickstart.
https://github.com/helm/charts/pull/17343 tries to address this but likely wont be merged.
For the time being, here's what I've changed in the nginx-ingress chart to be compatible with kubernetes 1.16:
in templates/controller-deployment.yaml
:
{{- if eq .Values.controller.kind "Deployment" }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ template "nginx-ingress.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.controller.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nginx-ingress.controller.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "nginx-ingress.name" . }}
component: "{{ .Values.controller.name }}"
release: {{ .Release.Name }}
{{- if .Values.controller.podLabels }}
{{ toYaml .Values.controller.podLabels | indent 6 }}
{{- end }}
replicas: {{ .Values.controller.replicaCount }}
...
and in templates/default-backend-deployment.yaml
:
{{- if .Values.defaultBackend.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ template "nginx-ingress.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.defaultBackend.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nginx-ingress.defaultBackend.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "nginx-ingress.name" . }}
component: "{{ .Values.defaultBackend.name }}"
release: {{ .Release.Name }}
{{- if .Values.defaultBackend.podLabels }}
{{ toYaml .Values.defaultBackend.podLabels | indent 6 }}
{{- end }}
replicas: {{ .Values.defaultBackend.replicaCount }}
...
It's just a matter of submitting those changes as a PR to the nginx-ingress chart.