From e7b4242c3b460e94eb357fd113d88e79e4e6b408 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Wed, 1 Jan 2020 13:28:06 -0800 Subject: [PATCH] Ingress: nginx-ingress-controller 0.26.1+ support nginx-ingress-controller 0.26.1 introduces configurable parameters for streamPort and profilerPort, and changes the default for statusPort. This change allows those parameters to be configured, while maintaining compatibility with earlier versions of nginx-ingress.controller. It also modifies the default status port value from 18080 to 10246. Reference: https://github.com/kubernetes/ingress-nginx/blob/master/Changelog.md#0261 Change-Id: I88a7315f2ed47c31b8c2862ce1ad47b590b32137 --- .../templates/bin/_ingress-controller.sh.tpl | 17 ++++++++++++++++- ingress/templates/deployment-ingress.yaml | 4 ++++ ingress/values.yaml | 6 +++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ingress/templates/bin/_ingress-controller.sh.tpl b/ingress/templates/bin/_ingress-controller.sh.tpl index 3ba28d6c8..ba809c93a 100644 --- a/ingress/templates/bin/_ingress-controller.sh.tpl +++ b/ingress/templates/bin/_ingress-controller.sh.tpl @@ -21,6 +21,20 @@ COMMAND="${@:-start}" function start () { find /tmp/ -maxdepth 1 -writable | grep -v "^/tmp/$" | xargs -L1 -r rm -rfv + + declare -A desired_opts + desired_opts["--stream-port"]="${PORT_STREAM}" + desired_opts["--profiler-port"]="${PORT_PROFILER}" + + possible_opts=$(/nginx-ingress-controller --help 2>&1 | awk '/^ --/ { print $1 }') + + extra_opts=() + for k in "${!desired_opts[@]}"; do + if echo "$possible_opts" | grep -q -- ^${k}$; then + extra_opts+=($k=${desired_opts[$k]}) + fi + done + exec /usr/bin/dumb-init \ /nginx-ingress-controller \ {{- if eq .Values.deployment.mode "namespace" }} @@ -36,7 +50,8 @@ function start () { --default-backend-service=${POD_NAMESPACE}/${ERROR_PAGE_SERVICE} \ --configmap=${POD_NAMESPACE}/ingress-conf \ --tcp-services-configmap=${POD_NAMESPACE}/ingress-services-tcp \ - --udp-services-configmap=${POD_NAMESPACE}/ingress-services-udp + --udp-services-configmap=${POD_NAMESPACE}/ingress-services-udp \ + "${extra_opts[@]}" } function stop () { diff --git a/ingress/templates/deployment-ingress.yaml b/ingress/templates/deployment-ingress.yaml index 175b8ff67..ebad6d634 100644 --- a/ingress/templates/deployment-ingress.yaml +++ b/ingress/templates/deployment-ingress.yaml @@ -262,6 +262,10 @@ spec: value: {{ tuple "ingress" "internal" "https" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} - name: PORT_STATUS value: {{ tuple "ingress" "internal" "status" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} + - name: PORT_STREAM + value: {{ tuple "ingress" "internal" "stream" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} + - name: PORT_PROFILER + value: {{ tuple "ingress" "internal" "profiler" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} - name: PORT_HEALTHZ value: {{ tuple "ingress" "internal" "healthz" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} - name: DEFAULT_SERVER_PORT diff --git a/ingress/values.yaml b/ingress/values.yaml index 987c7b834..668a5a066 100644 --- a/ingress/values.yaml +++ b/ingress/values.yaml @@ -209,7 +209,11 @@ endpoints: healthz: default: 10254 status: - default: 18080 + default: 10246 + stream: + default: 10247 + profiler: + default: 10245 server: default: 8181 ingress_exporter: