-
Notifications
You must be signed in to change notification settings - Fork 82
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
update backupbucket fields #931
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.
Minor comments
pkg/azure/client/storage.go
Outdated
// the new options _also_ allow configuring the cloud instance. | ||
switch { | ||
case cloudConfiguration == nil: | ||
return "blob.core.windows.net", 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.
Is it possible to make constants for these? (It is a pity that designers of the SDK do not think of these things)
const (
BlobStoreGlobalDomain = "blob.core.windows.net"
BlobStoreChinaDomain = "blob.core.chinacloudapi.cn"
BlobStoreUSGovDomain = "blob.core.usgovcloudapi.net"
pkg/azure/client/storage.go
Outdated
switch { | ||
case cloudConfiguration == nil: | ||
return "blob.core.windows.net", nil | ||
case strings.EqualFold(cloudConfiguration.Name, "AzurePublic"): |
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 can club 2 cases into 1:
case cloudConfiguration == nil:
case strings.EqualFold(cloudConfiguration.Name, "AzurePublic"):
return "blob.core.windows.net", 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.
fallthrough
must be used to achieve this functionality in Go, but there's a more idiomatic way of doing this.
case cloudConfiguration == nil, strings.EqualFold(cloudConfiguration.Name, "AzurePublic"):
return "blob.core.windows.net", 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.
I think that you would need to use fallthrough
for that. Also in a very recent PR of mine in gardener core, they voted to merge conditions by ||
. I will probably do the same here for coherence
if err != nil { | ||
return nil, fmt.Errorf("failed to parse service url: %v", err) | ||
} | ||
blobclient, err := azblob.NewClientWithSharedKeyCredential(storageEndpointURL.String(), credentials, 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.
If you look at the azure-sdk-for-go the nomenclature is a bit different. They provide 3 different clients AFAIK:
- Blob client which is created with a specific blob URL (see here)
- Container client which is created for a specific container/bucket ( see here).
- Service client to manage buckets/containers (see here)
So what you have here is a ContainerClient
or a BucketClient
but you call it a blobClient. This confused me a bit.
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 had to look closer for that one. The blob client that we use, creates all the clients internally, so e.g. from the interfaces that we use the azure SDK does something like:
func (c *Client) DeleteBlob(ctx context.Context, containerName string, blobName string, o *DeleteBlobOptions) (DeleteBlobResponse, error) {
return c.svc.NewContainerClient(containerName).NewBlobClient(blobName).Delete(ctx, o)
}
So from our perspective we only use the top level interfaces and all the container/bucket client is hidden from us - I guess that's why the name was blobClient
. I will think how to do the names better.
/hold |
tested with http://europe-docker.pkg.dev/gardener-project/snapshots/gardener/etcd-druid:v0.22.4-dev-c692c9db187df47bc45c2d9815e5e31108b30faf successfully. /unhold |
How to categorize this PR?
/area control-plane
/kind enhancement
/platform azure
What this PR does / why we need it:
Publish the
BackupBucket
domain name, to enable different Azure landscapes.See: gardener/etcd-backup-restore#756
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: