-
Notifications
You must be signed in to change notification settings - Fork 887
feat: Add workspace proxy enterprise cli commands #7123
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
Closed
Emyrk
wants to merge
22
commits into
stevenmasley/external_proxy_2
from
dreamteam/external_proxy_cli_cmd
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7271e8f
feat: Add workspace proxy enterprise cli commands
Emyrk 0a1af72
chore: Handle custom workspace proxy options. Remove excess
Emyrk 9fc8078
Add primary access url
Emyrk 56d0ad7
Include app security key
Emyrk 4d7daed
Add output formats for registering a proxy
Emyrk 62f676b
Fix formats
Emyrk 913aef1
Add cli cmd to get app security key
Emyrk 9c37e16
Add deleting proxies
Emyrk 9d4591c
feat: Allow workspace proxy spawn in develop.sh
Emyrk cc29ffc
Make gen
Emyrk 54a6fc5
Import ordeR
Emyrk 139c309
Quote shell var
Emyrk 6ce0dec
Imports
Emyrk ffc3877
Fix lint
Emyrk db78701
Tabs vs spaces
Emyrk e49f96c
remove unused command
Emyrk 5f05cbf
Fix compile and make gen
Emyrk 0d9da63
Fix slim cmd to include extra proxy cmds
Emyrk 60fb59e
Import order
Emyrk b9283d8
Import order
Emyrk dab84e3
Fix comment
Emyrk ea3593d
Fix compile with name
Emyrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add primary access url
- Loading branch information
commit 9fc8078e5ddc6952ff36c7f33c4eb78efc9a208e
There are no files selected for viewing
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ import ( | |
"net" | ||
"net/http" | ||
"net/http/pprof" | ||
"net/url" | ||
"os/signal" | ||
"regexp" | ||
rpprof "runtime/pprof" | ||
|
@@ -107,6 +106,7 @@ func (r *RootCmd) proxyServer() *clibase.Cmd { | |
YAML: "externalWorkspaceProxy", | ||
} | ||
proxySessionToken clibase.String | ||
primaryAccessURL clibase.URL | ||
) | ||
opts.Add( | ||
// Options only for external workspace proxies | ||
|
@@ -122,6 +122,18 @@ func (r *RootCmd) proxyServer() *clibase.Cmd { | |
Group: &externalProxyOptionGroup, | ||
Hidden: false, | ||
}, | ||
|
||
clibase.Option{ | ||
Name: "Coderd (Primary) Access URL", | ||
Description: "URL to communicate with coderd. This should match the access URL of the Coder deployment.", | ||
Flag: "primary-access-url", | ||
Env: "CODER_PRIMARY_ACCESS_URL", | ||
YAML: "primaryAccessURL", | ||
Default: "", | ||
Value: &primaryAccessURL, | ||
Group: &externalProxyOptionGroup, | ||
Hidden: false, | ||
}, | ||
) | ||
|
||
client := new(codersdk.Client) | ||
|
@@ -137,6 +149,10 @@ func (r *RootCmd) proxyServer() *clibase.Cmd { | |
r.InitClient(client), | ||
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. Shouldn't this just be a proxysdk client that we construct in the handler? 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. I was honestly just using this for the version checking. |
||
), | ||
Handler: func(inv *clibase.Invocation) error { | ||
if !(primaryAccessURL.Scheme == "http" || primaryAccessURL.Scheme == "https") { | ||
return xerrors.Errorf("primary access URL must be http or https: url=%s", primaryAccessURL) | ||
} | ||
|
||
var closers closers | ||
// Main command context for managing cancellation of running | ||
// services. | ||
|
@@ -255,11 +271,10 @@ func (r *RootCmd) proxyServer() *clibase.Cmd { | |
closers.Add(closeFunc) | ||
} | ||
|
||
pu, _ := url.Parse("http://localhost:3000") | ||
proxy, err := wsproxy.New(&wsproxy.Options{ | ||
Logger: logger, | ||
// TODO: PrimaryAccessURL | ||
PrimaryAccessURL: pu, | ||
PrimaryAccessURL: primaryAccessURL.Value(), | ||
AccessURL: cfg.AccessURL.Value(), | ||
AppHostname: appHostname, | ||
AppHostnameRegex: appHostnameRegex, | ||
|
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.
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.
Can't these be added to the regular config struct, and then the primary server can filter them out?
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.
We talked on discord. I think the best move here is to autogenerate the Deployment struct from the Options. Then we can create all the options in 1 place, and filter them.
I will do this in another branch, this is ok for now here just to get a cmd working.
Follow up PRs will make the workspace proxy creation/register experience better.