feat: add host suffix to /api/v2/deployment/ssh (#17269)

Adds `HostnameSuffix` to ssh config API and deprecates `HostnamePrefix`. We will still support setting and using the prefix for some time.
This commit is contained in:
Spike Curtis
2025-04-07 11:57:10 +04:00
committed by GitHub
parent 87d9ff0973
commit 24248736ac
8 changed files with 27 additions and 6 deletions
+1
View File
@@ -653,6 +653,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
SSHConfig: codersdk.SSHConfigResponse{
HostnamePrefix: vals.SSHConfig.DeploymentName.String(),
SSHConfigOptions: configSSHOptions,
HostnameSuffix: vals.WorkspaceHostnameSuffix.String(),
},
AllowWorkspaceRenames: vals.AllowWorkspaceRenames.Value(),
Entitlements: entitlements.New(),
+5
View File
@@ -14754,6 +14754,11 @@ const docTemplate = `{
"type": "object",
"properties": {
"hostname_prefix": {
"description": "HostnamePrefix is the prefix we append to workspace names for SSH hostnames.\nDeprecated: use HostnameSuffix instead.",
"type": "string"
},
"hostname_suffix": {
"description": "HostnameSuffix is the suffix to append to workspace names for SSH hostnames.",
"type": "string"
},
"ssh_config_options": {
+5
View File
@@ -13384,6 +13384,11 @@
"type": "object",
"properties": {
"hostname_prefix": {
"description": "HostnamePrefix is the prefix we append to workspace names for SSH hostnames.\nDeprecated: use HostnameSuffix instead.",
"type": "string"
},
"hostname_suffix": {
"description": "HostnameSuffix is the suffix to append to workspace names for SSH hostnames.",
"type": "string"
},
"ssh_config_options": {
+6 -1
View File
@@ -3393,7 +3393,12 @@ type DeploymentStats struct {
}
type SSHConfigResponse struct {
HostnamePrefix string `json:"hostname_prefix"`
// HostnamePrefix is the prefix we append to workspace names for SSH hostnames.
// Deprecated: use HostnameSuffix instead.
HostnamePrefix string `json:"hostname_prefix"`
// HostnameSuffix is the suffix to append to workspace names for SSH hostnames.
HostnameSuffix string `json:"hostname_suffix"`
SSHConfigOptions map[string]string `json:"ssh_config_options"`
}
+1
View File
@@ -582,6 +582,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/ssh \
```json
{
"hostname_prefix": "string",
"hostname_suffix": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
+7 -5
View File
@@ -5748,6 +5748,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
```json
{
"hostname_prefix": "string",
"hostname_suffix": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
@@ -5757,11 +5758,12 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
### Properties
| Name | Type | Required | Restrictions | Description |
|----------------------|--------|----------|--------------|-------------|
| `hostname_prefix` | string | false | | |
| `ssh_config_options` | object | false | | |
| » `[any property]` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|----------------------|--------|----------|--------------|-----------------------------------------------------------------------------------------------------------------------|
| `hostname_prefix` | string | false | | Hostname prefix is the prefix we append to workspace names for SSH hostnames. Deprecated: use HostnameSuffix instead. |
| `hostname_suffix` | string | false | | Hostname suffix is the suffix to append to workspace names for SSH hostnames. |
| `ssh_config_options` | object | false | | |
| » `[any property]` | string | false | | |
## codersdk.ServerSentEvent
+1
View File
@@ -2219,6 +2219,7 @@ export interface SSHConfig {
// From codersdk/deployment.go
export interface SSHConfigResponse {
readonly hostname_prefix: string;
readonly hostname_suffix: string;
readonly ssh_config_options: Record<string, string>;
}
+1
View File
@@ -3032,6 +3032,7 @@ export const MockDeploymentStats: TypesGen.DeploymentStats = {
export const MockDeploymentSSH: TypesGen.SSHConfigResponse = {
hostname_prefix: " coder.",
ssh_config_options: {},
hostname_suffix: "coder",
};
export const MockWorkspaceAgentLogs: TypesGen.WorkspaceAgentLog[] = [