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

Unable to delete custom role bindings for subject and connector #407

Closed
shahriar52 opened this issue Nov 23, 2021 · 1 comment
Closed

Unable to delete custom role bindings for subject and connector #407

shahriar52 opened this issue Nov 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@shahriar52
Copy link

Describe the bug

  1. Julie-ops throwing error while deleting previously created role binding for subjects and connectors.
  2. Julie-ops executing patterns type as "LITERAL" not honouring "PREFIXED".

To Reproduce

  1. Custom role:
---
roles:
  - name: "schemaResourceOwner"
    acls:
      - resourceType: "Subject"
        resourceName: "{{subject}}"
        patternType: "LITERAL"
        host: "*"
        role: "ResourceOwner"
  - name: "connectorResourceOwner"
    acls:
      - resourceType: "Connector"
        resourceName: "{{connector}}"
        patternType: "PREFIXED"
        host: "*"
        role: "ResourceOwner"
  1. Topology file:
---
context: "context"
source: "source"
projects:
  - name: "foo"
    schemaResourceOwner:
      - principal: "User:App0"
        subject: "test.subject"
    connectorResourceOwner:
      - principal: "User:App0"
        connector: "con"
  1. Property file:
security.protocol=SASL_SSL
ssl.truststore.location=/root/truststore.jks
ssl.truststore.password=####
sasl.mechanism=PLAIN
security.protocol=SASL_SSL
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="#########" password="#########";


topology.builder.access.control.class = com.purbon.kafka.topology.roles.RBACProvider
topology.builder.mds.server = https://example.com:8090
topology.builder.mds.user = #########
topology.builder.mds.password = ##########
topology.builder.mds.kafka.cluster.id = 7Tgk9e-GR9KQ0bFvyCdNFQ

topology.builder.mds.schema.registry.cluster.id = schema-registry
topology.builder.mds.kafka.connect.cluster.id = connect-cluster
topology.builder.mds.ksqldb.cluster.id = ksql-server

topology.topic.prefix.format = {{topic}}
topology.project.prefix.format =

julie.roles=/root/temp/julie/roles.yaml
allow.delete.topics=true
allow.delete.bindings=true

topology.builder.state.processor.class = com.purbon.kafka.topology.backend.FileBackend
  1. Running julie-ops would create the following role bindings:
  Principal |     Role      | ResourceType |     Name     | PatternType
+-----------+---------------+--------------+--------------+-------------+
  User:App0 | ResourceOwner | Subject      | test.subject | LITERAL

  Principal |     Role      | ResourceType | Name | PatternType
+-----------+---------------+--------------+------+-------------+
  User:App0 | ResourceOwner | Connector    | con  | LITERAL

Note the connector pattern type, as that should be PREFIXED.
5. Remove role binding from the topology file

---
context: "context"
source: "source"
projects:
  - name: "foo"
  1. Run julie-ops to reconcile that delete to the cluster. This produced the following output,
java.io.IOException: java.io.IOException: Something happened with the connection, response status code: 400 body: {"status_code":400,"message":"Invalid scope resource type binding with cluster type : kafka-cluster and resource type : Connector","type":"INVALID REQUEST DATA"}
        at com.purbon.kafka.topology.clients.JulieHttpClient.doRequest(JulieHttpClient.java:223)
        at com.purbon.kafka.topology.clients.JulieHttpClient.doDelete(JulieHttpClient.java:192)
        at com.purbon.kafka.topology.api.mds.MDSApiClient.deleteRole(MDSApiClient.java:146)
        at com.purbon.kafka.topology.roles.RBACProvider.lambda$clearBindings$0(RBACProvider.java:50)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at com.purbon.kafka.topology.roles.RBACProvider.clearBindings(RBACProvider.java:37)
        at com.purbon.kafka.topology.actions.access.ClearBindings.execute(ClearBindings.java:29)
        at com.purbon.kafka.topology.actions.BaseAccessControlAction.run(BaseAccessControlAction.java:30)
        at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:114)
        at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:90)
        at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:248)
        at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:265)
        at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:212)
        at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:161)
        at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:147)
Caused by: java.io.IOException: Something happened with the connection, response status code: 400 body: {"status_code":400,"message":"Invalid scope resource type binding with cluster type : kafka-cluster and resource type : Connector","type":"INVALID REQUEST DATA"}
        at com.purbon.kafka.topology.clients.JulieHttpClient.doRequest(JulieHttpClient.java:212)
        ... 14 more
java.io.IOException: java.io.IOException: Something happened with the connection, response status code: 400 body: {"status_code":400,"message":"Invalid scope resource type binding with cluster type : kafka-cluster and resource type : Subject","type":"INVALID REQUEST DATA"}
        at com.purbon.kafka.topology.clients.JulieHttpClient.doRequest(JulieHttpClient.java:223)
        at com.purbon.kafka.topology.clients.JulieHttpClient.doDelete(JulieHttpClient.java:192)
        at com.purbon.kafka.topology.api.mds.MDSApiClient.deleteRole(MDSApiClient.java:146)
        at com.purbon.kafka.topology.roles.RBACProvider.lambda$clearBindings$0(RBACProvider.java:50)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at com.purbon.kafka.topology.roles.RBACProvider.clearBindings(RBACProvider.java:37)
        at com.purbon.kafka.topology.actions.access.ClearBindings.execute(ClearBindings.java:29)
        at com.purbon.kafka.topology.actions.BaseAccessControlAction.run(BaseAccessControlAction.java:30)
        at com.purbon.kafka.topology.ExecutionPlan.execute(ExecutionPlan.java:114)
        at com.purbon.kafka.topology.ExecutionPlan.run(ExecutionPlan.java:90)
        at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:248)
        at com.purbon.kafka.topology.JulieOps.run(JulieOps.java:265)
        at com.purbon.kafka.topology.CommandLineInterface.processTopology(CommandLineInterface.java:212)
        at com.purbon.kafka.topology.CommandLineInterface.run(CommandLineInterface.java:161)
        at com.purbon.kafka.topology.CommandLineInterface.main(CommandLineInterface.java:147)
Caused by: java.io.IOException: Something happened with the connection, response status code: 400 body: {"status_code":400,"message":"Invalid scope resource type binding with cluster type : kafka-cluster and resource type : Subject","type":"INVALID REQUEST DATA"}
        at com.purbon.kafka.topology.clients.JulieHttpClient.doRequest(JulieHttpClient.java:212)
        ... 14 more

Expected behavior
Juile-ops should be able to delete subject and connector role bindings.

Runtime (please complete the following information):

  • OS: WSL CentOS 7
  • JVM version: openjdk 11
  • Julie-ops RPM package Version: 3.3.2
  • Confluent version: 6.2.1
@shahriar52 shahriar52 added the bug Something isn't working label Nov 23, 2021
@purbon
Copy link
Collaborator

purbon commented Nov 23, 2021

Thanks for your report, this should be addressed by 51a1453 and 510e88d, appreciate the effort a ton.

@purbon purbon closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants