StephenSorriaux / ansible-kafka-admin

Manage your topic's configuration (partitions, replication factor, parameters), ACLs, quotas, users and get stats, without any effort with this library. It does not use the Kafka scripts and does not require ssh connection to the remote broker.
Apache License 2.0
150 stars 46 forks source link

Feature/multiple acl operations #136

Closed saiello closed 2 years ago

saiello commented 2 years ago

Fixes #70 Fixes #124

Proposed Changes


 - name: "Create a single ACL with multiple operations"
      kafka_acl:
        name: 'my-topic'
        api_version: "2.6.0"
        acl_resource_type: 'topic'
        acl_principal: 'User:producer-client'
        acl_operations: 
          - 'write'
          - 'describe'
          - 'create'
        acl_permission: 'allow'
        acl_pattern_type: 'literal'
        bootstrap_servers: "localhost:9092"

- name: "Create multiple ACL with multiple operations"
      kafka_acls:

        acls:
          - name: 'my-topic'
            acl_resource_type: 'topic'
            acl_principal: 'User:consumer-client'
            acl_operations: 
              - 'describe'
              - 'read'
            acl_permission: 'allow'
            acl_pattern_type: 'literal'

          - name: 'my-consumer-group'
            acl_resource_type: 'group'
            acl_principal: 'User:consumer-client'
            acl_operations: 
              - 'read'
            acl_permission: 'allow'
            acl_pattern_type: 'literal'

        api_version: "2.6.0"
        bootstrap_servers: "localhost:9092"
    - name: "Delete any ACL of a given resource"
      kafka_acls:

        acls:
          - name: 'my-topic'
            acl_principal: 'User:consumer-client'
            state: 'absent'

        bootstrap_servers: "localhost:9092"
ryarnyah commented 2 years ago

We need to look more to this PR but it's seem be to be a great improvement! Thanks!!!!

ryarnyah commented 2 years ago

LGMT! Can you add some test with acl_operations in https://github.com/StephenSorriaux/ansible-kafka-admin/blob/master/molecule/default/tests/test_acl_default.py to ensure that this won't be breaked in the future?

saiello commented 2 years ago

@ryarnyah I mean to rebase on master once the #134 will be merged to use the same testing approach used there.

ryarnyah commented 2 years ago

@saiello In this case it might be a better idea to reuse default scenario to reuse existing tests (ACLs is supported from 0.11.0 to X and in your case it's only to ensure that it won't be breaked in the future). Furthermore we are already limited on concurrent github action that can be done so if we add another scenario we will increase drastically build time.

saiello commented 2 years ago

@saiello In this case it might be a better idea to reuse default scenario to reuse existing tests (ACLs is supported from 0.11.0 to X and in your case it's only to ensure that it won't be breaked in the future). Furthermore we are already limited on concurrent github action that can be done so if we add another scenario we will increase drastically build time.

Yes, you are right! I will add further cases to the existing tests!

I have some idea to optimize the github actions usage. I would like to work on them later. Let me know if you already have some thought about it.

saiello commented 2 years ago

@ryarnyah tests added

ryarnyah commented 2 years ago

@saiello thank you!