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

kafka_users module implementation #134

Merged
merged 12 commits into from
Oct 7, 2022

Conversation

saiello
Copy link
Contributor

@saiello saiello commented Jul 6, 2022

Fixes #109

Proposed Changes

  • add kafka_user module
  • add kafka_users module
  • add kafka_info to describe users

Discussion point

  • Q: How to obtain idempotence ensuring passwords are up to date?
  • A: added state = "update" forcing the upsertion despite the presence of the user in the describe response

@saiello
Copy link
Contributor Author

saiello commented Jul 6, 2022

@ryarnyah @StephenSorriaux I am still working on it, but if you have any suggestion to handle properly updates of existing users let me know.

@ryarnyah
Copy link
Collaborator

ryarnyah commented Jul 8, 2022

@ryarnyah @StephenSorriaux I am still working on it, but if you have any suggestion to handle properly updates of existing users let me know.

Maybe trying open a simple KafkaClient will do the trick?

library/kafka_user.py Outdated Show resolved Hide resolved
library/kafka_users.py Outdated Show resolved Hide resolved
@saiello saiello marked this pull request as ready for review July 10, 2022 10:55
@saiello saiello force-pushed the feature/kafka-user-module branch 4 times, most recently from 2963f60 to 71625b1 Compare July 10, 2022 13:20
@saiello
Copy link
Contributor Author

saiello commented Jul 14, 2022

@ryarnyah Any update about the review?

@StephenSorriaux StephenSorriaux self-requested a review July 14, 2022 17:52
@ryarnyah
Copy link
Collaborator

ryarnyah commented Jul 16, 2022

@ryarnyah Any update about the review?

Sorry, I will review it next week, i don't have much time now

Edit: if you are adding a molecule scenario you need to add it to our github actions to be running. We might prefer using only default scenario to parallelize tests efficiently and to not duplicate test helpers, what do you think @StephenSorriaux ?

@saiello
Copy link
Contributor Author

saiello commented Jul 17, 2022

if you are adding a molecule scenario you need to add it to our github actions to be running.

Yes, but I don't want editing github actions before the codereview

We might prefer using only default scenario to parallelize tests efficiently and to not duplicate test helpers, what do you think @StephenSorriaux ?

I see the current guideline, however I found easier writing test in this way: I don't need to write additional python code and using the real role in the converge playbook covers not only the module_utils but the library as well. Moreover is also an additional example.

To avoid duplications, the infra tests and playbooks ( i.e. converge.yaml, verify.yaml ) might be moved in a common folder. see sharing across scenarios

Notice however that kafka_user module currently works only with kafka >= 2.7.0. We might extends the support using the AlterConfigs kafka api, maybe after the implementation of #87

@ryarnyah
Copy link
Collaborator

ryarnyah commented Jul 19, 2022

We are also check Python compatibility with workers in python 2 to 3.10 with https://github.com/StephenSorriaux/ansible-kafka-admin/blob/master/molecule/default/molecule.yml#L13 That's why we are targetting "executors" in the tests (example https://github.com/StephenSorriaux/ansible-kafka-admin/blob/master/molecule/default/tests/test_acl_default.py#L19)
So you might need to write something to do the same (we have some users that use pyth:on 2.7 and python 3.6...).

@saiello
Copy link
Contributor Author

saiello commented Jul 19, 2022

Hi, @ryarnyah I actually did something testing workers in python 2 to 3.10. I changed the gitactions as you suggested, adding the scenario's name into the matrix.

In the last checks' run you can see the scram-kafka-270 as well.

@ryarnyah
Copy link
Collaborator

Can you add some testinfra test to ensure that user password is usable to kafka client?

module_utils/kafka_lib_user.py Outdated Show resolved Hide resolved
module_utils/kafka_lib_user.py Outdated Show resolved Hide resolved
module_utils/kafka_lib_user.py Outdated Show resolved Hide resolved
molecule/scram-kafka-270/molecule.yml Outdated Show resolved Hide resolved
molecule/scram-kafka-270/molecule.yml Show resolved Hide resolved
module_utils/kafka_scram.py Show resolved Hide resolved
Copy link
Collaborator

@ryarnyah ryarnyah left a comment

Choose a reason for hiding this comment

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

LGTM

@ryarnyah ryarnyah added this to the 0.17.0 milestone Jul 28, 2022
- AlterUserScramCredentialsRequest_v0
- AlterUserScramCredentialsResponse_v0
- DescribeUserScramCredentialsRequest_v0
- DescribeUserScramCredentialsResponse_v0
- add kafka_user
- add kafka_users
- add user resource to kafka_info
@saiello
Copy link
Contributor Author

saiello commented Sep 15, 2022

@ryarnyah With the previous push flake8, that had no version specified in requirements.txt, was upgraded to 5.0.4 and several issues came up.

I resolved the issues and fix the version to avoid this behaviour in the future.

When do you plan the 0.17 release?

@ryarnyah ryarnyah merged commit c22d252 into StephenSorriaux:master Oct 7, 2022
ryarnyah pushed a commit that referenced this pull request Oct 2, 2023
* add new kafka api request/response

- AlterUserScramCredentialsRequest_v0
- AlterUserScramCredentialsResponse_v0
- DescribeUserScramCredentialsRequest_v0
- DescribeUserScramCredentialsResponse_v0

* add kafka_scram module

* add kafka_users modules

- add kafka_user
- add kafka_users
- add user resource to kafka_info

* add kafka_users examples

* add kafka_users molecule's scenario

* update readme.md

* add molecule scenario in gihub maxtrix

* kafka_user: handler kafka manager errors

* kafka_user: inspect kafka advertised.listener in converge.yaml

* kafka_user: review changes

* kafka_user: use infratest to verify message write/read

* fix flake8 version and resolve v5 issues
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.

[Module] Add kafka_users module
2 participants