Skip to content

feat: *: use Track 2 SDKs #410

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevekuznetsov
Copy link

Reason for Change:
Migrate from autorest/adal to azidentity
Migrate from github.com/Azure/azure-sdk-for-go/services/keyvault to sdk/keyvault

Issue Fixed:
fixes #179
fixes #180

Unblocks #409

Signed-off-by: Steve Kuznetsov <[email protected]>
@stevekuznetsov
Copy link
Author

Obviates #195

@stevekuznetsov stevekuznetsov changed the title *: use Track 2 SDKs feat: *: use Track 2 SDKs Apr 3, 2025
keyvaultRegionAnnotationKey: []byte(result.Header.Get(keyvaultRegionAnnotationValue)),
versionAnnotationKey: []byte(encryptionResponseVersion),
algorithmAnnotationKey: []byte(encryptionAlgorithm),
// dateAnnotationKey: []byte(result.Header.Get(dateAnnotationValue)),
Copy link
Author

Choose a reason for hiding this comment

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

@aramase we need to find a path forward if these are must-have

}

func getVaultDNSSuffix(managedHSM bool, env *azure.Environment) string {
func getVaultDNSSuffix(managedHSM bool, cloud string) (string, error) {
Copy link
Author

Choose a reason for hiding this comment

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

@aramase I went further than your original PR and entirely removed autorest. PTAL

proxyPort: 7788,
expectedVaultURL: "http://localhost:7788/testkv.vault.azure.net/",
},
//{
Copy link
Author

Choose a reason for hiding this comment

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

TODO

Copy link
Author

Choose a reason for hiding this comment

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

Tactically: we will remove HTTP proxy support, and the user of this will migrate, as proxying Entra traffic through plaintext is not what we want anyway.

}
if kvClient == nil {
t.Fatalf("newKeyVaultClient() expected kv client to not be nil")
}
if !strings.Contains(kvClient.GetUserAgent(), "k8s-kms-keyvault") {
Copy link
Author

Choose a reason for hiding this comment

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

@aramase I could not figure out what the point of these getters were in the public interface and why this was being tested

if !strings.Contains(kvClient.GetUserAgent(), "k8s-kms-keyvault") {
t.Fatalf("newKeyVaultClient() expected k8s-kms-keyvault user agent")
}
if kvClient.GetVaultURL() != test.expectedVaultURL {
Copy link
Author

Choose a reason for hiding this comment

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

This is likely best as a unit test for getVaultURL and getProxiedVaultURL, speaks to a need for some refactor there to better encapsulate the logic rather than punching a hole through the public interface of the return from the constructor to test some implementation detail. WDYT?

Copy link
Member

@enj enj left a comment

Choose a reason for hiding this comment

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

I did a quick pass and nothing major stuck out but @aramase is far more familiar with the Azure SDKs. @aramase PTAL when you have a chance.

func (t *transporter) Do(req *http.Request) (*http.Response, error) {
// adds the target header if proxy mode is enabled
req.Header.Set(consts.RequestHeaderTargetType, consts.TargetTypeAzureActiveDirectory)
return http.DefaultClient.Do(req)
Copy link
Member

Choose a reason for hiding this comment

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

Using the default client seems a bit sketch?

Copy link
Author

Choose a reason for hiding this comment

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

@aramase 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from github.com/Azure/azure-sdk-for-go/services/keyvault to sdk/keyvault Migrate from autorest/adal to azidentity
2 participants