Add possibility to cascade force delete connect cluster & connectors#348
Open
AfrinKhan02 wants to merge 11 commits into
Open
Add possibility to cascade force delete connect cluster & connectors#348AfrinKhan02 wants to merge 11 commits into
AfrinKhan02 wants to merge 11 commits into
Conversation
# Conflicts: # README.md
|
loicgreffier
reviewed
May 8, 2026
Collaborator
loicgreffier
left a comment
There was a problem hiding this comment.
@AfrinKhan02 Here is my review. Just one small remark. Could you please rebase the PR?
| ? spec.get(VERSION).toString() | ||
| : null), | ||
| dryRun, | ||
| DeleteMode.of(force, cascade), |
Collaborator
There was a problem hiding this comment.
I think the DeleteMode wrapper enum is unnecessary. We can just forward the force and cascade options as-is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Context
When deleting a connect cluster, the existing
--forceoption only removes the cluster from Ns4Kafka without touching the connectors on the actual Connect cluster. There was no way to perform a clean end-to-end removal that also deletes the related connectors - both from the real Connect cluster and from Ns4Kafka's records.This PR introduces a
--cascadeflag that enables cascading deletion of connectors when deleting a connect cluster, complementing the existing--forceflag. Used together (--cascade --force), they handle the case where the Connect cluster is unreachable but you still want to clean up Ns4Kafka's state.The behavior matrix is summarized below:
Proposed solution
Add a new
--cascadeCLI flag to thedeletecommand that is forwarded as a query parameter to the Ns4Kafka API, enabling server-side cascading deletion logic.Implementation
Delete.java- Added--cascadeoption (boolean flag), wired into the delete call alongside the existing--forceflag.NamespacedResourceClient.java- Extended the@DeleteURI template and method signature to include thecascadequery parameter.ResourceService.java- Propagated the newcascadeparameter through thedeletemethod to the namespaced client call.README.md- Updated CLI usage, option descriptions, and added example commands for--cascadeand--cascade --force.Tests
DeleteTest.javashouldCascadeDeleteConnectClusterByName- Verifies--cascadepassescascade=true, force=false.shouldCascadeForceDeleteConnectClusterByName- Verifies--cascade --forcepasses both flags astrue.anyBoolean()/eq(false)for thecascadeparameter.ResourceServiceTest.javashouldCascadeDeleteConnectCluster- Verifies cascade-only deletion at the service layer.shouldForceCascadeDeleteConnectCluster- Verifies force+cascade deletion at the service layer.shouldPassForceCascadeForUnsupportedResource- Verifies that force and cascade flags are transparently forwarded even for resource types that don't support them (e.g., Topic).Remarks