From 45c7d74578747e8bfbaed419f5c9ec9720c080d2 Mon Sep 17 00:00:00 2001 From: Aisuko Date: Tue, 25 Jun 2019 22:06:39 +0800 Subject: [PATCH] Add report node internal ip when host network was enabled (#14991) Signed-off-by: Aisuko --- stable/nginx-ingress/Chart.yaml | 2 +- stable/nginx-ingress/README.md | 1 + stable/nginx-ingress/templates/controller-daemonset.yaml | 3 +++ stable/nginx-ingress/templates/controller-deployment.yaml | 3 +++ stable/nginx-ingress/values.yaml | 4 ++++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stable/nginx-ingress/Chart.yaml b/stable/nginx-ingress/Chart.yaml index fa5868347f..b4174949a8 100644 --- a/stable/nginx-ingress/Chart.yaml +++ b/stable/nginx-ingress/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: nginx-ingress -version: 1.6.19 +version: 1.7.0 appVersion: 0.24.1 home: https://github.com/kubernetes/ingress-nginx description: An nginx Ingress controller that uses ConfigMap to store the nginx configuration. diff --git a/stable/nginx-ingress/README.md b/stable/nginx-ingress/README.md index f8ee6a4760..55a21f9ae2 100644 --- a/stable/nginx-ingress/README.md +++ b/stable/nginx-ingress/README.md @@ -56,6 +56,7 @@ Parameter | Description | Default `controller.hostNetwork` | If the nginx deployment / daemonset should run on the host's network namespace. Do not set this when `controller.service.externalIPs` is set and `kube-proxy` is used as there will be a port-conflict for port `80` | false `controller.defaultBackendService` | default 404 backend service; required only if `defaultBackend.enabled = false` | `""` `controller.dnsPolicy` | If using `hostNetwork=true`, change to `ClusterFirstWithHostNet`. See [pod's dns policy](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy) for details | `ClusterFirst` +`controller.reportNodeInternalIp` | If using `hostNetwork=true`, setting `reportNodeInternalIp=true`, will pass the flag `report-node-internal-ip-address` to nginx-ingress. This sets the status of all Ingress objects to the internal IP address of all nodes running the NGINX Ingress controller. `controller.electionID` | election ID to use for the status update | `ingress-controller-leader` `controller.extraEnvs` | any additional environment variables to set in the pods | `{}` `controller.extraContainers` | Sidecar containers to add to the controller pod. See [LemonLDAP::NG controller](https://github.com/lemonldap-ng-controller/lemonldap-ng-controller) as example | `{}` diff --git a/stable/nginx-ingress/templates/controller-daemonset.yaml b/stable/nginx-ingress/templates/controller-daemonset.yaml index 3715395500..d05fdabefe 100644 --- a/stable/nginx-ingress/templates/controller-daemonset.yaml +++ b/stable/nginx-ingress/templates/controller-daemonset.yaml @@ -77,6 +77,9 @@ spec: {{- if .Values.controller.scope.enabled }} - --watch-namespace={{ default .Release.Namespace .Values.controller.scope.namespace }} {{- end }} + {{- if and (.Values.controller.reportNodeInternalIp) (.Values.controller.hostNetwork)}} + - --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }} + {{- end }} {{- range $key, $value := .Values.controller.extraArgs }} {{- if $value }} - --{{ $key }}={{ $value }} diff --git a/stable/nginx-ingress/templates/controller-deployment.yaml b/stable/nginx-ingress/templates/controller-deployment.yaml index 2ca034c20c..335a9abba5 100644 --- a/stable/nginx-ingress/templates/controller-deployment.yaml +++ b/stable/nginx-ingress/templates/controller-deployment.yaml @@ -77,6 +77,9 @@ spec: {{- if .Values.controller.scope.enabled }} - --watch-namespace={{ default .Release.Namespace .Values.controller.scope.namespace }} {{- end }} + {{- if and (.Values.controller.reportNodeInternalIp) (.Values.controller.hostNetwork) }} + - --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }} + {{- end }} {{- range $key, $value := .Values.controller.extraArgs }} {{- if $value }} - --{{ $key }}={{ $value }} diff --git a/stable/nginx-ingress/values.yaml b/stable/nginx-ingress/values.yaml index 0680304e4e..1bd9a203ef 100644 --- a/stable/nginx-ingress/values.yaml +++ b/stable/nginx-ingress/values.yaml @@ -29,6 +29,10 @@ controller: # to keep resolving names inside the k8s network, use ClusterFirstWithHostNet. dnsPolicy: ClusterFirst + # Bare-metal considerations via the host network https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network + # Ingress status was blank because there is no Service exposing the NGINX Ingress controller in a configuration using the host network, the default --publish-service flag used in standard cloud setups does not apply + reportNodeInternalIp: false + ## Use host ports 80 and 443 daemonset: useHostPort: false