-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ws-manager-mk2] Support public SSH keys #16413
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
started the job as gitpod-build-fo-adv-3.2 because the annotations in the pull request description changed |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm 👍 started the job as gitpod-build-fo-adv-3.5 |
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.
testing in a preview env, but can't connect with VSCode Desktop, keep getting prompted for a password like this: https://www.gitpod.io/blog/vscode-desktop-ssh-updates#ssh-gateway-access-using-the-owner-token
The workspace spec and pod annotations do contain the public ssh key, is there anything else I need to set before I can connect with ssh?
case workspace.Spec.SshPublicKeys != pod.Annotations[kubernetes.WorkspaceSSHPublicKeys]: | ||
pod.Annotations[kubernetes.WorkspaceSSHPublicKeys] = workspace.Spec.SshPublicKeys | ||
err := r.Client.Update(ctx, pod) | ||
if err != nil { | ||
return ctrl.Result{Requeue: true}, 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.
could you add a test for this in workspace_controller_test
?
Good question, maybe @iQQBot knows the answer? |
/werft run 👍 started the job as gitpod-build-fo-adv-3.6 |
@@ -653,6 +695,21 @@ func setEnvironment(envs []*wsmanapi.EnvironmentVariable) []corev1.EnvVar { | |||
return envVars | |||
} | |||
|
|||
func setSshPublicKeys(keys []string) (string, error) { | |||
if len(keys) != 0 { |
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.
keep the same name SSH
everywhere?
@Furisto Could you rebase to main? because the build is failed and I can't access the preview environment |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm 👍 started the job as gitpod-build-fo-adv-3.8 |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm recreate-vm 👍 started the job as gitpod-build-fo-adv-3.9 |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm recreate-vm 👍 started the job as gitpod-build-fo-adv-3.10 |
This implementation looks wrong. In we should put public keys in here gitpod/components/ws-proxy/pkg/proxy/infoprovider.go Lines 283 to 294 in edf97a9
|
@@ -45,6 +45,8 @@ type WorkspaceSpec struct { | |||
|
|||
// +kubebuilder:validation:MinItems=0 | |||
Ports []PortSpec `json:"ports"` | |||
|
|||
SshPublicKeys string `json:"sshPublicKey,omitempty"` |
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.
why using string? it can by array, we don't need base64 for it, we using base64 because annotation only support string.
started the job as gitpod-build-fo-adv-3.12 because the annotations in the pull request description changed |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm recreate-vm 👍 started the job as gitpod-build-fo-adv-3.13 |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm recreate-vm 👍 started the job as gitpod-build-fo-adv-3.14 |
/werft run with-preview with-wsman-mk2 with-large-vm 👍 started the job as gitpod-build-fo-adv-3.15 |
/werft run with-preview with-wsman-mk2 with-large-vm with-gce-vm recreate-vm 👍 started the job as gitpod-build-fo-adv-3.16 |
sshPublicKey: | ||
format: byte | ||
type: string |
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.
looks like this needs to be regenerated, with the type being an array now
@@ -45,6 +45,8 @@ type WorkspaceSpec struct { | |||
|
|||
// +kubebuilder:validation:MinItems=0 | |||
Ports []PortSpec `json:"ports"` | |||
|
|||
SshPublicKeys []byte `json:"sshPublicKeys,omitempty"` |
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.
why use []byte here? is it possible to directly use api.SSHPublicKeys
or []string
, in CRDs we should keep it readable... these things are not secret
@Furisto is this PR stalled? Should it flip back to draft? |
/werft run -a with-preview=true -a with-wsman-mk2=true -a with-gce-vm=true 👍 started the job as gitpod-build-fo-adv-3.18 |
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, tested in preview env:
- was able to connect over SSH with VS Code Desktop
- updating a key propagated to running workspace
Description
Support public ssh keys
Related Issue(s)
n.a.
How to test
ssh-keygen -t ed25519
gitpod.io/sshPublicKeys
annotation is set on the workspace podRelease Notes
Documentation
Build Options:
Experimental feature to run the build with GitHub Actions (and not in Werft).
leeway-target=components:all
Run Leeway with
--dont-test
Publish Options
Installer Options
Add desired feature flags to the end of the line above, space separated
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh