fix(sagemaker): Removed the dependency on AWS CLI#8703
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Show resolved
Hide resolved
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Outdated
Show resolved
Hide resolved
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Outdated
Show resolved
Hide resolved
| const status = body.status | ||
| const presignedUrl = status?.workspaceConnectionUrl | ||
| const connectionType = status?.workspaceConnectionType | ||
| const token = status?.tokenValue ?? '' |
There was a problem hiding this comment.
if token and session are empty, how does this affect connection?
There was a problem hiding this comment.
added the response in the comment in the code.
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Show resolved
Hide resolved
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Outdated
Show resolved
Hide resolved
|
what kind of testing have we completed? |
|
We have completed the basic testing of the feature |
4d2b5a0 to
76f7cef
Compare
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Outdated
Show resolved
Hide resolved
cce572d to
07b9942
Compare
sgganjo
left a comment
There was a problem hiding this comment.
nit: Do we also need a changelog entry since this is a fix
packages/core/src/awsService/sagemaker/detached-server/kubectlClientStub.ts
Outdated
Show resolved
Hide resolved
|
Added the changelog entry |
|
can we fix ci for lint dup code |
|
It will be there as we have some test cases for the functionality in detached-server and then in normal directory as well. |
|
can we move to shared or utils in detached-server and import to kubectlClient test? same thing we do for any shared code btwn detached-server and the rest of the directory |
|
We have already removed the duplicate code during implementation by using the above approach. |
packages/core/src/awsService/sagemaker/explorer/sagemakerHyperpodNode.ts
Outdated
Show resolved
Hide resolved
packages/core/src/awsService/sagemaker/explorer/sagemakerHyperpodNode.ts
Outdated
Show resolved
Hide resolved
|
What does basic testing entail? Has anyone tested your vsix for confirmation or have we conducted a bug bash? This implementation changes how the listing feature obtains credentials so I think we should have extensive testing coverage. This change is intended for Windows but will also apply for macOS so have we tested that edge case? Have we tried testing on fresh slate to replicate assuming the role of a new customer? |
…n one file and have updated the test cases
…entials at load time for the list
5e99897 to
93d4ce9
Compare
|
@aws-ajangg I have shared with the team earlier. I think you missed it. Extensive testing is been done to verify the feature in both the environments and sanity testing is also completed. |
| $jsonObj = @{ streamUrl = $streamUrl; tokenValue = $token; sessionId = $sessionId } | ||
| $jsonStr = $jsonObj | ConvertTo-Json -Compress | ||
| $envVarName = "AWS_SSM_START_SESSION_RESPONSE" | ||
| $env:AWS_SSM_START_SESSION_RESPONSE = $jsonStr |
There was a problem hiding this comment.
Question: why do we need to make this change?
There was a problem hiding this comment.
After removing the AWS CLI dependency, connection started failing due to quoting/escaping rules of powershell and hence we made the change to resolve the issue.
| headers: { | ||
| host: `sts.${region}.amazonaws.com`, | ||
| 'x-k8s-aws-id': clusterName, | ||
| }, |
There was a problem hiding this comment.
we have the typescript AWS SDK, why we do this http based access?
There was a problem hiding this comment.
This underlying uses @smithy/signature-v4 and @smithy/protocol-http which are part of the AWS SDK v3. EKS token generation requires presigning an STS GetCallerIdentity request, and the JS SDK v3 doesn't have a higher-level API for this — it's the same approach aws eks get-token uses under the hood.
Problem
The listing functionality for parker does not work on windows. The root cause for the same was the dependency we had on AWS CLI which was our initial assumption while implementing Parker but after some discussions, we are aligned on that this won't be the case all the time and therefore we are removing the dependency of AWS CLI from our code base.
Solution
We have removed the dependency on AWS CLI while listing the dev spaces and establishing connections.
Please review this PR as well which covers unit test cases for the same.
https://github.com/msgupta-amazon/aws-toolkit-vscode/pull/2/changes
As per the current architecture for supporting connections in sagemaker the duplicate code check is failing. The code duplicated is less than 15 code lines and are required.
feature/xbranches will not be squash-merged at release time.