Skip to content

Commit 50cdd32

Browse files
committed
feat(apisix): add hostPort support (fixes #301)
1 parent 60c9cbb commit 50cdd32

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

charts/apisix/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ The command removes all the Kubernetes components associated with the chart and
127127
| apisix.ssl.enabled | bool | `false` | |
128128
| 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) |
129129
| apisix.ssl.fallbackSNI | string | `""` | Define SNI to fallback if none is presented by client |
130+
| apisix.ssl.hostPort | number | `nil` | Bind the APISIX HTTPS container port to a host port. |
130131
| 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-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA"` | TLS ciphers allowed to use. |
131132
| apisix.ssl.sslProtocols | string | `"TLSv1.2 TLSv1.3"` | TLS protocols allowed to use. |
132133
| apisix.status.ip | string | `"0.0.0.0"` | |
@@ -218,8 +219,9 @@ The command removes all the Kubernetes components associated with the chart and
218219
| securityContext | object | `{}` | Set the securityContext for Apache APISIX container |
219220
| service.externalIPs | list | `[]` | |
220221
| service.externalTrafficPolicy | string | `"Cluster"` | |
221-
| service.http | object | `{"additionalContainerPorts":[],"containerPort":9080,"enabled":true,"servicePort":80}` | Apache APISIX service settings for http |
222+
| service.http | object | `{"additionalContainerPorts":[],"containerPort":9080,"enabled":true,"hostPort":null,"servicePort":80}` | Apache APISIX service settings for http |
222223
| service.http.additionalContainerPorts | list | `[]` | Support multiple http ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L24) |
224+
| service.http.hostPort | number | `nil` | Bind the APISIX HTTP container port to a host port. |
223225
| service.labelsOverride | object | `{}` | Override default labels assigned to Apache APISIX gateway resources |
224226
| service.stream | object | `{"enabled":false,"tcp":[],"udp":[]}` | Apache APISIX service settings for stream. L4 proxy (TCP/UDP) |
225227
| service.tls | object | `{"servicePort":443}` | Apache APISIX service settings for tls |

charts/apisix/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ spec:
104104
- name: http
105105
containerPort: {{ .Values.service.http.containerPort }}
106106
protocol: TCP
107+
{{- with .Values.service.http.hostPort }}
108+
hostPort: {{ . }}
109+
{{- end }}
107110
{{- range .Values.service.http.additionalContainerPorts }}
108111
- name: http-{{ .port | toString }}
109112
containerPort: {{ .port }}
@@ -112,6 +115,9 @@ spec:
112115
- name: tls
113116
containerPort: {{ .Values.apisix.ssl.containerPort }}
114117
protocol: TCP
118+
{{- if and .Values.apisix.ssl.enabled .Values.apisix.ssl.hostPort }}
119+
hostPort: {{ .Values.apisix.ssl.hostPort }}
120+
{{- end }}
115121
{{- range .Values.apisix.ssl.additionalContainerPorts }}
116122
- name: tls-{{ .port | toString }}
117123
containerPort: {{ .port }}

charts/apisix/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ service:
177177
enabled: true
178178
servicePort: 80
179179
containerPort: 9080
180+
# -- (number) Bind the APISIX HTTP container port to a host port.
181+
hostPort:
180182
# -- Support multiple http ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L24)
181183
additionalContainerPorts: []
182184
# - port: 9081
@@ -308,6 +310,8 @@ apisix:
308310
ssl:
309311
enabled: false
310312
containerPort: 9443
313+
# -- (number) Bind the APISIX HTTPS container port to a host port.
314+
hostPort:
311315
# -- Support multiple https ports, See [Configuration](https://github.com/apache/apisix/blob/0bc65ea9acd726f79f80ae0abd8f50b7eb172e3d/conf/config-default.yaml#L99)
312316
additionalContainerPorts: []
313317
# - ip: 127.0.0.3 # Specific IP, If not set, the default value is `0.0.0.0`.

0 commit comments

Comments
 (0)