-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support for scale subresource to Connect, S2I, MM1, MM2, Bridge and Connectors #3165
Add support for scale subresource to Connect, S2I, MM1, MM2, Bridge and Connectors #3165
Conversation
@tombentley Before adding this to more resources and writting tests, I wondered what do you think abotu the code and whether you have any early comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of interest, what metrics do you think an autoscaler for connectors would use to decide how to scale, since it's Kube has no way to attribute CPU etc to a particular connector within a multi-connector cluster?
api/src/main/java/io/strimzi/api/kafka/model/status/KafkaConnectStatus.java
Outdated
Show resolved
Hide resolved
api/src/main/java/io/strimzi/api/kafka/model/status/KafkaConnectStatus.java
Outdated
Show resolved
Hide resolved
crd-generator/src/main/java/io/strimzi/crdgenerator/annotations/Crd.java
Outdated
Show resolved
Hide resolved
crd-generator/src/main/java/io/strimzi/crdgenerator/CrdGenerator.java
Outdated
Show resolved
Hide resolved
...tor/src/main/java/io/strimzi/operator/cluster/operator/assembly/AbstractConnectOperator.java
Outdated
Show resolved
Hide resolved
9968ff7
to
6a5727d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much do you think that the scale
subresource is useful for the bridge? We know that actually it's not so simple scaling the bridge and we always suggest to use different deployments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the other maintainers concerns this looks good to me!
api/src/main/java/io/strimzi/api/kafka/model/status/KafkaConnectorStatus.java
Outdated
Show resolved
Hide resolved
It could be actually quite useful when using the bridge for producing messages for example, or? That might be even something where you can use the usual autoscaling mechanisms such as CPU utilization etc. This PR doesn't really do anything else than making it possible for the users to use the scale subresource and nothing more. That is something what the user can already do by editing the resource anyway, this is just an easier way. As with any autoscaling, the user needs to plug it in manually and think about the autoscaling rules. So I think only future will show how useful or useless this is depending on whether users find some good way to use it, but I think there is only a little harm. |
Yes, good point. The bridge scaling problem is mostly related to consumers; using scaling for producer could make sense. |
Yeah ... we should have some metrics in the bridge as well. But that is missing right now. As for KEDA, I need to check with them, but from the docs my udnerstanding is that today, KEDA does not support scaling custom resources and supports only scaling of deployments. So ideally once we have this ready, we should convince them to add support for scaling any resource and not just Deployments. |
@scholzj I had a chat with KEDA guys. They have the feature planned for KEDA v2 (in one month or so) kedacore/keda#703. |
@ppatierno Right, this is exactly what would make these changes a bit more useful. |
...tor/src/main/java/io/strimzi/operator/cluster/operator/assembly/AbstractConnectOperator.java
Show resolved
Hide resolved
…d KafkaConnector Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com> Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
745ddd6
to
5587b10
Compare
…ces, try to fix the CRD tests on Minikube Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
…es bug #81342 Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
@ppatierno @samuel-hawker @tombentley I added tests etc. and this should now be ready for final review. |
/azp run system-tests |
Azure Pipelines successfully started running 1 pipeline(s). |
test/src/main/java/io/strimzi/test/k8s/cmdClient/KubeCmdClient.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Jakub Scholz <www@scholzj.com>
@strimzi-ci run tests |
❌ Test Summary ❌TEST_PROFILE: acceptance ❗ Test Failures ❗
Re-run command: |
/azp run system-tests |
Azure Pipelines successfully started running 1 pipeline(s). |
{ status.selector has no value? |
@exherb Hmm, looks like in the actual resource it is named As a workaround, you should be able to to replace the |
…nd Connectors (strimzi#3165) * Add support for scale subresource in KafkaConnect, its derivatives and KafkaConnector Signed-off-by: Jakub Scholz <www@scholzj.com> * Apply suggestions from code review Signed-off-by: Jakub Scholz <www@scholzj.com> Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com> * Review comments Signed-off-by: Jakub Scholz <www@scholzj.com> * Add scaling to Bridge and MM Signed-off-by: Jakub Scholz <www@scholzj.com> * Make existing tests pass and fix some review comments Signed-off-by: Jakub Scholz <www@scholzj.com> * Add CRD tests Signed-off-by: Jakub Scholz <www@scholzj.com> * Regen of APi reference after rebase Signed-off-by: Jakub Scholz <www@scholzj.com> * Add more tests for setitng the right statuses in the different resources, try to fix the CRD tests on Minikube Signed-off-by: Jakub Scholz <www@scholzj.com> * Fix unused imports and improve CHANGELOG.md Signed-off-by: Jakub Scholz <www@scholzj.com> * Travis seems to be too fast? Signed-off-by: Jakub Scholz <www@scholzj.com> * Try to fix Travis race conditions Signed-off-by: Jakub Scholz <www@scholzj.com> * Try to fix Travis race conditions II Signed-off-by: Jakub Scholz <www@scholzj.com> * Debug Travis Signed-off-by: Jakub Scholz <www@scholzj.com> * Bump kubectl to 1.16.0 since the issue seems ot be caused by Kubernetes bug #81342 Signed-off-by: Jakub Scholz <www@scholzj.com> * Cleanup previous debug and fix attempts Signed-off-by: Jakub Scholz <www@scholzj.com> * Use better name in waitFor method Signed-off-by: Jakub Scholz <www@scholzj.com> Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
Type of change
Description
This PR adds support for
scale
subresource. Rght now it is added to following resources:The scale subresource is useful because it makes it easier to scale the resources and for example use different tools for autoscaling on them.
To allow support for the
scale
subresource, some newstatus
fields have been added. One is a field which mirrors the corresponding number of replicas. Other one is label selector which is important for use with Horizontal Pod Autoscalers.For all Deployment based resources, this is done by a new field
.status.replicas
which mirrors.spec.replicas
and.status.podSelector
which can be used to select the pods. KafkaConnector is an example of scaling a resource not represented by pods. In this case, the label selector is not present and the.spec.tasksMax
and.status.tasksMax
represent the replicas field.The tests include a test for the CRD generator with CRD including status and scale subresources, tests of the
api
module that test that thescale
subresource works and Cluster Operator tests testing the new status fields. To make theapi
tests pass I had to updatekubectl
to 1.16 (1.15 has a bug kubernetes/kubernetes#81342 due to which it doesn't work).This PR also fixes the flaky test
KafkaCrdIT.testKafkaWithTemplate
which was causing problems while testing this.Checklist