-
Notifications
You must be signed in to change notification settings - Fork 887
feat: Add deployment side config-ssh options #6613
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
Conversation
cli/configssh.go
Outdated
// If the error is 404, this deployment does not support | ||
// this endpoint yet. Do not error, just assume defaults. | ||
// TODO: Remove this in 2 months (May 2023). Just return the error | ||
// and remove this 404 check. | ||
var sdkErr *codersdk.Error | ||
if !xerrors.As(err, &sdkErr) { | ||
// not an SDK error, return the original error. | ||
return xerrors.Errorf("fetch coderd config failed: %w", err) | ||
} | ||
|
||
if sdkErr.StatusCode() != http.StatusNotFound { | ||
// Not a 404, return the original error. | ||
return xerrors.Errorf("fetch coderd config failed: %w", err) | ||
} |
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.
This is just to support new coder cli against an older coderd. Can drop it after some time.
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.
Meh, I don't think we should do this. Our install script supports installing by version, so it's really easy to upgrade/downgrade.
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.
If we don't care, I can drop it. I think it is mostly something developers will hit.
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.
What error will users see when they do this on an old client?
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.
As long as it's clear to the user that they need to upgrade to resolve it, I don't think we need to have backward compatibility.
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.
Let's be sure to label this as a breaking change though
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 I just keep this then @kylecarbs? It makes things backwards compatible without docs needed. I included a drop date to remove the code.
It's just a convince to handle any edge cases, and it's not expensive or complex.
// Override with deployment options | ||
for k, v := range coderdConfig.SSHConfigOptions { | ||
opt := fmt.Sprintf("%s %s", k, v) | ||
err := configOptions.addOptions(opt) | ||
if err != nil { | ||
return xerrors.Errorf("add coderd config option %q: %w", opt, err) | ||
} | ||
} | ||
// Override with flag options | ||
for _, opt := range sshConfigOpts.sshOptions { | ||
err := configOptions.addOptions(opt) | ||
if err != nil { | ||
return xerrors.Errorf("add flag config option %q: %w", opt, err) | ||
} | ||
} |
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.
Default > Deployment > Flags
So the user can always override any values by using -o
flag.
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.
LGTM. Mostly small naming things. Just ping and I'll approve!
The And usage: |
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.
Prob worth just doing ctrl+f CLISSH
and replacing with SSH
since this won't only apply to the CLI
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.
LGTM!
Override the default host prefix. | ||
<br/> | ||
| | | | ||
| --- | --- | |
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.
Hmm, is this a bug in gen?
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.
Uh,I guess if the default is ""
, it doesn't put anything?
What this does
Allows setting deployment wide
config-ssh
options.fixes #6501
fixes #6500
Bugs fixed
Example
Ran coderd with env vars to overwrite a default
ConnectTimeout
and add a new option. Also changed the hostname prefix.CODER_SSH_HOSTNAME_PREFIX=steven-local.
CODER_SSH_CONFIG_OPTIONS=ConnectTimeout=20,ConnectionAttempts=5