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

Fix bug in TS health check #1417

Merged
merged 1 commit into from
Mar 1, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
type: boolean
fails:
type: integer
intervals:
interval:
type: string
jitter:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
type: boolean
fails:
type: integer
intervals:
interval:
type: string
jitter:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
type: boolean
fails:
type: integer
intervals:
interval:
type: string
jitter:
type: string
Expand Down
8 changes: 4 additions & 4 deletions internal/configs/transportserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ func generateTransportServerHealthCheck(upstreamHealthCheckName string, upstream
hc = generateTransportServerHealthCheckWithDefaults(u)

hc.Enabled = u.HealthCheck.Enabled
hc.Interval = generateTime(u.HealthCheck.Interval)
hc.Jitter = generateTime(u.HealthCheck.Jitter)
hc.Timeout = generateTime(u.HealthCheck.Timeout)
hc.Interval = generateTime(u.HealthCheck.Interval, hc.Interval)
hc.Jitter = generateTime(u.HealthCheck.Jitter, hc.Jitter)
hc.Timeout = generateTime(u.HealthCheck.Timeout, hc.Timeout)

if u.HealthCheck.Fails > 0 {
hc.Fails = u.HealthCheck.Fails
Expand All @@ -152,7 +152,7 @@ func generateTransportServerHealthCheckWithDefaults(up conf_v1alpha1.Upstream) *
return &version2.StreamHealthCheck{
Enabled: false,
Timeout: "5s",
Jitter: "0",
Jitter: "0s",
Port: up.Port,
Interval: "5s",
Passes: 1,
Expand Down
21 changes: 21 additions & 0 deletions internal/configs/transportserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,27 @@ func TestGenerateTransportServerHealthChecks(t *testing.T) {
},
msg: "valid 2 health checks",
},
{
upstreams: []conf_v1alpha1.Upstream{
{
Name: "dns-tcp",
Port: 90,
HealthCheck: &conf_v1alpha1.HealthCheck{
Enabled: true,
},
},
},
expected: &version2.StreamHealthCheck{
Enabled: true,
Timeout: "5s",
Jitter: "0s",
Port: 90,
Interval: "5s",
Passes: 1,
Fails: 1,
},
msg: "return default values for health check",
},
}

for _, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/configuration/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type HealthCheck struct {
Timeout string `json:"timeout"`
Jitter string `json:"jitter"`
Port int `json:"port"`
Interval string `json:"intervals"`
Interval string `json:"interval"`
Passes int `json:"passes"`
Fails int `json:"fails"`
}
Expand Down