Support NodePort Proxy service (#500)

* Enables nodeport support for the proxy

* Correct indentation and remove null `nodePort`

Removing null `nodePort` causes k8s to pick up a random port

* Address review comment

https://github.com/apache/pulsar-helm-chart/pull/500/files#r1605762312
This commit is contained in:
Massimiliano Mirelli 2024-06-04 18:46:16 +03:00 committed by GitHub
parent cb5c44f8ec
commit 6e84409b48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -47,20 +47,32 @@ spec:
port: {{ .Values.proxy.ports.http }} port: {{ .Values.proxy.ports.http }}
protocol: TCP protocol: TCP
targetPort: sts-http targetPort: sts-http
{{- if and (eq .Values.proxy.service.type "NodePort") (ne .Values.proxy.service.nodePorts.http "") }}
nodePort: {{ .Values.proxy.service.nodePorts.http }}
{{- end}}
- name: "{{ .Values.tcpPrefix }}pulsar" - name: "{{ .Values.tcpPrefix }}pulsar"
port: {{ .Values.proxy.ports.pulsar }} port: {{ .Values.proxy.ports.pulsar }}
protocol: TCP protocol: TCP
targetPort: "sts-{{ .Values.tcpPrefix }}pulsar" targetPort: "sts-{{ .Values.tcpPrefix }}pulsar"
{{- if and (eq .Values.proxy.service.type "NodePort") (ne .Values.proxy.service.nodePorts.pulsar "") }}
nodePort: {{ .Values.proxy.service.nodePorts.pulsar }}
{{- end}}
{{- end }} {{- end }}
{{- if and .Values.tls.enabled .Values.tls.proxy.enabled }} {{- if and .Values.tls.enabled .Values.tls.proxy.enabled }}
- name: https - name: https
port: {{ .Values.proxy.ports.https }} port: {{ .Values.proxy.ports.https }}
protocol: TCP protocol: TCP
targetPort: sts-https targetPort: sts-https
{{- if and (eq .Values.proxy.service.type "NodePort") (ne .Values.proxy.service.nodePorts.https "") }}
nodePort: {{ .Values.proxy.service.nodePorts.https }}
{{- end}}
- name: "{{ .Values.tlsPrefix }}pulsarssl" - name: "{{ .Values.tlsPrefix }}pulsarssl"
port: {{ .Values.proxy.ports.pulsarssl }} port: {{ .Values.proxy.ports.pulsarssl }}
protocol: TCP protocol: TCP
targetPort: "sts-{{ .Values.tlsPrefix }}pulsarssl" targetPort: "sts-{{ .Values.tlsPrefix }}pulsarssl"
{{- if and (eq .Values.proxy.service.type "NodePort") (ne .Values.proxy.service.nodePorts.pulsarssl "") }}
nodePort: {{ .Values.proxy.service.nodePorts.pulsarssl }}
{{- end}}
{{- end }} {{- end }}
selector: selector:
{{- include "pulsar.matchLabels" . | nindent 4 }} {{- include "pulsar.matchLabels" . | nindent 4 }}

View File

@ -1111,6 +1111,13 @@ proxy:
## Restrict traffic through the load balancer to specified IPs on providers supporting it. ## Restrict traffic through the load balancer to specified IPs on providers supporting it.
# loadBalancerSourceRanges: # loadBalancerSourceRanges:
# - 10.0.0.0/8 # - 10.0.0.0/8
# Optional. When setting proxy.service.type is set to NodePort, nodePorts allows to choose the port that will be open on each node to proxy requests to each destination proxy service.
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
nodePorts:
http: ""
https: ""
pulsar: ""
pulsarssl: ""
## Proxy ingress ## Proxy ingress
## templates/proxy-ingress.yaml ## templates/proxy-ingress.yaml
## ##