This is an automated email from the ASF dual-hosted git repository.
AlinsRan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git
The following commit(s) were added to refs/heads/master by this push:
new f87944a feat(apisix): add hostPort support (fixes #301) (#966)
f87944a is described below
commit f87944a5bc567a14fb9106590eb2ef32088dde86
Author: b4u-mw <[email protected]>
AuthorDate: Wed Sep 30 09:03:31 2026 +0200
feat(apisix): add hostPort support (fixes #301) (#966)
---
charts/apisix/README.md | 4 +++-
charts/apisix/templates/deployment.yaml | 6 ++++++
charts/apisix/values.yaml | 4 ++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 48d1f20..bcf1a63 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -176,6 +176,7 @@ The command removes all the Kubernetes components
associated with the chart and
| apisix.ssl.enabled | bool | `false` | Enable HTTPS listeners |
| apisix.ssl.existingCASecret | string | `""` | Specifies the name of Secret
contains trusted CA certificates in the PEM format used to verify the
certificate when APISIX needs to do SSL/TLS handshaking with external services
(e.g. etcd) |
| apisix.ssl.fallbackSNI | string | `""` | Define SNI to fallback if none is
presented by client |
+| apisix.ssl.hostPort | number | `nil` | Bind the APISIX HTTPS container port
to a host port. |
| apisix.ssl.sslCiphers | string |
`"ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-
[...]
| apisix.ssl.sslProtocols | string | `"TLSv1.2 TLSv1.3"` | TLS protocols
allowed to use. |
| apisix.ssl.sslSessionTickets | bool | `false` | Enable or disable TLS
session tickets. Disabled by default because session tickets defeat Perfect
Forward Secrecy (see https://github.com/mozilla/server-side-tls/issues/135) |
@@ -281,10 +282,11 @@ The command removes all the Kubernetes components
associated with the chart and
| securityContext | object | `{}` | Set the securityContext for Apache APISIX
container |
| service.externalIPs | list | `[]` | IPs for which nodes in the cluster will
also accept traffic for the service |
| service.externalTrafficPolicy | string | `"Cluster"` | Setting how the
Service route external traffic. If you want to keep the client source IP, you
can set this to Local, ref:
https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
|
-| service.http | object |
`{"additionalContainerPorts":[],"containerPort":9080,"enabled":true,"servicePort":80}`
| Apache APISIX service settings for http |
+| service.http | object |
`{"additionalContainerPorts":[],"containerPort":9080,"enabled":true,"hostPort":null,"servicePort":80}`
| Apache APISIX service settings for http |
| service.http.additionalContainerPorts | list | `[]` | Support multiple http
ports, See
[Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L24)
|
| service.http.containerPort | int | `9080` | Container port APISIX listens on
for HTTP traffic |
| service.http.enabled | bool | `true` | Enable plain HTTP listeners |
+| service.http.hostPort | number | `nil` | Bind the APISIX HTTP container port
to a host port. |
| service.http.servicePort | int | `80` | Kubernetes service port for HTTP
traffic |
| service.labelsOverride | object | `{}` | Override default labels assigned to
Apache APISIX gateway resources |
| service.stream | object | `{"enabled":false,"tcp":[],"udp":[]}` | Apache
APISIX service settings for stream. L4 proxy (TCP/UDP) |
diff --git a/charts/apisix/templates/deployment.yaml
b/charts/apisix/templates/deployment.yaml
index acda6be..37d54eb 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/deployment.yaml
@@ -104,6 +104,9 @@ spec:
- name: http
containerPort: {{ .Values.service.http.containerPort }}
protocol: TCP
+ {{- with .Values.service.http.hostPort }}
+ hostPort: {{ . }}
+ {{- end }}
{{- range .Values.service.http.additionalContainerPorts }}
- name: http-{{ .port | toString }}
containerPort: {{ .port }}
@@ -112,6 +115,9 @@ spec:
- name: tls
containerPort: {{ .Values.apisix.ssl.containerPort }}
protocol: TCP
+ {{- if and .Values.apisix.ssl.enabled .Values.apisix.ssl.hostPort
}}
+ hostPort: {{ .Values.apisix.ssl.hostPort }}
+ {{- end }}
{{- range .Values.apisix.ssl.additionalContainerPorts }}
- name: tls-{{ .port | toString }}
containerPort: {{ .port }}
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 703b425..e79e050 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -192,6 +192,8 @@ service:
servicePort: 80
# -- Container port APISIX listens on for HTTP traffic
containerPort: 9080
+ # -- (number) Bind the APISIX HTTP container port to a host port.
+ hostPort:
# -- Support multiple http ports, See
[Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L24)
additionalContainerPorts: []
# - port: 9081
@@ -406,6 +408,8 @@ apisix:
enabled: false
# -- Container port APISIX listens on for HTTPS traffic
containerPort: 9443
+ # -- (number) Bind the APISIX HTTPS container port to a host port.
+ hostPort:
# -- Support multiple https ports, See
[Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L99)
additionalContainerPorts: []
# - ip: 127.0.0.3 # Specific IP, If not set, the default value
is `0.0.0.0`.