You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2021/05/30 13:38:15 UTC

[GitHub] [submarine] harsha-tenneti opened a new pull request #593: SUBMARINE-833. Support ranger 2.1

harsha-tenneti opened a new pull request #593:
URL: https://github.com/apache/submarine/pull/593


   * Split ranger source dir ranger-2 to ranger-2.0 and ranger-2.1 to capture breaking api changes
   * Move RangerSparkPlugin to individual ranger-{ranger.major.version} main directories and modify according to ranger version
   * Move RangerAdminClientImpl to individual ranger-{ranger.major.version} test directories and modify according to ranger version
   * Introduce new profile ranger-2.1 and include elastic search dependency
   
   ### What is this PR for?
   Support Ranger 2.1 version
   
   ### What type of PR is it?
   [Improvement | Feature ]
   
   ### Todos
   * Split ranger source dir ranger-2 to ranger-2.0 and ranger-2.1 to capture breaking api changes
   * Move RangerSparkPlugin to individual ranger-{ranger.major.version} main directories and modify according to ranger version
   * Move RangerAdminClientImpl to individual ranger-{ranger.major.version} test directories and modify according to ranger version
   * Introduce new profile ranger-2.1 and include elastic search dependency
   
   ### What is the Jira issue?
   https://issues.apache.org/jira/browse/SUBMARINE-833
   
   ### How should this be tested?
   <!--
   * First time? Setup Travis CI as described on https://submarine.apache.org/contribution/contributions.html#continuous-integration
   * Strongly recommended: add automated unit tests for any new or changed behavior
   * Outline any manual steps to test the PR here.
   -->
   ### Screenshots (if appropriate)
   
   ### Questions:
   * Do the license files need updating? No
   * Are there breaking changes for older versions? No
   * Does this need new documentation? No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti edited a comment on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti edited a comment on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877081305


   @pingsutw Modified as per the suggestions


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877117719


   @yaooqinn made some changes as the tests are failing due to missed imports of RangerSParkPlugin in CreateRoleCommand, DropRoleCommand, ShowCurrentRolesCommand, and ShowRolesCommand classes. 
   
   Verified locally that tests are passing. Please help review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-851011451


   @yaooqinn can you please help look at this PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti edited a comment on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti edited a comment on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877081305


   @pingsutw @yaooqinn Modified as per the suggestions


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti commented on a change in pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti commented on a change in pull request #593:
URL: https://github.com/apache/submarine/pull/593#discussion_r666843659



##########
File path: .travis.yml
##########
@@ -264,6 +264,16 @@ matrix:
         - PROFILE="-Pspark-2.3 -Pranger-2.0"
         - MODULES="-pl :submarine-spark-security"
 
+    - name: Test submarine spark security with spark 2.3 and ranger 2.1

Review comment:
       removed spark 2.3 test

##########
File path: submarine-security/spark-security/pom.xml
##########
@@ -36,6 +36,7 @@
   <properties>
     <antlr4.version>4.7</antlr4.version>
     <eclipse.jpa.version>2.5.2</eclipse.jpa.version>
+    <es.version>7.10.2</es.version>

Review comment:
       modified

##########
File path: submarine-security/spark-security/ranger-1/src/test/org.apache.submarine.spark.security/RangerAdminClientImpl.scala
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.submarine.spark.security
+
+import java.nio.file.{Files, FileSystems}
+import java.util
+
+import com.google.gson.GsonBuilder
+import org.apache.commons.logging.{Log, LogFactory}
+import org.apache.ranger.admin.client.RangerAdminRESTClient
+import org.apache.ranger.plugin.util.{GrantRevokeRequest, ServicePolicies, ServiceTags}
+
+class RangerAdminClientImpl extends RangerAdminRESTClient {
+  private val LOG: Log = LogFactory.getLog(classOf[RangerAdminClientImpl])
+  private val cacheFilename = "sparkSql_hive_jenkins.json"
+  private val gson =
+    new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create
+  private var policies: ServicePolicies = _
+
+  override def init(serviceName: String, appId: String, configPropertyPrefix: String): Unit = {
+    if (policies == null) {
+      val basedir = this.getClass.getProtectionDomain.getCodeSource.getLocation.getPath
+      val cachePath = FileSystems.getDefault.getPath(basedir, cacheFilename)
+      LOG.info("Reading policies from " + cachePath)
+      val bytes = Files.readAllBytes(cachePath)
+      policies = gson.fromJson(new String(bytes), classOf[ServicePolicies])
+    }
+  }
+
+  override def getServicePoliciesIfUpdated(
+                                            lastKnownVersion: Long,

Review comment:
       modified

##########
File path: submarine-security/spark-security/ranger-1/src/test/org.apache.submarine.spark.security/RangerAdminClientImpl.scala
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.submarine.spark.security
+
+import java.nio.file.{Files, FileSystems}
+import java.util
+
+import com.google.gson.GsonBuilder
+import org.apache.commons.logging.{Log, LogFactory}
+import org.apache.ranger.admin.client.RangerAdminRESTClient
+import org.apache.ranger.plugin.util.{GrantRevokeRequest, ServicePolicies, ServiceTags}
+
+class RangerAdminClientImpl extends RangerAdminRESTClient {
+  private val LOG: Log = LogFactory.getLog(classOf[RangerAdminClientImpl])
+  private val cacheFilename = "sparkSql_hive_jenkins.json"
+  private val gson =
+    new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create
+  private var policies: ServicePolicies = _
+
+  override def init(serviceName: String, appId: String, configPropertyPrefix: String): Unit = {
+    if (policies == null) {
+      val basedir = this.getClass.getProtectionDomain.getCodeSource.getLocation.getPath
+      val cachePath = FileSystems.getDefault.getPath(basedir, cacheFilename)
+      LOG.info("Reading policies from " + cachePath)
+      val bytes = Files.readAllBytes(cachePath)
+      policies = gson.fromJson(new String(bytes), classOf[ServicePolicies])
+    }
+  }
+
+  override def getServicePoliciesIfUpdated(
+                                            lastKnownVersion: Long,
+                                            lastActivationTimeInMillis: Long): ServicePolicies = {
+    policies
+  }
+
+  override def grantAccess(request: GrantRevokeRequest): Unit = {}
+
+  override def revokeAccess(request: GrantRevokeRequest): Unit = {}
+
+  override def getServiceTagsIfUpdated(
+                                        lastKnownVersion: Long,
+                                        lastActivationTimeInMillis: Long): ServiceTags = null

Review comment:
       modified




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] pingsutw commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
pingsutw commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-876111809


   Gentle ping @yaooqinn. Could you take a look? Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] kevin85421 commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
kevin85421 commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877943251


   Thank you @harsha-tenneti! It looks good to me. I will merge it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] kevin85421 commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
kevin85421 commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877813326


   @harsha-tenneti Thank you for your contribution! Recently, we deprecate Travis CI and use Github Action instead. Hence, there is a conflicting file ".travis.yml" in your patch. There are two solutions:
   
   (1) Remove the ".travis.yml" file in your patch, and I will issue a new patch to help you run the test on Github Action
   
   (2) Rebase your branch with the master branch, and modify the ["master.yml"](https://github.com/apache/submarine/blob/master/.github/workflows/master.yml#L482) to run the test on Github Action.
   
   Both of the options are fine. Feel free to contact me if the patch is ready to be merge. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] kevin85421 commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
kevin85421 commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877945787


   @harsha-tenneti Can you email kaihsun@apache.org with your JIRA username? Submarine contributors need the privilege to create JIRA issues. With the privilege, you can create and assign JIRA issues. Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] yaooqinn commented on a change in pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #593:
URL: https://github.com/apache/submarine/pull/593#discussion_r665858446



##########
File path: .travis.yml
##########
@@ -264,6 +264,16 @@ matrix:
         - PROFILE="-Pspark-2.3 -Pranger-2.0"
         - MODULES="-pl :submarine-spark-security"
 
+    - name: Test submarine spark security with spark 2.3 and ranger 2.1

Review comment:
       we don't need to test spark 2.3




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877081305


   Modified as per the suggestions


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] asfgit closed pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #593:
URL: https://github.com/apache/submarine/pull/593


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] pingsutw commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
pingsutw commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-876903962


   @harsha-tenneti Any update?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] yaooqinn commented on a change in pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #593:
URL: https://github.com/apache/submarine/pull/593#discussion_r665858817



##########
File path: submarine-security/spark-security/ranger-1/src/test/org.apache.submarine.spark.security/RangerAdminClientImpl.scala
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.submarine.spark.security
+
+import java.nio.file.{Files, FileSystems}
+import java.util
+
+import com.google.gson.GsonBuilder
+import org.apache.commons.logging.{Log, LogFactory}
+import org.apache.ranger.admin.client.RangerAdminRESTClient
+import org.apache.ranger.plugin.util.{GrantRevokeRequest, ServicePolicies, ServiceTags}
+
+class RangerAdminClientImpl extends RangerAdminRESTClient {
+  private val LOG: Log = LogFactory.getLog(classOf[RangerAdminClientImpl])
+  private val cacheFilename = "sparkSql_hive_jenkins.json"
+  private val gson =
+    new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create
+  private var policies: ServicePolicies = _
+
+  override def init(serviceName: String, appId: String, configPropertyPrefix: String): Unit = {
+    if (policies == null) {
+      val basedir = this.getClass.getProtectionDomain.getCodeSource.getLocation.getPath
+      val cachePath = FileSystems.getDefault.getPath(basedir, cacheFilename)
+      LOG.info("Reading policies from " + cachePath)
+      val bytes = Files.readAllBytes(cachePath)
+      policies = gson.fromJson(new String(bytes), classOf[ServicePolicies])
+    }
+  }
+
+  override def getServicePoliciesIfUpdated(
+                                            lastKnownVersion: Long,

Review comment:
       indention




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] yaooqinn commented on a change in pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #593:
URL: https://github.com/apache/submarine/pull/593#discussion_r665858573



##########
File path: submarine-security/spark-security/pom.xml
##########
@@ -36,6 +36,7 @@
   <properties>
     <antlr4.version>4.7</antlr4.version>
     <eclipse.jpa.version>2.5.2</eclipse.jpa.version>
+    <es.version>7.10.2</es.version>

Review comment:
       elasticsearch.version




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] harsha-tenneti commented on pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
harsha-tenneti commented on pull request #593:
URL: https://github.com/apache/submarine/pull/593#issuecomment-877936086


   @kevin85421 thanks for the info. I went with option 2 wherein I rebased with master and modified master.yml to include ranger 2.1. 
   
   Please have a look and let me know if I am missing anything


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [submarine] yaooqinn commented on a change in pull request #593: SUBMARINE-833. Support ranger 2.1

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #593:
URL: https://github.com/apache/submarine/pull/593#discussion_r665858920



##########
File path: submarine-security/spark-security/ranger-1/src/test/org.apache.submarine.spark.security/RangerAdminClientImpl.scala
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.submarine.spark.security
+
+import java.nio.file.{Files, FileSystems}
+import java.util
+
+import com.google.gson.GsonBuilder
+import org.apache.commons.logging.{Log, LogFactory}
+import org.apache.ranger.admin.client.RangerAdminRESTClient
+import org.apache.ranger.plugin.util.{GrantRevokeRequest, ServicePolicies, ServiceTags}
+
+class RangerAdminClientImpl extends RangerAdminRESTClient {
+  private val LOG: Log = LogFactory.getLog(classOf[RangerAdminClientImpl])
+  private val cacheFilename = "sparkSql_hive_jenkins.json"
+  private val gson =
+    new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create
+  private var policies: ServicePolicies = _
+
+  override def init(serviceName: String, appId: String, configPropertyPrefix: String): Unit = {
+    if (policies == null) {
+      val basedir = this.getClass.getProtectionDomain.getCodeSource.getLocation.getPath
+      val cachePath = FileSystems.getDefault.getPath(basedir, cacheFilename)
+      LOG.info("Reading policies from " + cachePath)
+      val bytes = Files.readAllBytes(cachePath)
+      policies = gson.fromJson(new String(bytes), classOf[ServicePolicies])
+    }
+  }
+
+  override def getServicePoliciesIfUpdated(
+                                            lastKnownVersion: Long,
+                                            lastActivationTimeInMillis: Long): ServicePolicies = {
+    policies
+  }
+
+  override def grantAccess(request: GrantRevokeRequest): Unit = {}
+
+  override def revokeAccess(request: GrantRevokeRequest): Unit = {}
+
+  override def getServiceTagsIfUpdated(
+                                        lastKnownVersion: Long,
+                                        lastActivationTimeInMillis: Long): ServiceTags = null

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org