Skip to content
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: Add support for Gov Cloud #7664

Merged
merged 10 commits into from
Apr 14, 2024
Merged

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Apr 11, 2024

Closes #7662

Change Description

Background

Add support for Azure users using the Gov Cloud endpoint

New Feature

Add support for additional Azure cloud endpoints in a more modular way

Testing Details

Added tests for the namespace and endpoint validations
Very hard to actually test usage as we have no access to the gov cloud endpoint

Breaking Change?

No - but we have depracated the China cloud configuration flag

@N-o-Z N-o-Z added area/block-adapter azure Issues regarding azure block adapter and support labels Apr 11, 2024
@N-o-Z N-o-Z requested a review from itaiad200 April 11, 2024 19:31
@N-o-Z N-o-Z self-assigned this Apr 11, 2024
@N-o-Z N-o-Z added the include-changelog PR description should be included in next release changelog label Apr 11, 2024
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link
Contributor

@itaiad200 itaiad200 left a comment

Choose a reason for hiding this comment

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

Overall looks great. Couple of things that prevents me from approving:

  1. Failing esti tests. They seem related to this change.
  2. Missing docs update for this change.
  3. I believe @arielshaqed opposed to passing a domain. I was on the same side too, but this PR convinced me otherwise.

ChinaCloud bool `mapstructure:"china_cloud"`
// TestEndpointURL for testing purposes
// Deprecated: Value ignored
ChinaCloud bool `mapstructure:"china_cloud"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ChinaCloud bool `mapstructure:"china_cloud"`
DeprecatedChinaCloud bool `mapstructure:"china_cloud"`

@@ -509,17 +511,17 @@ func (c *Config) BlockstoreAzureParams() (blockparams.Azure, error) {
logging.ContextUnavailable().Warn("blockstore.azure.auth_method is deprecated. Value is no longer used.")
}
if c.Blockstore.Azure.ChinaCloud {
logging.ContextUnavailable().Warn("blockstore.azure.china_cloud is enabled. lakeFS will only function on Azure China Cloud")
logging.ContextUnavailable().Warn("blockstore.azure.china_cloud is deprecated. Value is no longer used.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we exit? If someone is using this, by design, lakeFS won't work for him.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should actually do something else so it wouldn't be a breaking change - fixing

var (
ErrInvalidDomain = errors.New("invalid Azure Domain")

endpointRegex = regexp.MustCompile(`https://(?P<account>[\w]+).(?P<domain>[\w.-]+)[/:][\w-/]*$`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now you have 2 problems.....

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand your comment

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Sometimes you just have to do it :)

if params.Domain == "" {
params.Domain = BlobEndpointDefaultDomain
} else {
domain := strings.TrimSuffix(params.Domain, "/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking, but I think we should be more strict here.. Accepting things like blob.core.usgovcloudapi.net/ is weird

Copy link
Member Author

Choose a reason for hiding this comment

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

I can go either way, removing

@@ -605,3 +631,20 @@ func (a *Adapter) GetPresignUploadPartURL(_ context.Context, _ block.ObjectPoint
func (a *Adapter) ListParts(_ context.Context, _ block.ObjectPointer, _ string, _ block.ListPartsOpts) (*block.ListPartsResponse, error) {
return nil, block.ErrOperationNotSupported
}

func ParseURL(raw string) (string, string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add documentation and named args.. (string, string, error) is not very indicative.

Copy link

github-actions bot commented Apr 11, 2024

♻️ PR Preview 1b229b3 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@N-o-Z
Copy link
Member Author

N-o-Z commented Apr 11, 2024

Overall looks great. Couple of things that prevents me from approving:

  1. Failing esti tests. They seem related to this change.
  2. Missing docs update for this change.
  3. I believe @arielshaqed opposed to passing a domain. I was on the same side too, but this PR convinced me otherwise.

Small hiccup with how we build the pre-signed urls. Should be fixed now

@N-o-Z N-o-Z requested a review from itaiad200 April 11, 2024 21:39
* ~~`blockstore.azure.china_cloud` `(bool : false)`~~ - Enable for using lakeFS on Azure China Cloud.
**Note:** Deprecated - In favor of `blockstore.azure.domain`
{: .note }
* `blockstore.azure.domain` `(string : blob.core.windows.net)` - Enables support of different Azure cloud domains. Current supported domains: [`blob.core.chinacloudapi.cn`, `blob.core.usgovcloudapi.net`]
Copy link
Contributor

Choose a reason for hiding this comment

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

You missed the default one

Copy link
Contributor

Choose a reason for hiding this comment

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

Also - some are beta (untested, might be broken in future versions).
Let's be explicit about what's 'first tier' (blob.core.windows.net) and what are 'beta'.

Copy link
Member Author

Choose a reason for hiding this comment

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

The default is the default, no need to add it to the supported domains.
Added a remark that supported domains are in Beta stage (Though this was not mentioned explicitly on the China flag)

var (
ErrInvalidDomain = errors.New("invalid Azure Domain")

endpointRegex = regexp.MustCompile(`https://(?P<account>[\w]+).(?P<domain>[\w.-]+)[/:][\w-/]*$`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +513 to +515
if c.Blockstore.Azure.ChinaCloudDeprecated {
logging.ContextUnavailable().Warn("blockstore.azure.china_cloud is deprecated. Value is no longer used. Please pass Domain = 'blob.core.chinacloudapi.cn'")
c.Blockstore.Azure.Domain = "blob.core.chinacloudapi.cn"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't warn here, I would panic. We're allowed to drop support for beta features.
It was released only recently, it's easier to drop support now instead of later.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to break backward compatibility to current users. We didn't advertise this as a Beta feature, I don't see this becoming a bigger problem in the future

} else {
url = buildAccountEndpoint(params.StorageAccount, params.ChinaCloud)
domain := strings.TrimSuffix(params.Domain, "/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Again with the suffix? 🙈

@N-o-Z N-o-Z enabled auto-merge (squash) April 13, 2024 20:34
@N-o-Z N-o-Z merged commit f75304c into master Apr 14, 2024
36 checks passed
@N-o-Z N-o-Z deleted the task/support-azure-gov-cloud-7662 branch April 14, 2024 07:26
emulatorchen pushed a commit to emulatorchen/lakeFS that referenced this pull request May 27, 2024
* Azure: Add support for Gov Cloud

* Small fix

* CR Fixes

* Fix lint

* CR Fixes 2

* Add TODO

* Fix upload

* Fix upload

* Fix upload

* Fix upload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/block-adapter azure Issues regarding azure block adapter and support include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Azure Gov Cloud
2 participants