Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/core/src/awsService/sagemaker/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ export async function deeplinkConnect(

try {
let connectionType = 'sm_dl'
if (domain === '') {
if (domain === '' && eksClusterArn) {
const { accountId, region, clusterName } = parseEKSClusterArn(eksClusterArn)
connectionType = 'sm_hp'
session = `${workspaceName}_${namespace}_${clusterName}_${region}_${accountId}`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${workspaceName}_${namespace}

Please check the naming convention(limits) to confirm the characters allow by k8s can be accepted as ssh hostname.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added k8s naming convention validation

}
const remoteEnv = await prepareDevEnvConnection(
connectionIdentifier,
Expand Down Expand Up @@ -179,6 +181,17 @@ export async function deeplinkConnect(
}
}

function parseEKSClusterArn(eksClusterArn: string): { accountId: string; region: string; clusterName: string } {
const parts = eksClusterArn.split(':')
if (parts.length !== 6) {
throw new Error(`Invalid EKS cluster ARN: ${eksClusterArn}`)
}
const accountId = parts[4]
const region = parts[3]
const clusterName = parts[5].split('/')[1]
return { accountId, region, clusterName }
}

export async function stopSpace(
node: SagemakerSpaceNode | SagemakerUnifiedStudioSpaceNode,
ctx: vscode.ExtensionContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/awsService/sagemaker/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export async function prepareDevEnvConnection(

const hyperPodEnv: NodeJS.ProcessEnv = {
AWS_REGION: region,
SESSION_ID: session || '',
SESSION_ID: hostname || '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't this be session?

Copy link
Contributor Author

@aws-ajangg aws-ajangg Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostname also uses session but session is randomly generated in the presigned url and this is what's causing a new external window to be opened when the user tries to connect to the workspace.

After discussing with @edwardps, we decided to use a deterministic unique identifier for the hostname instead

STREAM_URL: decodedWsUrl,
TOKEN: decodedToken,
AWS_SSM_CLI: ssm,
Expand Down
Loading