-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ws-proxy] only get username if workspace not managed by mk2 #19180
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
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.
👋 sharing some initial feedback, waiting to add approval, will test now
@@ -318,29 +318,30 @@ func (s *Server) HandleConn(c net.Conn) { | |||
OwnerUserId: wsInfo.OwnerUserId, | |||
} | |||
|
|||
if wsInfo.SSHKey != nil { |
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.
question, blocking:
@iQQBot what scenario is wsInfo.SSHKey != nil
for? Is it still needed? If no longer needed, can we remove in this PR too? Asking because if we don't do now, it might "linger".
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 the old method, we can indeed remove it here because next-gen has not been officially put into use, especially the ssh part.
But I'm not planning to remove it from the workspace CRD, I don't know if this will cause other problems.
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.
Should we wait to land this PR until Monday? If we land it today, it could ship Monday. This would not be ideal, because pods config could apply after pods, falling back to ssh host.
When this PR lands, do we also need a ws-manager-mk2 change to land? Otherwise ws-manager-mk2 has the same risk.
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 PR only prepared for next-gen, nothing change for regular workspace
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.
Was nextgen the only one using wsInfo.SSHKey?
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.
Yes
err = xerrors.Errorf("workspace not managed by mk2, but didn't have SSH CA enabled") | ||
s.TrackSSHConnection(wsInfo, "connect", ErrCreateSSHKey) | ||
ReportSSHAttemptMetrics(ErrCreateSSHKey) | ||
log.WithField("instanceId", wsInfo.InstanceID).WithError(err).Error("failed to generate ssh cert") |
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.
Question, non-blocking:
Should we also include wsInfo.IsManagedByMk2
as a field? I ask because I'm unsure if a nextgen cluster will support and have both managers at the same time. I assume it will.
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.
yes
key, err = s.GenerateSSHCert(ctx, userName) | ||
if err != nil { | ||
log.WithField("workspaceId", workspaceId).WithError(err).Error("failed to generate ssh cert") | ||
log.WithField("instanceId", wsInfo.InstanceID).WithError(err).Error("failed to generate ssh cert") |
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.
Question, blocking:
Should we do s.TrackSSHConnection
and ReportSSHAttemptMetrics
for this failure, too?
Question, non-blocking:
Also, should we include wsInfo.IsEnabledSSHCA
as a field? Seems like could help when debugging.
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.
Also, should we include wsInfo.IsEnabledSSHCA as a field? Seems like could help when debugging.
I assume you mean isMk2, if so that's make sense, wsInfo.IsEnabledSSHCA
is always true if you enter this
I was able to connect to a workspace with SSH, and validate it is using ssh ca.
|
@iQQBot let me know if you have any questions, and when you'd like a follow-up review |
@kylos101 I have addressed your feedback, you can review it again. |
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.
Thank you , @iQQBot , a couple follow-ups
@@ -366,7 +370,7 @@ func (s *Server) HandleConn(c net.Conn) { | |||
if err != nil { | |||
s.TrackSSHConnection(wsInfo, "connect", ErrConnFailed) | |||
ReportSSHAttemptMetrics(ErrConnFailed) | |||
log.WithField("instanceId", wsInfo.InstanceID).WithField("workspaceIP", wsInfo.IPAddress).WithError(err).Error("dail failed") | |||
log.WithField("workspaceIP", wsInfo.IPAddress).WithError(err).Error("dail failed") |
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.
nit: dial failed
@@ -318,29 +318,30 @@ func (s *Server) HandleConn(c net.Conn) { | |||
OwnerUserId: wsInfo.OwnerUserId, | |||
} | |||
|
|||
if wsInfo.SSHKey != nil { |
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.
Should we wait to land this PR until Monday? If we land it today, it could ship Monday. This would not be ideal, because pods config could apply after pods, falling back to ssh host.
When this PR lands, do we also need a ws-manager-mk2 change to land? Otherwise ws-manager-mk2 has the same risk.
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.
💪 you rock, @iQQBot !🤗
/unhold |
Description
[ws-proxy] only get username if workspace not managed by mk2
Summary generated by Copilot
🤖[deprecated] Generated by Copilot at 3d5c859
This pull request enhances the ws-proxy component to support workspaces managed by the new workspace controller mk2. It adds a new field
IsManagedByMk2
to theWorkspaceInfo
type and uses it to handle SSH connections and pod detection.Related Issue(s)
Fixes ENG-1297
How to test
Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold