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

[#4662] improve(IT): Add ranger authorization Hive E2E test #4651

Merged
merged 12 commits into from
Aug 26, 2024

Conversation

xunliu
Copy link
Member

@xunliu xunliu commented Aug 23, 2024

What changes were proposed in this pull request?

  1. Use an isolated class loader to create an authorization Ranger plugin.
  2. Add authorization for Hive E2E tests using Ranger via Gravitino RESTful access control.
  3. Copy the authorization ranger jar to the distribution/package/authorizations/ranger/libs.
  4. Add Apache Ranger to license.bin

Why are the changes needed?

#4662

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

CI

@xunliu xunliu requested review from yuqi1129 and mchades August 23, 2024 06:58
@xunliu xunliu self-assigned this Aug 23, 2024
@xunliu xunliu changed the title [MINOR]: fix authorization ranger compile lib path [MINOR]: fix authorization ranger jar conflict Aug 23, 2024
@xunliu xunliu marked this pull request as draft August 23, 2024 09:44
LICENSE.bin Show resolved Hide resolved
@xunliu xunliu changed the title [MINOR]: fix authorization ranger jar conflict [#4662] improve(IT): Add ranger authorization Hive E2E test Aug 23, 2024
@xunliu xunliu marked this pull request as ready for review August 23, 2024 14:33
@xunliu xunliu force-pushed the minor-ranger-lib branch 2 times, most recently from eda989c to 974f71d Compare August 24, 2024 01:44
@@ -0,0 +1,110 @@
name: Authorization Integration Test
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put authorization tests to the backend tests? I'm afraid the CI pipeline is already too large.

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 the authorization module is very important, and testing depends on many Docker containers (hive, ranger, MySQL, IAM, ...) , So I think better to split to a single CI pipeline.
Don't worry, I also disable the authorization IT test in the backend tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we reduce the number of the pipeline? The yaml will increase 6 pipelines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should the Authorization Integration Test include authentication tests? There are some AuthenticationIT in catalogIT

Copy link
Member Author

Choose a reason for hiding this comment

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

@jerqi Please create an issue to track and fix this problem. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's hard to test them with a single pipeline. They don't use a standalone module.

authorizations/authorization-ranger/build.gradle.kts Outdated Show resolved Hide resolved
String authorizationProvider =
catalogPropertiesMetadata().containsProperty(AUTHORIZATION_PROVIDER)
? (String) catalogPropertiesMetadata().getOrDefault(conf, AUTHORIZATION_PROVIDER)
: null;

if (authorizationProvider == null) {
LOG.info("Authorization provider is not set!");
return null;
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we only add logs if the authorization provider is not set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the Authorization plugin is an option in the Catalog. It may or may not be configured.

# Integration test for AMD64 architecture
architecture: [linux/amd64]
java-version: [ 8, 11, 17 ]
test-mode: [ embedded, deploy ]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid there are so many pipelines that ASF will not allow us to run so many runners. I would suggest we don't split them so many, maybe one "java-version" is enough, what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, If only one, I hope to use high version JDK to test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reduce to only use JDK-17 to test, Currently we only have two CI pipelines.

- build.gradle.kts
- gradle.properties
- gradlew
- setting.gradle.kts
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe only the code changes in catalog, core, and some other places is enough to trigger this test, some parts like client, web, etc maybe unrelated.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK

} else {
// In real environment, the catalog package is under the catalog directory.
pkgPath = String.join(File.separator, gravitinoHome, "catalogs", provider, "libs");
return String.join(File.separator, pkg, "libs");
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we handle this case if Catalog.PROPERTY_PACKAGE is set? From the current code, if Catalog.PROPERTY_PACKAGE is set, then we'll directly return without handling authorization related packages.

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 refactor these codes.

@@ -79,6 +79,7 @@ flink = "1.18.0"
cglib = "2.2"
ranger = "2.4.0"
javax-jaxb-api = "2.3.1"
javax-ws-rs-api = "2.1.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to add this library? I don't find there's a place using it.

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 use it implementation(libs.javax.ws.rs.api) in the authorizations/authorization-ranger/build.gradle.kts:L56
Because JDK-17 removed Javax library internally, So we need to manually add it.

@xunliu
Copy link
Member Author

xunliu commented Aug 26, 2024

@jerryshao Please help me review this PR, thanks.

ImmutableMap.<String, PropertyEntry<?>>builder()
.putAll(BASIC_CATALOG_PROPERTY_ENTRIES)
.putAll(Maps.uniqueIndex(propertyEntries, PropertyEntry::getName))
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

@yuqi1129 can you please check this part?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

Copy link
Contributor

Choose a reason for hiding this comment

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

This part is fine with me.

false /* immutable */,
false /* hidden */))
.putAll(BASIC_CATALOG_PROPERTY_ENTRIES)
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

@mchades can you please check this part?

Copy link
Contributor

Choose a reason for hiding this comment

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

This part LGTM

Copy link
Contributor

@mchades mchades left a comment

Choose a reason for hiding this comment

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

LGTM

@jerryshao jerryshao merged commit 3795285 into apache:main Aug 26, 2024
28 checks passed
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.

5 participants