-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azure: Migrate to the new SDK version #16286
azure: Migrate to the new SDK version #16286
Conversation
e28d696
to
f656060
Compare
@@ -207,7 +207,7 @@ func getStorageProfile(spec *kops.InstanceGroupSpec) (*compute.VirtualMachineSca | |||
if spec.RootVolume != nil && spec.RootVolume.Type != nil { | |||
storageAccountType = compute.StorageAccountTypes(*spec.RootVolume.Type) | |||
} else { | |||
storageAccountType = compute.StorageAccountTypesPremiumLRS | |||
storageAccountType = compute.StorageAccountTypesStandardSSDLRS |
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.
If this change is intentional then it may be worthy of a release note
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.
Azure is still Alpha, so not sure it's worth the effort.
pkg/resources/azure/azure.go
Outdated
return nil, fmt.Errorf("parsing public IP address ID: %s", err) | ||
} | ||
pips.Insert(pipID.PublicIPAddressName) | ||
if loadBalancer.Properties != nil && loadBalancer.Properties.FrontendIPConfigurations != 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.
the second != nil
check here is redundant with the following range loop
func newNatGatewaysClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*NatGatewaysClientImpl, error) { | ||
c, err := network.NewNatGatewaysClient(subscriptionID, cred, nil) | ||
if err != nil { | ||
return nil, fmt.Errorf("creating subnets client: %w", 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.
return nil, fmt.Errorf("creating subnets client: %w", err) | |
return nil, fmt.Errorf("creating nat gateways client: %w", err) |
}, | ||
DiskSizeGB: e.SizeGB, | ||
}, | ||
SKU: &compute.DiskSKU{ | ||
Name: to.Ptr(compute.DiskStorageAccountTypesStandardSSDLRS), |
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.
is this not configurable? It feels like it should be
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.
I will add the option in a future PR.
util/pkg/vfs/azureblob.go
Outdated
var azErr *azcore.ResponseError | ||
if errors.As(err, &azErr) { | ||
if azErr.ErrorCode == "ContainerNotFound" || azErr.ErrorCode == "BlobNotFound" { | ||
return nil, os.ErrNotExist |
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.
can we use the bloberror
package's HasCode function and these error code constants? Same with the other error checking in this file
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.
Niiice! 😄
util/pkg/vfs/azureblob.go
Outdated
// WriteTo writes the content of the blob to the writer. | ||
func (p *AzureBlobPath) WriteTo(w io.Writer) (n int64, err error) { | ||
ctx := context.TODO() | ||
klog.Infof("Reading: %s - %s", p.container, p.key) |
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.
Perhaps drop all these klog statements to Debug
|
||
func newAzureClient(ctx context.Context) (*azureClient, error) { | ||
func newAzureClient(ctx context.Context) (*azblob.Client, error) { | ||
klog.Infof("New Azure Blob client") |
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.
Similar to above, consider dropping to debug
// Please note that Instance Metadata Service is available only within a VM | ||
// running in Azure (and when necessary role is attached to the VM). | ||
func newAzureCredential(ctx context.Context, accountName string) (azblob.Credential, error) { | ||
accountKey := os.Getenv("AZURE_STORAGE_KEY") |
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.
I'm not seeing this env var mentioned in the azure SDK at all, maybe we should still recognize it here?
https://github.com/search?q=repo%3AAzure%2Fazure-sdk-for-go+AZURE_STORAGE_KEY+&type=code
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, not needed anymore.
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
f656060
to
cf9bd3d
Compare
@rifelpet Could you take one more look, please? |
util/pkg/vfs/azureblob.go
Outdated
|
||
// WriteTo writes the content of the blob to the writer. | ||
func (p *AzureBlobPath) WriteTo(w io.Writer) (n int64, err error) { | ||
return 0, fmt.Errorf("not implemented") |
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.
any reason not to implement this? it was implemented before
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.
It is used only in etcd-manager, not sure why.
I added it back for now. Thanks for the reminder.
cf9bd3d
to
f8ebec5
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rifelpet The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kops-e2e-k8s-aws-calico |
/test pull-kops-e2e-k8s-aws-calico |
/cc @justinsb @rifelpet