Skip to content

Commit

Permalink
[stable/nginx-ingress] Add substitution for containerPorts from values (
Browse files Browse the repository at this point in the history
helm#17037)

* [stable/nginx-ingress] Add substitution for containerPorts from values

Use key-value range from .Values.controller.containerPort definition instead of mapping 1to1 http and https ports.

It allows passing extra configuration to nginx-ingress, such as validation-webhook with its own port, and define this port in values.
Without this option it’s not possible because of hardcoded http and https ports in deployment/daemonset templates.

Does not break anything.

Signed-off-by: Andrey Izotikov <andrsp@gmail.com>

* [stable/nginx-ingress] Bump version to 1.20.0

Signed-off-by: Andrey Izotikov <andrsp@gmail.com>
Signed-off-by: Marius Voila <myself@mariusv.com>
  • Loading branch information
andrsp authored and mariusv committed Sep 16, 2019
1 parent 4255a20 commit b15fb31
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion stable/nginx-ingress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: nginx-ingress
version: 1.19.1
version: 1.20.0
appVersion: 0.25.1
home: https://github.com/kubernetes/ingress-nginx
description: An nginx Ingress controller that uses ConfigMap to store the nginx configuration.
Expand Down
17 changes: 7 additions & 10 deletions stable/nginx-ingress/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if or (eq .Values.controller.kind "DaemonSet") (eq .Values.controller.kind "Both") }}
{{- $useHostPort := .Values.controller.daemonset.useHostPort -}}
{{- $hostPorts := .Values.controller.daemonset.hostPorts -}}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -120,18 +121,14 @@ spec:
successThreshold: {{ .Values.controller.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.controller.livenessProbe.failureThreshold }}
ports:
- name: http
containerPort: {{ .Values.controller.containerPort.http }}
{{- range $key, $value := .Values.controller.containerPort }}
- name: {{ $key }}
containerPort: {{ $value }}
protocol: TCP
{{- if .Values.controller.daemonset.useHostPort }}
hostPort: {{ .Values.controller.daemonset.hostPorts.http }}
{{- end }}
- name: https
containerPort: {{ .Values.controller.containerPort.https }}
protocol: TCP
{{- if .Values.controller.daemonset.useHostPort }}
hostPort: {{ .Values.controller.daemonset.hostPorts.https }}
{{- if $useHostPort }}
hostPort: {{ index $hostPorts $key | default $value }}
{{- end }}
{{- end }}
{{- if .Values.controller.metrics.enabled }}
- name: metrics
containerPort: 10254
Expand Down
9 changes: 4 additions & 5 deletions stable/nginx-ingress/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ spec:
successThreshold: {{ .Values.controller.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.controller.livenessProbe.failureThreshold }}
ports:
- name: http
containerPort: {{ .Values.controller.containerPort.http }}
protocol: TCP
- name: https
containerPort: {{ .Values.controller.containerPort.https }}
{{- range $key, $value := .Values.controller.containerPort }}
- name: {{ $key }}
containerPort: {{ $value }}
protocol: TCP
{{- end }}
{{- if .Values.controller.metrics.enabled }}
- name: metrics
containerPort: 10254
Expand Down
1 change: 1 addition & 0 deletions stable/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ controller:
containerPort:
http: 80
https: 443

# Will add custom configuration options to Nginx https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
config: {}

Expand Down

0 comments on commit b15fb31

Please sign in to comment.