Add $service_port variable
According to TCP/IP (and common sense), $service_name is not enough to uniquely identify service, we need $service_port for that.
This commit is contained in:
parent
eafb1890d6
commit
59aac73785
1 changed files with 4 additions and 0 deletions
|
@ -182,6 +182,7 @@ http {
|
||||||
# $namespace
|
# $namespace
|
||||||
# $ingress_name
|
# $ingress_name
|
||||||
# $service_name
|
# $service_name
|
||||||
|
# $service_port
|
||||||
log_format upstreaminfo {{ if $cfg.LogFormatEscapeJSON }}escape=json {{ end }}'{{ buildLogFormatUpstream $cfg }}';
|
log_format upstreaminfo {{ if $cfg.LogFormatEscapeJSON }}escape=json {{ end }}'{{ buildLogFormatUpstream $cfg }}';
|
||||||
|
|
||||||
{{/* map urls that should not appear in access.log */}}
|
{{/* map urls that should not appear in access.log */}}
|
||||||
|
@ -663,6 +664,7 @@ stream {
|
||||||
proxy_set_header X-Namespace $namespace;
|
proxy_set_header X-Namespace $namespace;
|
||||||
proxy_set_header X-Ingress-Name $ingress_name;
|
proxy_set_header X-Ingress-Name $ingress_name;
|
||||||
proxy_set_header X-Service-Name $service_name;
|
proxy_set_header X-Service-Name $service_name;
|
||||||
|
proxy_set_header X-Service-Port $service_port;
|
||||||
|
|
||||||
rewrite (.*) / break;
|
rewrite (.*) / break;
|
||||||
|
|
||||||
|
@ -837,6 +839,7 @@ stream {
|
||||||
set $namespace "{{ $ing.Namespace }}";
|
set $namespace "{{ $ing.Namespace }}";
|
||||||
set $ingress_name "{{ $ing.Rule }}";
|
set $ingress_name "{{ $ing.Rule }}";
|
||||||
set $service_name "{{ $ing.Service }}";
|
set $service_name "{{ $ing.Service }}";
|
||||||
|
set $service_port "{{ $location.Port }}";
|
||||||
|
|
||||||
{{ if not $all.DisableLua }}
|
{{ if not $all.DisableLua }}
|
||||||
rewrite_by_lua_block {
|
rewrite_by_lua_block {
|
||||||
|
@ -1090,6 +1093,7 @@ stream {
|
||||||
proxy_set_header X-Namespace $namespace;
|
proxy_set_header X-Namespace $namespace;
|
||||||
proxy_set_header X-Ingress-Name $ingress_name;
|
proxy_set_header X-Ingress-Name $ingress_name;
|
||||||
proxy_set_header X-Service-Name $service_name;
|
proxy_set_header X-Service-Name $service_name;
|
||||||
|
proxy_set_header X-Service-Port $service_port;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if not (empty $location.Backend) }}
|
{{ if not (empty $location.Backend) }}
|
||||||
|
|
Loading…
Reference in a new issue