Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry-pick] Fix: GRPC healthcheck should not have keepalive time #5921

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 72 additions & 132 deletions internal/configs/version2/__snapshots__/templates_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -627,23 +622,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -1999,23 +1989,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -2371,23 +2356,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -2800,23 +2780,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -3227,23 +3202,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -3654,23 +3624,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -4083,23 +4048,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -4512,23 +4472,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -4941,23 +4896,18 @@ server {gunzip on;
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -5370,23 +5320,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down Expand Up @@ -6243,23 +6188,18 @@ server {
proxy_read_timeout ;
proxy_send_timeout ;
proxy_pass http://coffee-v2;
health_check uri=/ port=50 interval=5s jitter=0s
fails=1 passes=1
mandatory persistent
keepalive_time=;
}
health_check uri=/ port=50 interval=5s jitter=0s fails=1 passes=1 mandatory persistent keepalive_time=60s;

}
location @hc-tea {

grpc_connect_timeout ;
grpc_read_timeout ;
grpc_send_timeout ;
grpc_pass grpc://tea-v3;
health_check port=50 interval=5s jitter=0s
fails=1 passes=1

type=grpc grpc_status=12
grpc_service=tea-servicev2 keepalive_time=;
}
health_check port=50 interval=5s jitter=0s fails=1 passes=1 type=grpc grpc_status=12 grpc_service=tea-servicev2;

}
location @vs_cafe_cafe_vsr_tea_tea_tea__tea_error_page_0 {

default_type "application/json";
Expand Down
1 change: 1 addition & 0 deletions internal/configs/version2/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ type HealthCheck struct {
Mandatory bool
Persistent bool
KeepaliveTime string
IsGRPC bool
}

// TLSRedirect defines a redirect in a Server.
Expand Down
17 changes: 11 additions & 6 deletions internal/configs/version2/nginx-plus.virtualserver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,17 @@ server {
{{- else }}
proxy_pass {{ $hc.ProxyPass }};
{{- end }}
health_check {{ if $hc.URI }}uri={{ $hc.URI }} {{ end }}{{ if $hc.Port }}port={{ $hc.Port }} {{ end }}interval={{ $hc.Interval }} jitter={{ $hc.Jitter }}
fails={{ $hc.Fails }} passes={{ $hc.Passes }}{{ if $hc.Match }} match={{ $hc.Match }}{{ end }}
{{ if $hc.Mandatory }} mandatory{{ if $hc.Persistent }} persistent{{ end }}{{ end }}
{{ if $hc.GRPCPass }} type=grpc{{ if $hc.GRPCStatus }} grpc_status={{ $hc.GRPCStatus }}{{ end }}
{{ if $hc.GRPCService }} grpc_service={{ $hc.GRPCService }}{{ end }}{{ end }} keepalive_time={{ $hc.KeepaliveTime }};
}
health_check{{- if $hc.URI }} uri={{ $hc.URI }} {{ end -}}
{{- if $hc.Port }} port={{ $hc.Port }} {{ end -}}
interval={{ $hc.Interval }} jitter={{ $hc.Jitter }} fails={{ $hc.Fails }} passes={{ $hc.Passes }}
{{- if $hc.Match }} match={{ $hc.Match }}{{- end -}}
{{- if $hc.Mandatory }} mandatory {{ end -}}
{{- if $hc.Persistent }} persistent {{ end -}}
{{- if not $hc.IsGRPC }} keepalive_time={{ $hc.KeepaliveTime }}{{ end -}}
{{- if $hc.GRPCPass }} type=grpc{{- if $hc.GRPCStatus }} grpc_status={{ $hc.GRPCStatus }}{{- end -}}
{{- if $hc.GRPCService }} grpc_service={{ $hc.GRPCService }}{{- end -}}{{ end -}};

}
{{- end }}

{{- range $e := $s.ErrorPageLocations }}
Expand Down
Loading
Loading