-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 stopping connectors #9095
Conversation
...tor/src/main/java/io/strimzi/operator/cluster/operator/assembly/AbstractConnectOperator.java
Show resolved
Hide resolved
@@ -707,11 +745,11 @@ protected boolean hasRestartAnnotation(CustomResource resource, String connector | |||
} | |||
|
|||
/** | |||
* Return the ID of the connector task to be restarted if the provided KafkaConnector resource instance has the strimzio.io/restart-task annotation | |||
* Return the ID of the connector task to be restarted if the provided KafkaConnector resource instance has the strimzi.io/restart-task annotation |
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.
These 2 changes are unrelated. Let me know if you prefer to fix them in a separate PR.
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.
I left some nits. But LGTM otherwise. Also, it looks like the CI failure is related to this:
[ERROR] Failures:
[ERROR] io.strimzi.operator.cluster.operator.assembly.KafkaConnectApiIT.test(VertxTestContext)
[ERROR] Run 1: KafkaConnectApiIT.test(VertxTestContext) io.vertx.core.impl.NoStackTraceThrowable: Unexpected status code 204 for GET request to localhost:37969/connectors/test/stop
[ERROR] Run 2: KafkaConnectApiIT.test(VertxTestContext) io.vertx.core.impl.NoStackTraceThrowable: Unexpected status code 204 for GET request to localhost:46515/connectors/test/stop
[ERROR] Run 3: KafkaConnectApiIT.test(VertxTestContext) io.vertx.core.impl.NoStackTraceThrowable: Unexpected status code 204 for GET request to localhost:34987/connectors/test/stop
switch (state) { | ||
case "RUNNING" -> { | ||
if (effectiveState == ConnectorState.PAUSED) { | ||
LOGGER.debugCr(reconciliation, "Pausing connector {}", connectorName); |
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.
Would it make sense to log all the state changes on an INFO level?
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.
I changed them to INFO level
ConnectorState desiredState = connectorSpec.getState(); | ||
@SuppressWarnings("deprecation") | ||
Boolean shouldPause = connectorSpec.getPause(); | ||
ConnectorState effectiveState = desiredState != null ? desiredState : |
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.
I wonder if we can find better names here. I first assumed effectiveState
would be the current one. Maybe targetState
? Or maybe its just me who got confused by it.
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.
I renamed the variable to targetState
In This was not done in |
@mimaison I don't know I am afraid. I noticed there are a couple of other places where the wrapping doesn't happen (i.e. one in |
@tombentley wrote this if I remember it correctly. Maybe he would have an idea? Obviously, it is a long time ago. |
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.
LGTM. Thanks.
/azp run regression |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM. Thanks!
For the |
@mimaison Can you please do one more thing and add a record to the CHANGELOG.md? |
This implements Proposal 54: https://github.com/strimzi/proposals/blob/main/054-stopping-kafka-connect-connectors.md It adds a new field for connectors, state, that can be set to running (the default), paused or stopped. The existing pause field is now deprecated and if both fields are set, state takes precendence. Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
b6e0b4a
to
a6ca96b
Compare
@scholzj Done! |
Type of change
Description
This implements Proposal 54
It adds a new field for connectors, state, that can be set to running (the default), paused or stopped. The existing pause field is now deprecated and if both fields are set, state takes precedence.
The proposal also mentions handling Kafka Connect < 3.5 and downgrade stop to pause in this case. From what I understand the next version of Strimzi will only support Kafka >= 3.5 so the
PUT /connector/<CONN>/stop
should be available. For that reason I've not added logic to handle Kafka Connect < 3.5.Checklist
Please go through this checklist and make sure all applicable tasks have been done