- Notifications
You must be signed in to change notification settings - Fork927
feat(coderd/healthcheck): improve detection of STUN issues#12951
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
c4c1a89
feat(coderd/healthcheck/derphealth): add some STUN-specific checks
johnstcn33b6fb5
fixup! feat(coderd/healthcheck/derphealth): add some STUN-specific ch…
johnstcnca36623
fmt
johnstcn38c6470
feat(support): add messages from healthcheck to support bundle output
johnstcn50fa151
lint
johnstcn6f04178
fix tests
johnstcn56f81fc
document STUN warnings
johnstcnd09e5a1
Merge remote-tracking branch 'origin/main' into cj/stun-diagnose
johnstcnf3f5284
rephrase STUN warnings
johnstcne5da288
only warn about STUN if at least one STUN node is configured
johnstcnf6af0e0
remove auto-summarization for now
johnstcn0c3a1e6
fixup! remove auto-summarization for now
johnstcna96ab2d
fixup! fixup! remove auto-summarization for now
johnstcnFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
5 changes: 3 additions & 2 deletionscli/support.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletionscoderd/healthcheck/derphealth/derp.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -32,6 +32,8 @@ const ( | ||
warningNodeUsesWebsocket = `Node uses WebSockets because the "Upgrade: DERP" header may be blocked on the load balancer.` | ||
oneNodeUnhealthy = "Region is operational, but performance might be degraded as one node is unhealthy." | ||
missingNodeReport = "Missing node health report, probably a developer error." | ||
noSTUN = "No STUN servers are available." | ||
stunMapVaryDest = "STUN returned different addresses; you may be behind a hard NAT." | ||
) | ||
type ReportOptions struct { | ||
@@ -107,9 +109,30 @@ func (r *Report) Run(ctx context.Context, opts *ReportOptions) { | ||
ncReport, netcheckErr := nc.GetReport(ctx, opts.DERPMap) | ||
r.Netcheck = ncReport | ||
r.NetcheckErr = convertError(netcheckErr) | ||
if mapVaryDest, _ := r.Netcheck.MappingVariesByDestIP.Get(); mapVaryDest { | ||
r.Warnings = append(r.Warnings, health.Messagef(health.CodeSTUNMapVaryDest, stunMapVaryDest)) | ||
} | ||
wg.Wait() | ||
// Count the number of STUN-capable nodes. | ||
var stunCapableNodes int | ||
var stunTotalNodes int | ||
for _, region := range r.Regions { | ||
for _, node := range region.NodeReports { | ||
if node.STUN.Enabled { | ||
stunTotalNodes++ | ||
} | ||
if node.STUN.CanSTUN { | ||
stunCapableNodes++ | ||
} | ||
} | ||
} | ||
if stunCapableNodes == 0 && stunTotalNodes > 0 { | ||
r.Severity = health.SeverityWarning | ||
johnstcn marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
r.Warnings = append(r.Warnings, health.Messagef(health.CodeSTUNNoNodes, noSTUN)) | ||
} | ||
// Review region reports and select the highest severity. | ||
for _, regionReport := range r.Regions { | ||
if regionReport.Severity.Value() > r.Severity.Value() { | ||
163 changes: 162 additions & 1 deletioncoderd/healthcheck/derphealth/derp_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletionscoderd/healthcheck/health/model.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletionsdocs/admin/healthcheck.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.