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

Deal with conflict between Connect and Connect S2I #2463

Merged

Conversation

scholzj
Copy link
Member

@scholzj scholzj commented Jan 27, 2020

Type of change

  • Bugfix

Description

When both Kafka Connect and Kafka Connect S2I exist in the same namespace with the same name they conflict with each other. They share (and overwrite) each others services, config maps etc. This PR adds checks and only the older one from the two will be reconciled. The older or newer one is decided based on the Creation timestamp in metadata.

This PR doesn't really deal with situation where such two Connect and Connect S2I instances already exist - it will error the status and stop reconciling one of them, but not delete the pods etc. But given how disfunctional they would be I guess nobody is using this. When the user deletes one of the CRs thi should be resolved through the garbage collection.

Checklist

  • Write tests
  • Make sure all tests pass
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally

@scholzj scholzj added this to the 0.17.0 milestone Jan 27, 2020
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
Signed-off-by: Jakub Scholz <www@scholzj.com>
@scholzj scholzj force-pushed the deal-with-connect-and-connect-s2i-conflict branch from 9911eea to eece637 Compare January 27, 2020 21:43
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.

Does this actually work? I would expect that the check in the connector reconciliation (which is to prefer KafkaConnect over KafkaConnectS2I clusters) will need to be taken out.

// There is a KafkaConnectS2I with the same name which is older than this KafkaConnect
&& kafkaConnect.getMetadata().getCreationTimestamp().compareTo(otherConnect.getMetadata().getCreationTimestamp()) > 0) {
return Future.failedFuture("Both KafkaConnect and KafkaConnectS2I exist with the same name. " +
"KafkaConnectS2I seems to exists longer and will be used while this custom resource will be ignored.");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"KafkaConnectS2I seems to exists longer and will be used while this custom resource will be ignored.");
"KafkaConnectS2I is older and will be used while this custom resource will be ignored.");

// There is a KafkaConnect with the same name which is older than or equally old as this KafkaConnectS2I
&& kafkaConnectS2I.getMetadata().getCreationTimestamp().compareTo(otherConnect.getMetadata().getCreationTimestamp()) >= 0) {
return Future.failedFuture("Both KafkaConnect and KafkaConnectS2I exist with the same name. " +
"KafkaConnect seems to exists longer and will be used while this custom resource will be ignored.");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"KafkaConnect seems to exists longer and will be used while this custom resource will be ignored.");
"KafkaConnect is older and will be used while this custom resource will be ignored.");

Signed-off-by: Jakub Scholz <www@scholzj.com>
@scholzj
Copy link
Member Author

scholzj commented Jan 28, 2020

Hehe, good catch. It did work, because the service names are the same, so it actually still connects somewhere and handles the connector. But I fixed the code to make it a bit more clean now.

@tombentley
Copy link
Member

@scholzj I think you might need to make a small change to the docs, which IIRC mentions the old "KafkaConnect wins" behaviour for connectors.

@scholzj
Copy link
Member Author

scholzj commented Jan 28, 2020

@tombentley Any idea where in the docs? I didn't found anything.

@tombentley
Copy link
Member

@scholzj I took a look and I don't see it either. Maybe I misremembered.

@scholzj scholzj merged commit f9f9fe3 into strimzi:master Jan 28, 2020
@scholzj scholzj deleted the deal-with-connect-and-connect-s2i-conflict branch January 28, 2020 15:30
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

2 participants