Consolidating the KafkaRebalance API for extensibility#216
Conversation
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
|
@kyguy is this ready to review? Should we add maintainers or are you still working on it? |
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
|
@ppatierno yes, this is now ready for review! I'll request the maintainers as reviewers now |
| # Consolidating the KafkaRebalance API for extensibility | ||
|
|
||
| This proposal addresses the increasing complexity and limited extensibility of the `KafkaRebalance` custom resource API. | ||
| It introduces a `spec.parameters` map that replaces mode-specific primitive fields with their upstream Cruise Control key-value equivalents allowing users to consult Cruise Control documentation directly and enabling support for new parameters without Strimzi API changes. |
There was a problem hiding this comment.
what about using spec.config as we have for other custom resources (i.e. Kafka, KafkaBridge, ...) ?
There was a problem hiding this comment.
TBH in the original draft I had used spec.config for the sake of consistency with other custom resource configurations but then changed it to spec.parameters. I felt that using spec.parameters better emphasizes the distinction between configuration file properties and REST API query parameters. It should also help users avoid confusing these query parameters with the spec.cruiseControl.config options in the Kafka resource. WDYT?
There was a problem hiding this comment.
The KafkaRebalance is an abstraction on the top of the CC REST API so I can see your point of having a sort of 1:1 matching with the query parameters on the REST call ... but still not sure if having a more friendly and well-known name like "config" would be better for users in terms of UX. Let's see what others think before making any changes.
There was a problem hiding this comment.
I would personally go with .spec.config and have it consistent across all resources. Maybe it's just me, but I don't feel like we need to reflect the naming what we are using internally - and I think that users will not care that those are "parameters" for the REST API. So having parameters feels like it would be just something for us.
There was a problem hiding this comment.
Fair points, I switched it back to spec.config just to show what it would look like (I can easily change it back in a later commit) I'll leave this comment unresolved for now so people can see this conversation and add their thoughts whether it be for or against
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
im-konge
left a comment
There was a problem hiding this comment.
Thanks for the proposal. I left few comments.
| # Consolidating the KafkaRebalance API for extensibility | ||
|
|
||
| This proposal addresses the increasing complexity and limited extensibility of the `KafkaRebalance` custom resource API. | ||
| It introduces a `spec.parameters` map that replaces mode-specific primitive fields with their upstream Cruise Control key-value equivalents allowing users to consult Cruise Control documentation directly and enabling support for new parameters without Strimzi API changes. |
There was a problem hiding this comment.
I would personally go with .spec.config and have it consistent across all resources. Maybe it's just me, but I don't feel like we need to reflect the naming what we are using internally - and I think that users will not care that those are "parameters" for the REST API. So having parameters feels like it would be just something for us.
| - Strimzi will log a warning and write an error in the `KafkaRebalance` status when `brokers` or `volumes` are provided but irrelevant to the selected mode. | ||
|
|
||
| 2. **Parameter field validation**: | ||
| - Strimzi does not pre-validate parameters entries. |
There was a problem hiding this comment.
Maybe completely stupid question, but today we are pre-validating the parameters specified in the CR, right?
How it would work when you have some fields specified under old structure and some in new structure? Will it automatically skip the validation from now on or it will be semi-validated? (As I said, maybe completely stupid question, sorry).
There was a problem hiding this comment.
Not a stupid question at all.
Right now we only do loose validation on some of primitive fields that we’re planning to deprecate in favor of the new config. For example, we might enforce simple constraints like minimum values for fields such as concurrentPartitionMovementsPerBroker.
If a CR includes a mix of old and new structure, it won’t skip the validation of the deprecated primitive fields if they are included. That being said the parameters included as part of the new config will take preference. For example, if a primitive field is included with a valid value and it's equivalent field in the new config is included with an incorrect value, the KafkaRebalance resource will be put in the NotReady state and a condition with the error will be added.
Does that answer the question?
There was a problem hiding this comment.
Sorry I realized I didn't reply here - yeah it answers my question, thanks :)
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
PaulRMellor
left a comment
There was a problem hiding this comment.
The proposal is clear and well justified. I’ve added a few minor suggestions as I read through
|
|
||
| 2. **Parameter field validation**: | ||
| - Strimzi won't pre-validate new config parameter entries. | ||
| Strimzi will pass the config parameters as-is to the Cruise Control REST API. |
There was a problem hiding this comment.
Any security considerations to mention here? Or how compatibility is handled between Strimzi and Cruise Control versions?
There was a problem hiding this comment.
Thanks for raising this, there actually should be some parameter validation to mitigate users accidentally breaking the KafkaRebalance state machine and status. I have just added some notes on filtering parameters in the latest commit.
The parameter filtering should address any potential misuse or security concerns. As for compatibility between Strimzi and Cruise Control versions, a parameter that is unsupported by the bundle Cruise Control version will be rejected by Cruise Control at runtime and Strimzi will surface the error by transitioning the KafkaRebalance resource.
Did I understand/answer the question correctly @PaulRMellor?
Co-authored-by: PaulRMellor <47596553+PaulRMellor@users.noreply.github.com> Signed-off-by: Kyle Liberti <kliberti@redhat.com>
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
|
This is ready for another round of reviews whenever people have time of course! |
| 1. **Introduce the new `config` map and `volumes` field** while maintaining backward compatibility: | ||
| - Accept both old top-level primitive fields and new `config` map. | ||
| - Accept both `moveReplicasOffVolumes` and `volumes` (mapped to the same internal representation) | ||
| - If both old and new forms are provided, the new form takes precedence |
There was a problem hiding this comment.
I think we could even log a warning that they are both set but the old form will be ignored.
There was a problem hiding this comment.
Also what happens in the following scenario?
spec:
concurrentPartitionMovementsPerBroker: 10 # old
config:
concurrent_leader_movements: "5" # new but different field Is the logic going to ignore the old concurrentPartitionMovementsPerBroker because the resource has a spec.config field or it's going to make a merge because they are referring to two different fields?
There was a problem hiding this comment.
It would make a merge, respecting both fields and values but a warning would still be logged for the usage of the old concurrentPartitionMovementsPerBroker form.
There was a problem hiding this comment.
Just updated some text here in to address the first comment in the latest commit, let me know what you think!
There was a problem hiding this comment.
I would expect a merge yes, but at the same time, if our goal is discourage the usage of the current properties in favor of the config section, we could also decide that if you set the config section, it's going to override everything else coming from the dedicated fields. It could be counterintuitive though. In the past we had something similar with templates across Kafka and KafkaNodePool and we moved from an override approach to a merge. Let's see what others think about this.
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
This proposal addresses the increasing complexity and limited extensibility of the
KafkaRebalancecustom resource API.