feat: Add deployment side config-ssh options#6613
Conversation
| // 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.
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.
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.
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.
What error will users see when they do this on an old client?
There was a problem hiding this comment.
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.
Let's be sure to label this as a breaking change though
There was a problem hiding this comment.
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.
Default > Deployment > Flags
So the user can always override any values by using -o flag.
kylecarbs
left a comment
There was a problem hiding this comment.
LGTM. Mostly small naming things. Just ping and I'll approve!
|
The And usage: |
kylecarbs
left a comment
There was a problem hiding this comment.
Prob worth just doing ctrl+f CLISSH and replacing with SSH since this won't only apply to the CLI
| Override the default host prefix. | ||
| <br/> | ||
| | | | | ||
| | --- | --- | |
There was a problem hiding this comment.
Uh,I guess if the default is "", it doesn't put anything?
What this does
Allows setting deployment wide
config-sshoptions.fixes #6501
fixes #6500
Bugs fixed
Example
Ran coderd with env vars to overwrite a default
ConnectTimeoutand add a new option. Also changed the hostname prefix.CODER_SSH_HOSTNAME_PREFIX=steven-local.CODER_SSH_CONFIG_OPTIONS=ConnectTimeout=20,ConnectionAttempts=5