scebll opened a new issue, #912:
URL: https://github.com/apache/apisix-helm-chart/issues/912
The APISIX Helm chart only applies `nodePort` when `service.type` is
`NodePort`, but ignores it for `LoadBalancer` type.
This creates deployment challenges for cloud providers (OCI, etc.) that
require pre-defined node ports for security group/firewall rules.
## Current Behavior
In `templates/service-gateway.yaml` (lines 55-57, 68-71):
```yaml
{{- if (and (eq .Values.service.type "NodePort") (not (empty
.Values.service.http.nodePort))) }}
nodePort: {{ .Values.service.http.nodePort }}
{{- end }}
```
**Problem:** `nodePort` is **only** applied when `type: NodePort`, making it
impossible to have both a cloud LoadBalancer AND a fixed nodePort.
## Expected Behavior (ingress-nginx 'pattern'?)
The **ingress-nginx** chart correctly handles this by checking if the
service type is either `NodePort` OR `LoadBalancer`:
```yaml
{{- $setNodePorts := (or (eq .Values.controller.service.type "NodePort") (eq
.Values.controller.service.type "LoadBalancer")) }}
{{- if .Values.controller.service.enableHttps }}
- name: https
port: {{ .Values.controller.service.ports.https }}
protocol: TCP
targetPort: {{ .Values.controller.service.targetPorts.https }}
{{- if (and $setNodePorts (not (empty
.Values.controller.service.nodePorts.https))) }}
nodePort: {{ .Values.controller.service.nodePorts.https }}
{{- end }}
{{- end }}
```
**Key difference:** `$setNodePorts := (or (eq ... "NodePort") (eq ...
"LoadBalancer"))`; nodePorts are applied for **both** service types.
## Working Example (ingress-nginx) [ingress-nginx service
template](https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/templates/controller-service.yaml#L87)
```yaml
controller:
service:
type: LoadBalancer
loadBalancerIP: "1.2.3.4"
nodePorts:
https: "30443" # this works and creates nodePort: 30443
```
**Result:** LoadBalancer service with **fixed nodePort 30443**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]