Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.53
version: 0.2.54

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
6 changes: 4 additions & 2 deletions charts/gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ The command removes all the Kubernetes components associated with the chart and
| gateway.labelsOverride | object | `{}` | Override default labels assigned to API7 Gateway gateway resources |
| gateway.livenessProbe | object | `{}` | kubernetes liveness probe. |
| gateway.readinessProbe | object | `{}` | kubernetes readiness probe, we will provide a probe based on tcpSocket to gateway's HTTP port by default. |
| gateway.stream | object | `{"enabled":false,"only":false,"tcp":[],"udp":[]}` | API7 Gateway service settings for stream. L4 proxy (TCP/UDP) |
| gateway.stream | object | `{"autoAssignNodePort":false,"enabled":false,"only":false,"tcp":[],"udp":[]}` | API7 Gateway service settings for stream. L4 proxy (TCP/UDP) |
| gateway.stream.autoAssignNodePort | bool | `false` | Whether to set nodePort to the same value as the TCP/UDP port when gateway.type is NodePort, make sure the nodePort to be in the valid NodePort range of kubernetes service. |
| gateway.tls | object | `{"additionalContainerPorts":[],"certCAFilename":"","containerPort":9443,"enabled":true,"existingCASecret":"","fallbackSNI":"","http2":{"enabled":true},"ip":"0.0.0.0","nodePort":null,"servicePort":443,"sslProtocols":"TLSv1.2 TLSv1.3"}` | API7 Gateway service settings for tls |
| gateway.tls.additionalContainerPorts | list | `[]` | Support multiple https ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L99) |
| gateway.tls.certCAFilename | string | `""` | Filename be used in the gateway.tls.existingCASecret |
Expand Down Expand Up @@ -234,7 +235,7 @@ The command removes all the Kubernetes components associated with the chart and
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `false` | |
| serviceAccount.name | string | `""` | |
| serviceMonitor | object | `{"annotations":{},"containerPort":9091,"enabled":false,"interval":"15s","labels":{},"metricPrefix":"apisix_","name":"","namespace":"","path":"/apisix/prometheus/metrics"}` | Observability configuration. ref: https://apisix.apache.org/docs/apisix/plugins/prometheus/ |
| serviceMonitor | object | `{"annotations":{},"containerPort":9091,"enabled":false,"interval":"15s","labels":{},"metricPrefix":"apisix_","name":"","namespace":"","nodePort":null,"path":"/apisix/prometheus/metrics"}` | Observability configuration. ref: https://apisix.apache.org/docs/apisix/plugins/prometheus/ |
| serviceMonitor.annotations | object | `{}` | @param serviceMonitor.annotations ServiceMonitor annotations |
| serviceMonitor.containerPort | int | `9091` | container port where the metrics are exposed |
| serviceMonitor.enabled | bool | `false` | Enable or disable API7 Gateway serviceMonitor |
Expand All @@ -243,6 +244,7 @@ The command removes all the Kubernetes components associated with the chart and
| serviceMonitor.metricPrefix | string | `"apisix_"` | prefix of the metrics |
| serviceMonitor.name | string | `""` | name of the serviceMonitor, by default, it is the same as the apisix fullname |
| serviceMonitor.namespace | string | `""` | namespace where the serviceMonitor is deployed, by default, it is the same as the namespace of the apisix |
| serviceMonitor.nodePort | int | `nil` | The nodePort of kubernetes service, only used if gateway.type is NodePort. If not set, a random port will be assigned by Kubernetes. |
| serviceMonitor.path | string | `"/apisix/prometheus/metrics"` | path of the metrics endpoint |
| soapProxy.enabled | bool | `false` | Enable or disable the SOAP proxy, this component is disabled by default, when use soap-proxy plugin in API7, you need to enable this component. |
| soapProxy.image.pullPolicy | string | `"IfNotPresent"` | SOAP proxy image pull policy |
Expand Down
29 changes: 27 additions & 2 deletions charts/gateway/templates/service-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ spec:
- name: prometheus
port: {{ .Values.serviceMonitor.containerPort }}
targetPort: {{ .Values.serviceMonitor.containerPort }}
{{- if (and (eq .Values.gateway.type "NodePort") (not (empty .Values.serviceMonitor.nodePort))) }}
nodePort: {{ .Values.serviceMonitor.nodePort }}
{{- end }}
protocol: TCP
{{- end }}
{{- if .Values.api7ee.status_endpoint.enabled }}
Expand All @@ -94,12 +97,23 @@ spec:
{{- if kindIs "map" $port }}
port: {{ splitList ":" ($port.addr | toString) | last }}
targetPort: {{ splitList ":" ($port.addr | toString) | last }}
{{- if (and (eq $global.Values.gateway.type "NodePort") (not (empty $port.nodePort))) }}
{{- if eq $global.Values.gateway.type "NodePort" }}
{{- if $global.Values.gateway.stream.autoAssignNodePort }}
nodePort: {{ splitList ":" ($port.addr | toString) | last }}
{{- else }}
{{- if not (empty $port.nodePort) }}
nodePort: {{ $port.nodePort }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
port: {{ $port }}
targetPort: {{ $port }}
{{- if eq $global.Values.gateway.type "NodePort" }}
{{- if $global.Values.gateway.stream.autoAssignNodePort }}
nodePort: {{ $port }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -110,12 +124,23 @@ spec:
{{- if kindIs "map" $port }}
port: {{ splitList ":" ($port.addr | toString) | last }}
targetPort: {{ splitList ":" ($port.addr | toString) | last }}
{{- if (and (eq $global.Values.gateway.type "NodePort") (not (empty $port.nodePort))) }}
{{- if eq $global.Values.gateway.type "NodePort" }}
{{- if $global.Values.gateway.stream.autoAssignNodePort }}
nodePort: {{ splitList ":" ($port.addr | toString) | last }}
{{- else }}
{{- if not (empty $port.nodePort) }}
nodePort: {{ $port.nodePort }}
{{- end }}
{{- end }}
{{- end }}
Comment on lines +127 to +135
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-assign nodePort logic may not work as expected. When autoAssignNodePort is true, the code sets nodePort to the port value extracted from the address. However, if a user specifies addr: 5353 (a port outside the typical Kubernetes nodePort range of 30000-32767), this will fail when the service is created. The comment in values.yaml warns users to ensure the port is in the valid range, but the template doesn't validate or handle this case. Consider adding validation or a more explicit error message in the template comments to make this limitation clearer.

Copilot uses AI. Check for mistakes.
{{- else }}
port: {{ $port }}
targetPort: {{ $port }}
{{- if eq $global.Values.gateway.type "NodePort" }}
{{- if $global.Values.gateway.stream.autoAssignNodePort }}
nodePort: {{ $port }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions charts/gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ gateway:
stream:
enabled: false
only: false
# -- Whether to set nodePort to the same value as the TCP/UDP port when gateway.type is NodePort, make sure the nodePort to be in the valid NodePort range of kubernetes service.
autoAssignNodePort: false
tcp: []
# - addr: 192.168.31.10:5432
# - addr: 3302
Expand Down Expand Up @@ -592,6 +594,8 @@ serviceMonitor:
metricPrefix: apisix_
# -- container port where the metrics are exposed
containerPort: 9091
# -- (int) The nodePort of kubernetes service, only used if gateway.type is NodePort. If not set, a random port will be assigned by Kubernetes.
nodePort:
# -- @param serviceMonitor.labels ServiceMonitor extra labels
labels: {}
# -- @param serviceMonitor.annotations ServiceMonitor annotations
Expand Down
Loading