-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Bug/bz1507664 suppress health checks #17155
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,28 +157,16 @@ func processEndpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit, action | |
} | ||
|
||
func endpointsForAlias(alias ServiceAliasConfig, svc ServiceUnit) []Endpoint { | ||
if len(alias.PreferPort) == 0 && len(svc.EndpointTable) != 1 { | ||
// We can skip the work. They are selecting everything, and since they don't have one endpoint, | ||
// we can't disable the health checks. So we can just use their list. | ||
if len(alias.PreferPort) == 0 { | ||
return svc.EndpointTable | ||
} | ||
|
||
endpoints := make([]Endpoint, 0, len(svc.EndpointTable)) | ||
for _, endpoint := range svc.EndpointTable { | ||
// Filter the list: | ||
// - If PreferPort length is 0, match everything | ||
// - Otherwise, if the PortName or Port matches PreferPort, then we have a match | ||
if len(alias.PreferPort) == 0 || endpoint.PortName == alias.PreferPort || endpoint.Port == alias.PreferPort { | ||
for i := range svc.EndpointTable { | ||
endpoint := svc.EndpointTable[i] | ||
if endpoint.PortName == alias.PreferPort || endpoint.Port == alias.PreferPort { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you need the len(alias.PreferPort) == 0 to avoid a segfault? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pecameron There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two commits in this PR. The first simply reverts my previous bad PR restoring the previous behavior. It probably makes sense to look at the second commit only. |
||
endpoints = append(endpoints, endpoint) | ||
} | ||
} | ||
|
||
// We want to disable endpoint checks if there is only one endpoint since there's no point in | ||
// testing and removing it from the set ahead of time since there are no other eps to replace it. | ||
if len(endpoints) == 1 { | ||
endpoints[0].NoHealthCheck = true | ||
} | ||
|
||
return endpoints | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When weight >= 256, don't we want to set it to 0?
Otherwise in Line 918, we count this serviceUnit toward active endpoints which doesn't seem right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we want to ignore the service unit if the corresponding weight is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weight=0 clearly means user want to ignore the endpoint but weight > 256 means mostly some typo/calculation error and may not mean ignore the endpoint.
It may be useful to log a warning when we are defaulting invalid weights to 0 or 256?