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

Extract Topic Operator's Cruise Control client #10092

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fvaleri
Copy link
Contributor

@fvaleri fvaleri commented May 9, 2024

This is the first step in the direction of having a shared Cruise Control client based on Java HTTP client. For the moment changes are limited to the Topic Operator.

If we agree on the strategy, I can then move the Cruise Control client to operator-common and also use it in CruiseControlApi (different PR).


In my view, the shared Cruise Control client shouldn't be concerned with response handling. This client should simply send the request and return a response POJO. Much like Kafka admin and Kube clients do.

The response handling is specific to the functionality we are implementing (the same response could be processed in different ways), so it should be the responsibility of the caller (CruiseControlApi in CO, ReplicasChangeHandler in TO).

That way, each object in the call chain triggered by the controller is focused on doing one thing, and the code is easier to read and maintain.

This would leave a Vertx dependency in CruiseControlApi required by KafkaRebalanceAssemblyOperator. Of course we can also get rid of that, but I would leave it for a dedicated PR.

@fvaleri fvaleri requested review from scholzj and ppatierno May 9, 2024 16:10
@fvaleri fvaleri added this to the 0.42.0 milestone May 9, 2024
@fvaleri fvaleri force-pushed the cc-client branch 2 times, most recently from 24a4842 to abd22af Compare May 12, 2024 10:20
Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

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

I left one comment but not sure the impact it has on the current CC client. I mean, I see just moving a header to a dedicated class and nothing more in the direction of "extract a cruise control client" as the PR name suggests. Maybe it's just a not that great title and PR description which makes me hard the purpose?

@fvaleri
Copy link
Contributor Author

fvaleri commented May 13, 2024

I see just moving a header to a dedicated class and nothing more in the direction of "extract a cruise control client" as the PR name suggests.

Here the long term objective is to have a shared CC thin client to be used by both cluster and topic operators. That was discussed in the RF change proposal. This is a first step in that direction, where I simply extract all CC client logic in the topic operator, so that I can later (in another PR) move it to operator-common and share with CruiseControlApi.

@fvaleri fvaleri changed the title Extract Cruise Control client Extract Topic Operator's Cruise Control client May 14, 2024
@fvaleri fvaleri force-pushed the cc-client branch 6 times, most recently from 454b9f5 to f226884 Compare May 14, 2024 17:07
Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

I left some nits. I do not see this PR partiularly controversial. But I wonder if the overall idea should have some higher level discussion or proposal:

  • While doing smaller steps is good, it is hard to review the PRs when not understanding the end state
  • It seems it could clarify what and how should such client work and what should it do
  • I wonder if the shared CruiseControl client should really live in operator-common instead of a separate module or maybe even a seprate subproject.

@fvaleri
Copy link
Contributor Author

fvaleri commented May 15, 2024

@scholzj @ppatierno thanks for the review.

This started as a simple refactoring, but I now agree on the necessity of a formal proposal before moving on with sharing the CC client with the cluster operator, and I will create one.

Current changes are mostly confined to the topic operator, so it would still be good to have them for better modularization.

I wonder if the shared CruiseControl client should really live in operator-common instead of a separate module or maybe even a seprate subproject.

That's an interesting question. A CruiseControl client could probably be useful in other contexts, so it may make sense to create a separate subproject.

@scholzj
Copy link
Member

scholzj commented May 15, 2024

Current changes are mostly confined to the topic operator, so it would still be good to have them for better modularization.

TBH, I left some comments, but I personally do not find this particular PR somehow controversial. So I do not have problem to proceed with this one right now. My comment was meant more in general.

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

LGTM. Should this be also reviewed by @tombentley as the TO SME?

@fvaleri fvaleri requested a review from tombentley May 15, 2024 10:32
Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

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

LGTM. Approving because it doesn't have any big impact on what we have as CC client within the cluster operator. But to move to a new one, we should discuss everything in a proposal.

@scholzj
Copy link
Member

scholzj commented May 15, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@fvaleri
Copy link
Contributor Author

fvaleri commented May 19, 2024

@tombentley are you ok with the current state? I would need this to complete some other TO changes.

Keep in mind that I'll create a new proposal for sharing the CC client with the CO where we can discuss the API in more details.

@scholzj
Copy link
Member

scholzj commented May 19, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

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

Hi @fvaleri, this is looking pretty good, but I had a few more questions. Thanks!

This is the first step in the direction of having a shared Cruise Control client based on Java HTTP client. For the moment changes are limited to the Topic Operator.

If we agree on the strategy, I can then move the Cruise Control client to operator-common and also use it in CruiseControlApi (different PR).

---

In my view, the shared Cruise Control client shouldn't be concerned with response handling. This client should simply send the request and return a response POJO. Much like Kafka admin and Kube clients do.

The response handling is specific to the functionality we are implementing (the same response could be processed in different ways), so it should be the responsibility of the caller (CruiseControlApi in CO, ReplicasChangeHandler in TO).

That way, each object in the call chain triggered by the controller is focused on doing one thing, and the code is easier to read and maintain.

This would leave a Vertx dependency in CruiseControlApi required by KafkaRebalanceAssemblyOperator. Of course we can also get rid of that, but I would leave it for a dedicated PR.

Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
@fvaleri
Copy link
Contributor Author

fvaleri commented May 20, 2024

@tombentley should be complete now, thanks for your suggestions.

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.

None yet

4 participants