Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3129741

Browse files
authored
chore: Proxy health status checks + endpoint (#7233)
* chore: Implement workspace proxy health check cronAt a given interval will check the reachability of workspace proxies.* Proxyhealth is an enterprise feature* Start proxyhealth go routine on enterprise coder
1 parent63e68c1 commit3129741

File tree

13 files changed

+912
-60
lines changed

13 files changed

+912
-60
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎codersdk/workspaceproxy.go‎

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,55 @@ import (
1212
"github.com/google/uuid"
1313
)
1414

15+
typeProxyHealthStatusstring
16+
17+
const (
18+
// ProxyReachable means the proxy access url is reachable and returns a healthy
19+
// status code.
20+
ProxyReachableProxyHealthStatus="reachable"
21+
// ProxyUnreachable means the proxy access url is not responding.
22+
ProxyUnreachableProxyHealthStatus="unreachable"
23+
// ProxyUnhealthy means the proxy access url is responding, but there is some
24+
// problem with the proxy. This problem may or may not be preventing functionality.
25+
ProxyUnhealthyProxyHealthStatus="unhealthy"
26+
// ProxyUnregistered means the proxy has not registered a url yet. This means
27+
// the proxy was created with the cli, but has not yet been started.
28+
ProxyUnregisteredProxyHealthStatus="unregistered"
29+
)
30+
31+
typeWorkspaceProxyStatusstruct {
32+
StatusProxyHealthStatus`json:"status" table:"status"`
33+
// Report provides more information about the health of the workspace proxy.
34+
ReportProxyHealthReport`json:"report,omitempty" table:"report"`
35+
CheckedAt time.Time`json:"checked_at" table:"checked_at" format:"date-time"`
36+
}
37+
38+
// ProxyHealthReport is a report of the health of the workspace proxy.
39+
// A healthy report will have no errors. Warnings are not fatal.
40+
typeProxyHealthReportstruct {
41+
// Errors are problems that prevent the workspace proxy from being healthy
42+
Errors []string
43+
// Warnings do not prevent the workspace proxy from being healthy, but
44+
// should be addressed.
45+
Warnings []string
46+
}
47+
1548
typeWorkspaceProxystruct {
16-
ID uuid.UUID`db:"id"json:"id" format:"uuid" table:"id"`
17-
Namestring`db:"name"json:"name" table:"name,default_sort"`
18-
Iconstring`db:"icon"json:"icon" table:"icon"`
49+
ID uuid.UUID`json:"id" format:"uuid" table:"id"`
50+
Namestring`json:"name" table:"name,default_sort"`
51+
Iconstring`json:"icon" table:"icon"`
1952
// Full url including scheme of the proxy api url: https://us.example.com
20-
URLstring`db:"url"json:"url" table:"url"`
53+
URLstring`json:"url" table:"url"`
2154
// WildcardHostname with the wildcard for subdomain based app hosting: *.us.example.com
22-
WildcardHostnamestring`db:"wildcard_hostname" json:"wildcard_hostname" table:"wildcard_hostname"`
23-
CreatedAt time.Time`db:"created_at" json:"created_at" format:"date-time" table:"created_at"`
24-
UpdatedAt time.Time`db:"updated_at" json:"updated_at" format:"date-time" table:"updated_at"`
25-
Deletedbool`db:"deleted" json:"deleted" table:"deleted"`
55+
WildcardHostnamestring`json:"wildcard_hostname" table:"wildcard_hostname"`
56+
CreatedAt time.Time`json:"created_at" format:"date-time" table:"created_at"`
57+
UpdatedAt time.Time`json:"updated_at" format:"date-time" table:"updated_at"`
58+
Deletedbool`json:"deleted" table:"deleted"`
59+
60+
// Status is the latest status check of the proxy. This will be empty for deleted
61+
// proxies. This value can be used to determine if a workspace proxy is healthy
62+
// and ready to use.
63+
StatusWorkspaceProxyStatus`json:"status,omitempty" table:"status"`
2664
}
2765

2866
typeCreateWorkspaceProxyRequeststruct {

‎docs/api/enterprise.md‎

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,14 @@ curl -X GET http://coder-server:8080/api/v2/workspaceproxies \
11851185
"icon":"string",
11861186
"id":"497f6eca-6276-4993-bfeb-53cbbbba6f08",
11871187
"name":"string",
1188+
"status": {
1189+
"checked_at":"2019-08-24T14:15:22Z",
1190+
"report": {
1191+
"errors": ["string"],
1192+
"warnings": ["string"]
1193+
},
1194+
"status":"reachable"
1195+
},
11881196
"updated_at":"2019-08-24T14:15:22Z",
11891197
"url":"string",
11901198
"wildcard_hostname":"string"
@@ -1202,17 +1210,32 @@ curl -X GET http://coder-server:8080/api/v2/workspaceproxies \
12021210

12031211
Status Code**200**
12041212

1205-
| Name| Type| Required| Restrictions| Description|
1206-
| ---------------------| -----------------| --------| ------------| --------------------------------------------------------------------------------------|
1207-
|`[array item]`| array| false|||
1208-
|`» created_at`| string(date-time)| false|||
1209-
|`» deleted`| boolean| false|||
1210-
|`» icon`| string| false|||
1211-
|`» id`| string(uuid)| false|||
1212-
|`» name`| string| false|||
1213-
|`» updated_at`| string(date-time)| false|||
1214-
|`» url`| string| false|| Full URL including scheme of the proxy api url:https://us.example.com|
1215-
|`» wildcard_hostname`| string| false|| Wildcard hostname with the wildcard for subdomain based app hosting:\*.us.example.com|
1213+
| Name| Type| Required| Restrictions| Description|
1214+
| ---------------------| ------------------------------------------------------------------------| --------| ------------| -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1215+
|`[array item]`| array| false|||
1216+
|`» created_at`| string(date-time)| false|||
1217+
|`» deleted`| boolean| false|||
1218+
|`» icon`| string| false|||
1219+
|`» id`| string(uuid)| false|||
1220+
|`» name`| string| false|||
1221+
|`» status`|[codersdk.WorkspaceProxyStatus](schemas.md#codersdkworkspaceproxystatus)| false|| Status is the latest status check of the proxy. This will be empty for deleted proxies. This value can be used to determine if a workspace proxy is healthy and ready to use.|
1222+
|`»» checked_at`| string(date-time)| false|||
1223+
|`»» report`|[codersdk.ProxyHealthReport](schemas.md#codersdkproxyhealthreport)| false|| Report provides more information about the health of the workspace proxy.|
1224+
|`»»» errors`| array| false|| Errors are problems that prevent the workspace proxy from being healthy|
1225+
|`»»» warnings`| array| false|| Warnings do not prevent the workspace proxy from being healthy, but should be addressed.|
1226+
|`»» status`|[codersdk.ProxyHealthStatus](schemas.md#codersdkproxyhealthstatus)| false|||
1227+
|`» updated_at`| string(date-time)| false|||
1228+
|`» url`| string| false|| Full URL including scheme of the proxy api url:https://us.example.com|
1229+
|`» wildcard_hostname`| string| false|| Wildcard hostname with the wildcard for subdomain based app hosting:\*.us.example.com|
1230+
1231+
####Enumerated Values
1232+
1233+
| Property| Value|
1234+
| --------| --------------|
1235+
|`status`|`reachable`|
1236+
|`status`|`unreachable`|
1237+
|`status`|`unhealthy`|
1238+
|`status`|`unregistered`|
12161239

12171240
To perform this operation, you must be authenticated.[Learn more](authentication.md).
12181241

@@ -1257,6 +1280,14 @@ curl -X POST http://coder-server:8080/api/v2/workspaceproxies \
12571280
"icon":"string",
12581281
"id":"497f6eca-6276-4993-bfeb-53cbbbba6f08",
12591282
"name":"string",
1283+
"status": {
1284+
"checked_at":"2019-08-24T14:15:22Z",
1285+
"report": {
1286+
"errors": ["string"],
1287+
"warnings": ["string"]
1288+
},
1289+
"status":"reachable"
1290+
},
12601291
"updated_at":"2019-08-24T14:15:22Z",
12611292
"url":"string",
12621293
"wildcard_hostname":"string"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp