Skip to content

Commit 423f789

Browse files
authored
fix(gateway): HPA/DaemonSet conflict, expose PROXY protocol ports on Service (#307)
1 parent fc83304 commit 423f789

6 files changed

Lines changed: 34 additions & 6 deletions

File tree

charts/gateway/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: application
1616
# Versions are expected to follow Semantic Versioning (https://semver.org/)
1717
# major.minor mirrors the API7 EE release line (3.10.x), patch is this chart's
1818
# own counter on that line and is decoupled from the app patch (see appVersion).
19-
version: 3.10.3
19+
version: 3.10.4
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to

charts/gateway/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ The command removes all the Kubernetes components associated with the chart and
101101
| apisix.proxyCache | object | `{"cacheTtl":"10s","zones":[{"cache_levels":"1:2","disk_path":"/tmp/disk_cache_one","disk_size":"1G","memory_size":"50m","name":"disk_cache_one"},{"memory_size":"50m","name":"memory_cache"}]}` | Proxy caching configuration used by the proxy-cache plugin. |
102102
| apisix.proxyCache.cacheTtl | string | `"10s"` | The default caching time in disk if the upstream does not specify the cache time |
103103
| apisix.proxyCache.zones | list | `[{"cache_levels":"1:2","disk_path":"/tmp/disk_cache_one","disk_size":"1G","memory_size":"50m","name":"disk_cache_one"},{"memory_size":"50m","name":"memory_cache"}]` | The parameters of a cache. The `memory_size` field stores the cache index for the disk strategy and the cache content for the memory strategy; `disk_size`, `disk_path` and `cache_levels` only apply to the disk strategy. |
104-
| apisix.proxyProtocol | object | `{"enableTcpPP":false,"enableTcpPPToUpstream":false,"listenHttpPort":null,"listenHttpsPort":null}` | PROXY Protocol configuration. |
104+
| apisix.proxyProtocol | object | `{"enableTcpPP":false,"enableTcpPPToUpstream":false,"listenHttpNodePort":null,"listenHttpPort":null,"listenHttpsNodePort":null,"listenHttpsPort":null}` | PROXY Protocol configuration. |
105105
| apisix.proxyProtocol.enableTcpPP | bool | `false` | Accept the PROXY Protocol on every gateway.stream.tcp port. Acts as the default; override per port with the `proxy_protocol` field on a gateway.stream.tcp entry. |
106106
| apisix.proxyProtocol.enableTcpPPToUpstream | bool | `false` | Send the PROXY Protocol to the upstream server on every gateway.stream.tcp port. Acts as the default; override per port with the `proxy_protocol_to_upstream` field on a gateway.stream.tcp entry. |
107-
| apisix.proxyProtocol.listenHttpPort | int | `nil` | The HTTP port that accepts the PROXY Protocol. It differs from `gateway.http` ports and `admin` port: this port only accepts HTTP requests carrying the PROXY Protocol, while the other ports only accept plain HTTP requests. If you enable the PROXY Protocol, you must use this port to receive HTTP requests with it. |
108-
| apisix.proxyProtocol.listenHttpsPort | int | `nil` | The HTTPS port that accepts the PROXY Protocol. |
107+
| apisix.proxyProtocol.listenHttpNodePort | int | `nil` | The nodePort of the PROXY Protocol HTTP port, only used if gateway.type is NodePort. If not set, a random port will be assigned by Kubernetes. |
108+
| apisix.proxyProtocol.listenHttpPort | int | `nil` | The HTTP port that accepts the PROXY Protocol. It differs from `gateway.http` ports and `admin` port: this port only accepts HTTP requests carrying the PROXY Protocol, while the other ports only accept plain HTTP requests. If you enable the PROXY Protocol, you must use this port to receive HTTP requests with it. When set, the port is also exposed on the gateway Service. |
109+
| apisix.proxyProtocol.listenHttpsNodePort | int | `nil` | The nodePort of the PROXY Protocol HTTPS port, only used if gateway.type is NodePort. If not set, a random port will be assigned by Kubernetes. |
110+
| apisix.proxyProtocol.listenHttpsPort | int | `nil` | The HTTPS port that accepts the PROXY Protocol. When set, the port is also exposed on the gateway Service. |
109111
| apisix.replicaCount | int | `1` | kind is DaemonSet, replicaCount not become effective |
110112
| apisix.resources | object | `{}` | Set pod resource requests & limits |
111113
| apisix.securityContext | object | `{}` | Set the securityContext for API7 Gateway container |

charts/gateway/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data:
4141
enable_reuseport: true # Enable nginx SO_REUSEPORT switch if set to true.
4242
enable_ipv6: {{ .Values.apisix.enableIPv6 }} # Enable nginx IPv6 resolver
4343
enable_server_tokens: {{ .Values.apisix.enableServerTokens }} # Whether the APISIX version number should be shown in Server header
44-
show_upstream_status_in_response_header: {{ .Values.apisix.showUpstreamStatusInResponseHeader }} # when true all upstream status write to `X-APISIX-Upstream-Status` otherwise only 5xx code
44+
show_upstream_status_in_response_header: {{ .Values.apisix.showUpstreamStatusInResponseHeader }} # when true, all upstream statuses are written to `X-APISIX-Upstream-Status`; otherwise only 5xx codes
4545
4646
{{- with .Values.apisix.trustedAddresses }}
4747
trusted_addresses: # When configured, APISIX will trust the `X-Forwarded-*` Headers passed in requests from the IP/CIDR in the list.

charts/gateway/templates/hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.apisix.enabled .Values.autoscaling.enabled }}
1+
{{- if and .Values.apisix.enabled .Values.autoscaling.enabled (eq .Values.apisix.kind "Deployment") }}
22

33
apiVersion: autoscaling/{{ .Values.autoscaling.version }}
44
kind: HorizontalPodAutoscaler

charts/gateway/templates/service-gateway.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ spec:
7373
nodePort: {{ .nodePort }}
7474
{{- end }}
7575
{{- end }}
76+
{{- if .Values.apisix.proxyProtocol.listenHttpPort }}
77+
- name: apisix-gateway-pp
78+
port: {{ .Values.apisix.proxyProtocol.listenHttpPort }}
79+
targetPort: {{ .Values.apisix.proxyProtocol.listenHttpPort }}
80+
{{- if (and (eq .Values.gateway.type "NodePort") (not (empty .Values.apisix.proxyProtocol.listenHttpNodePort))) }}
81+
nodePort: {{ .Values.apisix.proxyProtocol.listenHttpNodePort }}
82+
{{- end }}
83+
protocol: TCP
84+
{{- end }}
85+
{{- if .Values.apisix.proxyProtocol.listenHttpsPort }}
86+
- name: apisix-gateway-pp-tls
87+
port: {{ .Values.apisix.proxyProtocol.listenHttpsPort }}
88+
targetPort: {{ .Values.apisix.proxyProtocol.listenHttpsPort }}
89+
{{- if (and (eq .Values.gateway.type "NodePort") (not (empty .Values.apisix.proxyProtocol.listenHttpsNodePort))) }}
90+
nodePort: {{ .Values.apisix.proxyProtocol.listenHttpsNodePort }}
91+
{{- end }}
92+
protocol: TCP
93+
{{- end }}
7694
{{- if .Values.serviceMonitor.enabled }}
7795
- name: prometheus
7896
port: {{ .Values.serviceMonitor.containerPort }}

charts/gateway/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,17 @@ apisix:
5959
# -- (int) The HTTP port that accepts the PROXY Protocol. It differs from `gateway.http` ports and `admin` port:
6060
# this port only accepts HTTP requests carrying the PROXY Protocol, while the other ports only accept plain HTTP
6161
# requests. If you enable the PROXY Protocol, you must use this port to receive HTTP requests with it.
62+
# When set, the port is also exposed on the gateway Service.
6263
listenHttpPort:
64+
# -- (int) The nodePort of the PROXY Protocol HTTP port, only used if gateway.type is NodePort.
65+
# If not set, a random port will be assigned by Kubernetes.
66+
listenHttpNodePort:
6367
# -- (int) The HTTPS port that accepts the PROXY Protocol.
68+
# When set, the port is also exposed on the gateway Service.
6469
listenHttpsPort:
70+
# -- (int) The nodePort of the PROXY Protocol HTTPS port, only used if gateway.type is NodePort.
71+
# If not set, a random port will be assigned by Kubernetes.
72+
listenHttpsNodePort:
6573
# -- Accept the PROXY Protocol on every gateway.stream.tcp port. Acts as the default;
6674
# override per port with the `proxy_protocol` field on a gateway.stream.tcp entry.
6775
enableTcpPP: false

0 commit comments

Comments
 (0)