8000 [Helm] Choose NodePort values for controller.service.type = LoadBalancer · Issue #5333 · nginx/kubernetes-ingress · GitHub
[go: up one dir, main page]

Skip to content

[Helm] Choose NodePort values for controller.service.type = LoadBalancer #5333

@Falltrades

Description

@Falltrades

Is your feature request related to a problem? Please describe.
Currently when we have controller.service.type set to LoadBalancer, it allocates random NodePort for httpPort and httpsPort.
Sometimes we would like to choose specific ports ourselves.

Describe the solution you'd like
I would like to be able to set the nodePort number like the case when controller.service.type is set to NodePort in charts/nginx-ingress/values.yaml:

      ## The custom NodePort for the HTTP port. Requires controller.service.type set to NodePort.
      # nodePort: 80

...

      ## The custom NodePort for the HTTPS port. Requires controller.service.type set to NodePort.
      # nodePort: 443

Actually there is not much change, we only need to add a case in charts/nginx-ingress/templates/controller-service.yaml:

  {{- if eq .Values.controller.service.type "NodePort" }}
    nodePort: {{ .Values.controller.service.httpPort.nodePort }}
  {{- end }}

...

  {{- if eq .Values.controller.service.type "NodePort" }}
    nodePort: {{ .Values.controller.service.httpsPort.nodePort }}
  {{- end }}

Like this:

  {{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
    nodePort: {{ .Values.controller.service.httpPort.nodePort }}
  {{- end }}

...

  {{- if or (eq .Values.controller.service.type "LoadBalancer") (eq .Values.controller.service.type "NodePort") }}
    nodePort: {{ .Values.controller.service.httpsPort.nodePort }}
  {{- end }}

Describe alternatives you've considered
None since the solution was quite straightforward.

Additional context
None.

Metadata

Metadata

Assignees

Labels

backlogPull requests/issues that are backlog itemsproposalAn issue that proposes a feature request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0