From bd977dec5242ca1f1fd964de72ee56154cff8fcc Mon Sep 17 00:00:00 2001 From: Michal Schott Date: Fri, 22 Jun 2018 10:44:05 +0200 Subject: [PATCH] Adding an option to not open http/https port on LB. (#6128) * Adding an option to not open http/https port on LB. * Version bump. * Updating as suggested. * Adjusting style. * Bump minor version for new feature --- stable/nginx-ingress/Chart.yaml | 2 +- stable/nginx-ingress/README.md | 2 ++ stable/nginx-ingress/templates/controller-service.yaml | 4 ++++ stable/nginx-ingress/values.yaml | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/stable/nginx-ingress/Chart.yaml b/stable/nginx-ingress/Chart.yaml index 227892465d..6bf24071a2 100755 --- a/stable/nginx-ingress/Chart.yaml +++ b/stable/nginx-ingress/Chart.yaml @@ -1,5 +1,5 @@ name: nginx-ingress -version: 0.20.4 +version: 0.21.0 appVersion: 0.14.0 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 05ab48c223..1cf54ee487 100644 --- a/stable/nginx-ingress/README.md +++ b/stable/nginx-ingress/README.md @@ -85,6 +85,8 @@ Parameter | Description | Default `controller.service.healthCheckNodePort` | If `controller.service.type` is `NodePort` or `LoadBalancer` and `controller.service.externalTrafficPolicy` is set to `Local`, set this to [the managed health-check port the kube-proxy will expose](https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-typenodeport). If blank, a random port in the `NodePort` range will be assigned | `""` `controller.service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` `controller.service.loadBalancerSourceRanges` | list of IP CIDRs allowed access to load balancer (if supported) | `[]` +`controller.service.enableHttp` | if port 80 should be opened for service | `true` +`controller.service.enableHttps` | if port 443 should be opened for service | `true` `controller.service.targetPorts.http` | Sets the targetPort that maps to the Ingress' port 80 | `80` `controller.service.targetPorts.https` | Sets the targetPort that maps to the Ingress' port 443 | `443` `controller.service.type` | type of controller service to create | `LoadBalancer` diff --git a/stable/nginx-ingress/templates/controller-service.yaml b/stable/nginx-ingress/templates/controller-service.yaml index a980c27806..23de6d5d41 100644 --- a/stable/nginx-ingress/templates/controller-service.yaml +++ b/stable/nginx-ingress/templates/controller-service.yaml @@ -35,6 +35,7 @@ spec: healthCheckNodePort: {{ .Values.controller.service.healthCheckNodePort }} {{- end }} ports: + {{- if .Values.controller.service.enableHttp }} - name: http port: 80 protocol: TCP @@ -42,6 +43,8 @@ spec: {{- if (and (eq .Values.controller.service.type "NodePort") (not (empty .Values.controller.service.nodePorts.http))) }} nodePort: {{ .Values.controller.service.nodePorts.http }} {{- end }} + {{- end }} + {{- if .Values.controller.service.enableHttps }} - name: https port: 443 protocol: TCP @@ -49,6 +52,7 @@ spec: {{- if (and (eq .Values.controller.service.type "NodePort") (not (empty .Values.controller.service.nodePorts.https))) }} nodePort: {{ .Values.controller.service.nodePorts.https }} {{- end }} + {{- end }} {{- range $key, $value := .Values.tcp }} - name: "{{ $key }}-tcp" port: {{ $key }} diff --git a/stable/nginx-ingress/values.yaml b/stable/nginx-ingress/values.yaml index b25cfc8ece..2d94588a7e 100755 --- a/stable/nginx-ingress/values.yaml +++ b/stable/nginx-ingress/values.yaml @@ -168,6 +168,9 @@ controller: loadBalancerIP: "" loadBalancerSourceRanges: [] + enableHttp: true + enableHttps: true + ## Set external traffic policy to: "Local" to preserve source IP on ## providers supporting it ## Ref: https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-typeloadbalancer