diff --git a/charts/apisix/templates/configmap.yaml b/charts/apisix/templates/configmap.yaml index 61895271..00568339 100644 --- a/charts/apisix/templates/configmap.yaml +++ b/charts/apisix/templates/configmap.yaml @@ -75,16 +75,13 @@ data: enable_ipv6: {{ .Values.apisix.enableIPv6 }} # Enable nginx IPv6 resolver enable_http2: {{ .Values.apisix.enableHTTP2 }} enable_server_tokens: {{ .Values.apisix.enableServerTokens }} # Whether the APISIX version number should be shown in Server header - - # proxy_protocol: # Proxy Protocol configuration - # listen_http_port: 9181 # The port with proxy protocol for http, it differs from node_listen and admin_listen. - # # This port can only receive http request with proxy protocol, but node_listen & admin_listen - # # can only receive http request. If you enable proxy protocol, you must use this port to - # # receive http request with proxy protocol - # listen_https_port: 9182 # The port with proxy protocol for https - # enable_tcp_pp: true # Enable the proxy protocol for tcp proxy, it works for stream_proxy.tcp option - # enable_tcp_pp_to_upstream: true # Enables the proxy protocol to the upstream server - + {{- if .Values.apisix.proxyProtocol.enabled }} + proxy_protocol: + listen_http_port: {{ .Values.apisix.proxyProtocol.listen_http_port | default 9181 }} + listen_https_port: {{ .Values.apisix.proxyProtocol.listen_https_port | default 9182 }} + enable_tcp_pp: {{ .Values.apisix.proxyProtocol.enable_tcp_pp }} + enable_tcp_pp_to_upstream: {{ .Values.apisix.proxyProtocol.enable_tcp_pp_to_upstream }} + {{- end }} proxy_cache: # Proxy Caching configuration cache_ttl: 10s # The default caching time if the upstream does not specify the cache time zones: # The parameters of a cache diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/deployment.yaml index acda6be7..c08feda7 100644 --- a/charts/apisix/templates/deployment.yaml +++ b/charts/apisix/templates/deployment.yaml @@ -108,7 +108,15 @@ spec: - name: http-{{ .port | toString }} containerPort: {{ .port }} protocol: TCP - {{- end }} + {{- end }} + {{- if .Values.apisix.proxyProtocol.enabled }} + - name: proxy-http + containerPort: {{ .Values.apisix.proxyProtocol.listen_http_port | default 9181 }} + protocol: TCP + - name: proxy-https + containerPort: {{ .Values.apisix.proxyProtocol.listen_https_port | default 9182 }} + protocol: TCP + {{- end }} - name: tls containerPort: {{ .Values.apisix.ssl.containerPort }} protocol: TCP diff --git a/charts/apisix/templates/service-gateway.yaml b/charts/apisix/templates/service-gateway.yaml index 7797435a..19d607a1 100644 --- a/charts/apisix/templates/service-gateway.yaml +++ b/charts/apisix/templates/service-gateway.yaml @@ -50,7 +50,11 @@ spec: {{- if .Values.service.http.enabled }} - name: apisix-gateway port: {{ .Values.service.http.servicePort }} + {{- if .Values.apisix.proxyProtocol.enabled }} + targetPort: {{ .Values.apisix.proxyProtocol.listen_http_port | default 9181 }} + {{- else }} targetPort: {{ .Values.service.http.containerPort }} + {{- end }} {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.http.nodePort))) }} nodePort: {{ .Values.service.http.nodePort }} {{- end }} @@ -65,7 +69,11 @@ spec: {{- if or .Values.apisix.ssl.enabled }} - name: apisix-gateway-tls port: {{ .Values.service.tls.servicePort }} + {{- if .Values.apisix.proxyProtocol.enabled }} + targetPort: {{ .Values.apisix.proxyProtocol.listen_https_port | default 9182 }} + {{- else }} targetPort: {{ .Values.apisix.ssl.containerPort }} + {{- end }} {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.tls.nodePort))) }} nodePort: {{ .Values.service.tls.nodePort }} {{- end }} diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml index f7c3a6a9..5b2136fc 100644 --- a/charts/apisix/values.yaml +++ b/charts/apisix/values.yaml @@ -244,8 +244,7 @@ control: ingress: enabled: false # -- Ingress annotations - annotations: - {} + annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" # -- Ingress Class Name @@ -302,7 +301,7 @@ apisix: mounts: # -- Name of the ConfigMap key, for setting the mapping relationship between ConfigMap key and the lua module code path. - key: "" - # -- Filepath of the plugin code, for setting the mapping relationship between ConfigMap key and the lua module code path. + # -- Filepath of the plugin code, for setting the mapping relationship between ConfigMap key and the lua module code path. path: "" ssl: @@ -416,8 +415,7 @@ apisix: ingress: enabled: false # -- Ingress annotations - annotations: - {} + annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" hosts: @@ -478,15 +476,12 @@ apisix: luaSharedDicts: [] # - name: prometheus-metrics # size: 20m - - # -- Override default meta-level [lua_shared_dict](https://github.com/apache/apisix/blob/master/conf/config.yaml.example) settings, - # meta-level shared dicts are shared across both HTTP and stream subsystems. - # Since APISIX 3.16.0, `upstream-healthcheck` is a meta-level shared dict. - # click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict - metaLuaSharedDicts: [] - # - name: upstream-healthcheck - # size: 10m - + proxyProtocol: + enabled: false + listen_http_port: 9181 + listen_https_port: 9182 + enable_tcp_pp: true + enable_tcp_pp_to_upstream: true discovery: # -- Enable or disable Apache APISIX integration service discovery enabled: false